Ejemplo n.º 1
0
    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.5f;
        m_stat.MoveSpeed      = 5.0f;
        _player               = GameObject.FindGameObjectWithTag("Player").transform;
        _curTime              = 0;
        _home        = transform.position;
        _animParamID = Animator.StringToHash("CurrentState");

        GuardMushroomState[] stateValues = (GuardMushroomState[])Enum.GetValues(typeof(GuardMushroomState));
        foreach (GuardMushroomState s in stateValues)
        {
            Type FSMType = Type.GetType("GuardMushroom" + s.ToString("G"));
            GuardMushroomStateBase state = (GuardMushroomStateBase)GetComponent(FSMType);
            if (state == null)
            {
                state = (GuardMushroomStateBase)gameObject.AddComponent(FSMType);
            }

            state.enabled = false;
            _states.Add(s, state);
        }

        SetState(startState);
        _isInit = true;
    }
Ejemplo n.º 2
0
    protected override void Awake()
    {
        base.Awake();
        _homePosition          = (new Vector3(GoHomePositionX, GoHomePositionY, GoHomePositionZ));
        Stat.MaxHp             = 300;
        Stat.Hp                = Stat.MaxHp;
        Stat.ChaseDistance     = 20f;
        Stat.AttackDistance    = 3.5f;
        Stat.MoveSpeed         = 2f;
        _attackDamage          = 10f;
        _attackDelay           = 3.5f;
        _attackTimer           = 0;
        _SbombTimer            = 0;
        _berserkermovespeed    = 4f;
        _berserkerattackDamage = 20f;
        _berserkerattackDelay  = 2f;
        _angle         = 180f;
        _player        = GameObject.FindGameObjectWithTag("Player").transform;
        _animParamID   = Animator.StringToHash("CurrentState");
        isDead         = false;
        QueenisAllDead = false;
        SBombing       = false;
        _ppending      = true;
        _gojjung       = transform.position;

        GuardMushroomState[] stateValues = (GuardMushroomState[])Enum.GetValues(typeof(GuardMushroomState));
        foreach (GuardMushroomState s in stateValues)
        {
            Type FSMType = Type.GetType("GuardMushroom" + s.ToString("G"));
            GuardMushroomStateBase state = (GuardMushroomStateBase)GetComponent(FSMType);
            if (state == null)
            {
                state = (GuardMushroomStateBase)gameObject.AddComponent(FSMType);
            }

            state.enabled = false;
            _states.Add(s, state);
        }

        SetState(startState);
        _isInit = true;
    }