Exemplo n.º 1
0
    protected override void Start()
    {
        m_AIData = new MobInfo();
        GameData.Instance.MobInfoTable[3100].CopyTo(m_AIData);

        m_MaxHp = m_AIData.m_fHp;
        base.Start();

        m_MobAnimator                  = this.GetComponent <MobAnimationsController>();
        m_BodyCollider                 = this.GetComponent <BoxCollider>();
        m_DamageCollider               = this.GetComponentInChildren <CapsuleCollider>();
        m_FSM                          = new FSMSystem(m_AIData);
        m_AIData.m_Go                  = this.gameObject;
        m_AIData.m_FSMSystem           = m_FSM;
        m_AIData.m_AnimationController = this.GetComponent <MobAnimationsController>();
        m_AIData.navMeshAgent          = this.GetComponent <NavMeshAgent>();
        m_AIData.navMeshAgent.speed    = Random.Range(6.5f, 7.0f);
        m_AIData.navMeshAgent.enabled  = false;
        m_AIData.m_SoundManager        = m_SoundManager;

        #region FSMMap
        FSMRespawnState    m_RespawnState    = new FSMRespawnState();
        FSMChaseState      m_Chasestate      = new FSMChaseState();
        FSMAttackState     m_Attackstate     = new FSMAttackState();
        FSMIdleState       m_IdleState       = new FSMIdleState();
        FSMWanderIdleState m_WanderIdleState = new FSMWanderIdleState();
        FSMWanderState     m_WanderState     = new FSMWanderState();

        m_RespawnState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);

        m_Chasestate.AddTransition(eFSMTransition.Go_Attack, m_Attackstate);

        m_Attackstate.AddTransition(eFSMTransition.Go_Idle, m_IdleState);
        m_Attackstate.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);

        m_IdleState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);
        m_IdleState.AddTransition(eFSMTransition.Go_Attack, m_Attackstate);

        m_WanderIdleState.AddTransition(eFSMTransition.Go_Wander, m_WanderState);
        m_WanderIdleState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);

        m_WanderState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);
        m_WanderState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);

        FSMFishGetHurtState m_GetHurtState = new FSMFishGetHurtState();
        FSMDeadState        m_DeadState    = new FSMDeadState();

        m_GetHurtState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);
        m_GetHurtState.AddTransition(eFSMTransition.Go_Attack, m_Attackstate);

        m_DeadState.AddTransition(eFSMTransition.Go_Respawn, m_RespawnState);

        m_FSM.AddGlobalTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);
        m_FSM.AddGlobalTransition(eFSMTransition.Go_FishGetHurt, m_GetHurtState);
        m_FSM.AddGlobalTransition(eFSMTransition.Go_Dead, m_DeadState);

        m_FSM.AddState(m_RespawnState);
        m_FSM.AddState(m_WanderIdleState);
        m_FSM.AddState(m_IdleState);
        m_FSM.AddState(m_Chasestate);
        m_FSM.AddState(m_Attackstate);
        m_FSM.AddState(m_GetHurtState);
        m_FSM.AddState(m_DeadState);
        m_FSM.AddState(m_WanderState);
        #endregion
    }
