private void Awake() { _homePosition = (new Vector3(GoHomePositionX, GoHomePositionY, GoHomePositionZ)); m_stat = GetComponent <MonsterStat>(); m_controller = GetComponentInChildren <CharacterController>(); m_anim = GetComponentInChildren <Animator>(); m_stat.ChaseDistance = 10.0f; m_stat.AttackDistance = 1.8f; m_stat.MoveSpeed = 5.0f; _player = GameObject.FindGameObjectWithTag("Player").transform; _curTime = 0; _home = transform.position; _animParamID = Animator.StringToHash("CurrentState"); QueenMushroomState[] stateValues = (QueenMushroomState[])Enum.GetValues(typeof(QueenMushroomState)); foreach (QueenMushroomState s in stateValues) { Type FSMType = Type.GetType("QueenMushroom" + s.ToString("G")); QueenMushroomStateBase state = (QueenMushroomStateBase)GetComponent(FSMType); if (state == null) { state = (QueenMushroomStateBase)gameObject.AddComponent(FSMType); } state.enabled = false; _states.Add(s, state); } SetState(startState); _isInit = true; }
protected override void Awake() { base.Awake(); _homePosition = (new Vector3(GoHomePositionX, GoHomePositionY, GoHomePositionZ)); _stat.ChaseDistance = 20f; _stat.AttackDistance = 10f; _stat.MoveSpeed = 3.5f; _stat.MaxHp = 200f; _stat.Hp = _stat.MaxHp; _attackDamage = 10f; _attackDelay = 2.5f; _attackTimer = 0; _attackStack = 0; _hearTimer = 0; HealDelay = 10f; _player = GameObject.FindGameObjectWithTag("Player").transform; _curTime = 0; _home = transform.position; _animParamID = Animator.StringToHash("CurrentState"); isDead = false; HealTime = false; HealStart = false; _ppending = true; HealEffect.SetActive(false); QueenMushroomState[] stateValues = (QueenMushroomState[])Enum.GetValues(typeof(QueenMushroomState)); foreach (QueenMushroomState s in stateValues) { Type FSMType = Type.GetType("QueenMushroom" + s.ToString("G")); QueenMushroomStateBase state = (QueenMushroomStateBase)GetComponent(FSMType); if (state == null) { state = (QueenMushroomStateBase)gameObject.AddComponent(FSMType); } state.enabled = false; _states.Add(s, state); } SetState(startState); _isInit = true; }