AkiraPixelWind/Assets/Scripts/Main/Role/MonsterRole.cs

77 lines
2.1 KiB
C#
Raw Normal View History

using Axibug;
using Axibug.Event;
using Axibug.Runtime;
using System.Collections.Generic;
using UnityEngine;
namespace Game
{
public class MonsterRole : RoleBase
{
/// <summary>
/// <20><>ʼ<EFBFBD><CABC>
/// </summary>
/// <param name="data"></param>
public void Init(S_ROLE_MONSTER data)
{
base.Init(data);
}
protected override void OnEnable()
{
base.OnEnable();
AppEntry.Event.Subscribe(RoleDeadEventArgs.EventId, OnRoleDeadEventArgs);
AppEntry.Event.Subscribe(RoleDeadAnimeEndEventArgs.EventId, OnRoleDeadAnimeEndEventArgs);
}
protected override void OnDisable()
{
base.OnDisable();
AppEntry.Event.Unsubscribe(RoleDeadEventArgs.EventId, OnRoleDeadEventArgs);
AppEntry.Event.Unsubscribe(RoleDeadAnimeEndEventArgs.EventId, OnRoleDeadAnimeEndEventArgs);
}
public override void MeshChangeMoveState(bool ToMoveState)
{
if (ToMoveState)
{
Anime.StartRun();
}
else
{
Anime.BackToIdle();
}
}
public override void Release()
{
}
private void OnRoleDeadEventArgs(object sender, LogicEventArgs e)
{
RoleDeadEventArgs msg = (RoleDeadEventArgs)e;
if (msg == null) throw new GameException("RoleDeadEventArgs is null");
if (msg.RoleID == RoleID)
{
//<2F>ر<EFBFBD><D8B1><EFBFBD>ײ<EFBFBD><D7B2>
mselfCollider.enabled = false;
//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mRigidbody.useGravity = false;
}
}
private void OnRoleDeadAnimeEndEventArgs(object sender, LogicEventArgs e)
{
RoleDeadAnimeEndEventArgs msg = (RoleDeadAnimeEndEventArgs)e;
if (msg == null) throw new GameException("RoleDeadAnimeEndEventArgs");
if (msg.RoleID == RoleID)
{
GamePlayEntry.RoleMgr.DestroyRole(this);
}
}
}
}