Exemplo n.º 2
0
    protected override void Start()
    {
        m_AIData = new MobInfo();
        GameData.Instance.MobInfoTable[3200].CopyTo(m_AIData);

        m_MaxHp = m_AIData.m_fHp;
        base.Start();

        m_MobAnimator                  = this.GetComponent <MobAnimationsController>();
        m_BobyCollider                 = this.GetComponent <BoxCollider>();
        m_DamageCollider               = GetComponentInChildren <CapsuleCollider>();
        m_MobAimLine                   = this.GetComponent <MobAimLine>();
        m_FSM                          = new FSMSystem(m_AIData);
        m_AIData.m_Go                  = this.gameObject;
        m_AIData.m_FSMSystem           = m_FSM;
        m_AIData.m_AnimationController = this.GetComponent <MobAnimationsController>();
        m_AIData.navMeshAgent          = this.GetComponent <NavMeshAgent>();
        m_AIData.navMeshAgent.enabled  = false;
        m_AIData.m_MobAimLine          = m_MobAimLine;
        m_AIData.m_SoundManager        = m_SoundManager;

        #region FSMMap

        #region Phase1

        m_WanderIdleState.AddTransition(eFSMTransition.Go_Wander, m_WanderState);
        m_WanderIdleState.AddTransition(eFSMTransition.Go_Flee, m_FleeState);
        m_WanderIdleState.AddTransition(eFSMTransition.Go_Idle, m_IdleState);

        m_WanderState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);
        m_WanderState.AddTransition(eFSMTransition.Go_Flee, m_FleeState);

        m_FleeState.AddTransition(eFSMTransition.Go_CallArmy, m_CallArmyState);
        #endregion

        #region Phase2

        m_CallArmyState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);
        m_CallArmyState.AddTransition(eFSMTransition.Go_Dodge, m_DodgeState);

        m_Chasestate.AddTransition(eFSMTransition.Go_Attack, m_PatrolAttackstate);

        m_DodgeState.AddTransition(eFSMTransition.Go_Attack, m_PatrolAttackstate);

        m_PatrolAttackstate.AddTransition(eFSMTransition.Go_Idle, m_IdleState);
        m_PatrolAttackstate.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);

        m_IdleState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);
        m_IdleState.AddTransition(eFSMTransition.Go_Dodge, m_DodgeState);
        m_IdleState.AddTransition(eFSMTransition.Go_Attack, m_PatrolAttackstate);

        m_FSMNoPlayerWanderIdleState.AddTransition(eFSMTransition.Go_NoPlayerWander, m_FSMNoPlayerWander);
        m_FSMNoPlayerWanderIdleState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);
        m_FSMNoPlayerWanderIdleState.AddTransition(eFSMTransition.Go_Dodge, m_DodgeState);


        m_FSMNoPlayerWander.AddTransition(eFSMTransition.Go_NoPlayerWanderIdle, m_FSMNoPlayerWanderIdleState);
        m_FSMNoPlayerWander.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);
        m_FSMNoPlayerWander.AddTransition(eFSMTransition.Go_Dodge, m_DodgeState);
        #endregion

        FSMPatrolGetHurtState m_GetHurtState = new FSMPatrolGetHurtState();
        FSMDeadState          m_DeadState    = new FSMDeadState();

        m_GetHurtState.AddTransition(eFSMTransition.Go_Flee, m_FleeState);
        m_GetHurtState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate);
        m_GetHurtState.AddTransition(eFSMTransition.Go_Dodge, m_DodgeState);
        m_DeadState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);

        m_FSM.AddGlobalTransition(eFSMTransition.Go_NoPlayerWanderIdle, m_FSMNoPlayerWanderIdleState);
        m_FSM.AddGlobalTransition(eFSMTransition.Go_PatrolGetHurt, m_GetHurtState);
        m_FSM.AddGlobalTransition(eFSMTransition.Go_Dead, m_DeadState);

        m_FSM.AddState(m_WanderIdleState);
        m_FSM.AddState(m_WanderState);
        m_FSM.AddState(m_FleeState);
        m_FSM.AddState(m_CallArmyState);
        m_FSM.AddState(m_Chasestate);
        m_FSM.AddState(m_DodgeState);
        m_FSM.AddState(m_PatrolAttackstate);
        m_FSM.AddState(m_IdleState);
        m_FSM.AddState(m_FSMNoPlayerWanderIdleState);
        m_FSM.AddState(m_FSMNoPlayerWander);
        m_FSM.AddState(m_GetHurtState);
        m_FSM.AddState(m_DeadState);
        #endregion
    }
