private void Awake()
    {
        m_SoundManager = this.GetComponent <SoundManager>();
        SoundDataSetting soundData = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Item", "Item_SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(soundData.SoundDatas);
    }
Beispiel #2
0
    private void OnEnable()
    {
        m_SoundManager = this.GetComponent <SoundManager>();
        SoundDataSetting Soundsetting = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Mobs/Fish", "SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(Soundsetting.SoundDatas);
        MobManager.m_Instance.OnDestroyAll += Death;
        if (m_FSM == null)
        {
            return;
        }
        m_AIData.m_Go            = this.gameObject;
        m_bDead                  = false;
        m_CurrentHp              = m_MaxHp;
        m_BodyCollider.enabled   = true;
        m_DamageCollider.enabled = true;
        m_GODeadBlood            = null;
        m_GOHurtBlood            = null;
        m_DeadBloodSpurt         = null;
        m_HurtBloodSpurt         = null;
        m_FSM.PerformTransition(eFSMTransition.Go_Respawn);
        if (OnSpawn != null)
        {
            OnSpawn();
        }
    }
Beispiel #3
0
        private void Awake()
        {
            m_Animator     = this.GetComponent <Animator>();
            m_SoundManager = this.GetComponent <SoundManager>();
            SoundDataSetting soundData = Resources.Load("Sounds/Reward/ExpBar_SoundDataSetting") as SoundDataSetting;

            m_SoundManager.SetAudioClips(soundData.SoundDatas);
        }
        private void Awake()
        {
            m_CanvasTween  = this.GetComponent <UITweenCanvasAlpha>();
            m_SoundManager = this.GetComponent <SoundManager>();
            SoundDataSetting soundData = Resources.Load("Sounds/Reward/ExpBar_SoundDataSetting") as SoundDataSetting;

            m_SoundManager.SetAudioClips(soundData.SoundDatas);
        }
Beispiel #5
0
        private void Awake()
        {
            m_SoundManager = GetComponent <SoundManager>();
            SoundDataSetting soundData = Resources.Load("Sounds/Reward/PanelReward_SoundDataSetting") as SoundDataSetting;

            m_SoundManager.SetAudioClips(soundData.SoundDatas);

            m_MissionRewardMap = new Dictionary <eMissionType, UIMissionReward>();
            m_PlayerRewardMap  = new Dictionary <int, UIPlayerReward>();
        }
    private void Awake()
    {
        m_SoundManager = this.GetComponent <SoundManager>();
        SoundDataSetting data = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/StratagemController", "SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(data.SoundDatas);

        m_CheckCodesMechine              = this.GetComponent <CheckCodesMechine>();
        m_CheckCodesMechine.OnGetResult += GetReady;
        m_CheckCodesMechine.OnChecking  += () => m_SoundManager.PlayInWorld(2001, this.transform.position);
    }
Beispiel #7
0
    // Use this for initialization
    private void OnEnable()
    {
        m_SoundManager = this.GetComponent <SoundManager>();
        SoundDataSetting Soundsetting = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Mobs/Effect/FireBomb", "SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(Soundsetting.SoundDatas);
        if (m_Animator == null)
        {
            return;
        }
        m_Timer = 0.0f;
        m_Animator.SetTrigger("startTrigger");
    }
    private void Awake()
    {
        m_SoundManager = this.GetComponent <SoundManager>();
        SoundDataSetting soundData = Resources.Load("Sounds/Mission/MissionTower_SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(soundData.SoundDatas);

        m_CodeMechine              = this.GetComponent <CheckCodesMechine>();
        m_CodeMechine.OnGetResult += SuccessOnCheckCode;
        m_CodeMechine.OnFaild     += StartCheckCodes;
        m_CodeMechine.OnGetResult += () => m_SoundManager.PlayInWorld(0, this.transform.position);
        m_CodeMechine.OnChecking  += () => m_SoundManager.PlayInWorld(3, this.transform.position);
        m_CodeMechine.OnFaild     += () => m_SoundManager.PlayInWorld(2, this.transform.position);
    }
Beispiel #9
0
        private void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }
            else
            {
                Destroy(this.gameObject);
            }

            m_SoundManager = this.GetComponent <SoundManager>();
            SoundDataSetting soundData = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Mission", "PanelMission_SoundDataSetting") as SoundDataSetting;

            m_SoundManager.SetAudioClips(soundData.SoundDatas);

            m_MissionElementMap = new Dictionary <eMissionType, List <UIMissionInfo> >();
        }
