public static MonsterAttackState GetInstance() { if (instance == null) { instance = new MonsterAttackState(); } return(instance); }
public void Execute(CMonster type, float time) { if (NavigationMgr.GetInstance().GetGrid().GetDistance(CCearcueMgr.GetInstance().player.PositionInPathGrid, type.PositionInPathGrid) <= CMonsterCommon.eyeArea && NavigationMgr.GetInstance().GetGrid().GetDistance(CCearcueMgr.GetInstance().player.PositionInPathGrid, type.PositionInPathGrid) > CMonsterCommon.AttackArea) { type.m_stateMachine.ChangeState(MonsterMoveState.GetInstance()); } else if (NavigationMgr.GetInstance().GetGrid().GetDistance(CCearcueMgr.GetInstance().player.PositionInPathGrid, type.PositionInPathGrid) <= CMonsterCommon.AttackArea) { curCDTime += time; if (curCDTime >= CMonsterCommon.AttackCD) { curCDTime = 0; type.m_stateMachine.ChangeState(MonsterAttackState.GetInstance()); } } }