Exemplo n.º 3
0
    protected override void Start()
    {
        m_AIData = new MobInfo();
        GameData.Instance.MobInfoTable[3400].CopyTo(m_AIData);
        m_SoundManager = this.GetComponent <SoundManager>();
        SoundDataSetting Soundsetting = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Mobs/Tank", "SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(Soundsetting.SoundDatas);

        m_MaxHp = m_AIData.m_fHp;
        base.Start();

        m_MobAnimator                  = this.GetComponent <MobAnimationsController>();
        m_BodyCollider                 = this.GetComponent <BoxCollider>();
        m_DamageCollider               = GetComponentInChildren <CapsuleCollider>();
        m_FSM                          = new FSMSystem(m_AIData);
        m_AIData.m_Go                  = this.gameObject;
        m_AIData.m_FSMSystem           = m_FSM;
        m_AIData.m_AnimationController = this.GetComponent <MobAnimationsController>();
        m_AIData.navMeshAgent          = this.GetComponent <NavMeshAgent>();
        m_AIData.navMeshAgent.speed    = Random.Range(4.5f, 5.0f);
        m_AIData.navMeshAgent.enabled  = false;
        m_AIData.m_SoundManager        = m_SoundManager;

        FSMRespawnState             m_RespawnState             = new FSMRespawnState();
        FSMChaseToRemoteAttackState m_ChaseToRemoteAttackState = new FSMChaseToRemoteAttackState();
        FSMChaseToMeleeAttackState  m_ChaseToMeleeAttackState  = new FSMChaseToMeleeAttackState();
        FSMAttackState       m_Attackstate       = new FSMAttackState();
        FSMRemoteAttackState m_RemoteAttackstate = new FSMRemoteAttackState();
        FSMTankIdleState     m_TankIdleState     = new FSMTankIdleState();
        FSMWanderIdleState   m_WanderIdleState   = new FSMWanderIdleState();
        FSMWanderState       m_WanderState       = new FSMWanderState();

        m_RespawnState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);

        m_ChaseToRemoteAttackState.AddTransition(eFSMTransition.Go_RemoteAttack, m_RemoteAttackstate);

        m_RemoteAttackstate.AddTransition(eFSMTransition.Go_TankIdle, m_TankIdleState);

        m_TankIdleState.AddTransition(eFSMTransition.Go_ChaseToRemoteAttack, m_ChaseToRemoteAttackState);
        m_TankIdleState.AddTransition(eFSMTransition.Go_RemoteAttack, m_RemoteAttackstate);
        m_TankIdleState.AddTransition(eFSMTransition.Go_ChaseToMeleeAttack, m_ChaseToMeleeAttackState);
        m_TankIdleState.AddTransition(eFSMTransition.Go_Attack, m_Attackstate);

        m_ChaseToMeleeAttackState.AddTransition(eFSMTransition.Go_Attack, m_Attackstate);
        m_ChaseToMeleeAttackState.AddTransition(eFSMTransition.Go_RemoteAttack, m_RemoteAttackstate);

        m_Attackstate.AddTransition(eFSMTransition.Go_TankIdle, m_TankIdleState);

        m_WanderIdleState.AddTransition(eFSMTransition.Go_ChaseToRemoteAttack, m_ChaseToRemoteAttackState);
        m_WanderIdleState.AddTransition(eFSMTransition.Go_Wander, m_WanderState);

        m_WanderState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);

        FSMTankGetHurtState m_GetHurtState = new FSMTankGetHurtState();
        FSMDeadState        m_DeadState    = new FSMDeadState();

        m_GetHurtState.AddTransition(eFSMTransition.Go_ChaseToRemoteAttack, m_ChaseToRemoteAttackState);
        m_GetHurtState.AddTransition(eFSMTransition.Go_RemoteAttack, m_RemoteAttackstate);

        m_DeadState.AddTransition(eFSMTransition.Go_Respawn, m_RespawnState);

        m_FSM.AddGlobalTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState);
        m_FSM.AddGlobalTransition(eFSMTransition.Go_TankGetHurt, m_GetHurtState);
        m_FSM.AddGlobalTransition(eFSMTransition.Go_Dead, m_DeadState);


        m_FSM.AddState(m_RespawnState);
        m_FSM.AddState(m_ChaseToRemoteAttackState);
        m_FSM.AddState(m_ChaseToMeleeAttackState);
        m_FSM.AddState(m_Attackstate);
        m_FSM.AddState(m_RemoteAttackstate);
        m_FSM.AddState(m_TankIdleState);
        m_FSM.AddState(m_WanderIdleState);
        m_FSM.AddState(m_WanderState);
        m_FSM.AddState(m_GetHurtState);
        m_FSM.AddState(m_DeadState);
    }