Beispiel #10
0
    /// <summary>
    /// Initialize by player info to setup player's weapons and stratagems.
    /// </summary>
    /// <param name="data"></param>
    public void Initialize(PlayerInfo data, int serialNum = 1)
    {
        data.CopyTo(m_Data);
        m_SerialNumber = serialNum;
        m_Record       = new PlayerRecord();

        this.OnDeathBegin  += () => { m_Record.TimesOfDeath++; };
        m_ControllerSetting = PlayerManager.Instance.Players[serialNum].controllerSetting;
        m_Controller.SetJoyNumber(m_ControllerSetting);

        // Setup stratagems
        m_StratagemController.CheckCodesMechine.InputVertical   = m_ControllerSetting.StratagemVertical;
        m_StratagemController.CheckCodesMechine.InputHorizontal = m_ControllerSetting.StratagemHorizontal;
        if (m_StratagemController.Stratagems.Count > 0)
        {
            m_StratagemController.Clear();
        }
        if (m_Data.Stratagems.Count > 0)
        {
            m_StratagemController.AddStratagems(m_Data.Stratagems, m_Parts.RightHand, m_Parts.LaunchPoint);
        }

        // Setup weapons
        m_WeapoonController.ClearWeapon();
        m_WeapoonController.OnFire += () => { m_Record.Shots++; };
        if (m_Data.Weapons.Count > 0)
        {
            m_WeapoonController.AddMultiWeapons(m_Data.Weapons, m_Parts.LaunchPoint, this);
        }

        // Setup grenades
        if (m_Data.Grenades.Count > 0)
        {
            m_GrenadesController.AddGrenades(data.Grenades, m_Parts.RightHand, m_Parts.LaunchPoint, this);
        }

        // Setup sounds
        SoundDataSetting soundData = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Player", "SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(soundData.SoundDatas);
        OnSpawnFinish += () => m_SoundManager.PlayInWorld(UnityEngine.Random.Range(1010, 1013), this.transform.position);
        OnDeathBegin  += () => m_SoundManager.PlayInWorld(UnityEngine.Random.Range(1020, 1023), this.transform.position);
        OnDamaged     += () => m_SoundManager.PlayInWorld(UnityEngine.Random.Range(1030, 1033), this.transform.position);
    }
Beispiel #11
0
    /// <summary>
    /// Setup stratagem by id key which is in the gamedata.stratagem table.
    /// </summary>
    /// <param name="id">The id key which is in the gamedata.stratagem table.</param>
    /// <param name="launchPos">The spawn transform root.</param>
    /// <returns></returns>
    public bool SetStratagemInfo(int id, Transform readyPos, Transform launchPos)
    {
        StratagemInfo newInfo;

        if (TryGetInfoFromGameData(id, out newInfo) == false)
        {
            return(false);
        }

        this.gameObject.name = string.Format("Stratagem {0}", m_Info.Title);

        // Load display prefab.
        if (newInfo.DisplayID.Equals(m_Info.DisplayID) == false)
        {
            GameObject display;

            if (ResourceManager.m_Instance == null)
            {
                Debug.LogWarningFormat("Stratagem Warning ({0}) : ResourcesManager doesn't exist, Using Resource.Load()", this.gameObject.name);
                display = Resources.Load(string.Format("{0}/{1}", StratagemSystem.DisplayFolder, newInfo.DisplayID)) as GameObject;
            }
            else
            {
                display = ResourceManager.m_Instance.LoadData(typeof(GameObject), StratagemSystem.DisplayFolder, newInfo.DisplayID) as GameObject;
            }

            if (display == null)
            {
                display = StratagemSystem.DefaultDisplay;
            }

            DestroyImmediate(m_Display);
            m_Display  = Instantiate(display, this.transform.position, Quaternion.identity, this.transform);
            m_Animator = m_Display.GetComponent <Animator>();
        }

        // Load result prefab.
        if (newInfo.ResultID.Equals(m_Info.ResultID) == false)
        {
            GameObject result;

            if (ResourceManager.m_Instance == null)
            {
                Debug.LogWarningFormat("Stratagem Warning ({0}) : ResourcesManager doesn't exist, Using Resource.Load()", this.gameObject.name);
                result = Resources.Load(string.Format("{0}/{1}", StratagemSystem.ResultFolder, newInfo.ResultID)) as GameObject;
            }
            else
            {
                result = ResourceManager.m_Instance.LoadData(typeof(GameObject), StratagemSystem.ResultFolder, newInfo.ResultID.ToString()) as GameObject;
            }

            if (result == null)
            {
                result = StratagemSystem.DefaultResult;
            }
            m_Result = result;

            int count = (newInfo.Uses == -1) ? 10 : newInfo.Uses;
            ObjectPool.m_Instance.InitGameObjects(result, count, newInfo.ResultID);
        }

        // Load Sound
        SoundDataSetting data = ResourceManager.m_Instance.LoadData(typeof(SoundDataSetting), "Sounds/Stratagems", "SoundDataSetting") as SoundDataSetting;

        m_SoundManager.SetAudioClips(data.SoundDatas);

        m_LaunchPos = launchPos;
        m_ReadyPos  = readyPos;
        this.transform.localPosition    = Vector3.zero;
        this.transform.localEulerAngles = Vector3.zero;

        newInfo.CopyTo(m_Info);
        ResetState();
        return(true);
    }
Beispiel #12
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);
    }