Beispiel #1
0
        public void OnDeath()
        {
            if (m_Audio != null)
            {
                m_Audio.Delete();
            }

            m_Audio = null;
        }
    public void SetActiveState(bool active)
    {
        if (active)
        {
            if (null == m_Audio)
            {
                m_Audio = AudioManager.instance.Create(transform.position, m_SoundID, transform, true, false);
                if (null != m_Audio)
                {
                    m_Audio.SetVolume(0);
                    m_Audio.SetVolume(1, 0.5f);
                }
            }

            if (null == m_Effect)
            {
                m_Effect = new ControllableEffect(m_EffectID, transform);
            }
        }
        else
        {
            if (null != m_Audio)
            {
                m_Audio.StopAudio(1f);
                m_Audio.Delete(1.1f);
                m_Audio = null;
            }

            if (null != m_Effect)
            {
                m_Effect.Destory();
                m_Effect = null;
            }
        }
    }
Beispiel #3
0
 void OnDestroy()
 {
     if (m_Audio != null)
     {
         m_Audio.Delete();
     }
 }
Beispiel #4
0
        public void Destroy()
        {
            if (m_effect != null)
            {
                GameObject.Destroy(m_effect);
            }

            if (m_auCtrl != null)
            {
                m_auCtrl.Delete();
            }

            m_auCtrl  = null;
            m_Request = null;
        }
Beispiel #5
0
        private IEnumerator ChangeAudio()
        {
            yield return(new WaitForSeconds(1.5f));

            if (!motionMgr.IsActionRunning(ActionType))
            {
                yield break;
            }

            if (null != m_Audio)
            {
                m_Audio.Delete(0.5f);
                m_Audio = null;
            }

            if (null != jetPack && null != jetPack.m_EffectObj && 0 != jetPack.m_SoundID)
            {
                m_Audio = AudioManager.instance.Create(jetPack.m_EffectObj.transform.position,
                                                       jetPack.m_SoundID,
                                                       jetPack.m_EffectObj.transform,
                                                       false, false);
                m_Audio.PlayAudio(0.5f);
            }
        }
Beispiel #6
0
        public override void EndImmediately()
        {
            motionMgr.SetMaskState(PEActionMask.GunReload, false);
            if (null != anim)
            {
                anim.SetTrigger("ResetUpbody");
                if (null != gun)
                {
                    anim.ResetTrigger(gun.m_ReloadAnim);
                }
            }
            if (null != m_Audio)
            {
                m_Audio.Delete();
                m_Audio = null;
            }

            if (null != gun && null != ikCmpt && null != ikCmpt.m_IKAimCtrl)
            {
                ikCmpt.m_IKAimCtrl.EndSyncAimAxie();
            }
        }
Beispiel #7
0
        public override bool Update()
        {
            if (null == gun)
            {
                return(true);
            }
            if (null != energyGunLogic && !energyGunLogic.Equals(null))
            {
                energyGunLogic.lastUsedTime = Time.time;
            }
            switch (gun.m_ShootMode)
            {
            case ShootMode.SingleShoot:
                return(true);

            case ShootMode.MultiShoot:
                if (gun.m_AmmoType == AmmoType.Bullet)
                {
                    if (gun.magazineValue < 1)
                    {
                        m_EndFire = true;
                    }
                    else if (Time.time - m_LastShootTime > gun.m_FireRate)
                    {
                        OnFire(1);
                    }
                }
                else
                {
                    if (gun.magazineValue < gun.m_EnergyPerShoot)
                    {
                        m_EndFire = true;
                    }
                    else if (Time.time - m_LastShootTime > gun.m_FireRate)
                    {
                        OnFire(gun.m_EnergyPerShoot);
                    }
                }
                if (m_EndFire)
                {
                    if (null != m_Audio)
                    {
                        m_Audio.Delete(0.1f);
                        m_Audio = null;
                    }
                    return(true);
                }

                break;

            case ShootMode.ChargeShoot:
                if (Time.time - m_LastShootTime > gun.m_FireRate)
                {
                    if (m_EndAfterShoot)
                    {
                        m_EndFire = true;
                    }
                    if (m_HoldFireTime > m_ChargeEffectDelayTime)
                    {
                        if (null != gun.m_ChargeEffectGo && !gun.m_ChargeEffectGo.activeSelf)
                        {
                            m_Audio = AudioManager.instance.Create(gun.m_AimAttr.m_AimTrans.position,
                                                                   gun.m_ChargeSoundID,
                                                                   gun.m_AimAttr.m_AimTrans, true, false);
                            gun.m_ChargeEffectGo.SetActive(true);
                            gun.magazineValue -= gun.m_EnergyPerShoot;
                        }

                        if (gun.magazineValue <= gun.m_ChargeEnergySpeed * Time.deltaTime)
                        {
                            m_EndFire         = true;
                            gun.magazineValue = 0;
                        }
                        else
                        {
                            gun.magazineValue -= gun.m_ChargeEnergySpeed * Time.deltaTime;
                        }

                        if (m_EndFire)
                        {
                            OnFire(0, GetChargeLevel(m_HoldFireTime));
                            skillCmpt.StartSkill(skillCmpt, gun.m_ShootSoundID);

                            if (null != m_Audio)
                            {
                                m_Audio.Delete();
                                m_Audio = null;
                            }
                            if (null != gun.m_ChargeEffectGo)
                            {
                                gun.m_ChargeEffectGo.SetActive(false);
                            }
                            return(true);
                        }
                    }
                    else
                    {
                        if (m_EndFire)
                        {
                            OnFire(gun.m_EnergyPerShoot, GetChargeLevel(m_HoldFireTime));
                            skillCmpt.StartSkill(skillCmpt, gun.m_ShootSoundID);
                            return(true);
                        }
                    }

                    int oldChargeLevel = GetChargeLevel(m_HoldFireTime);
                    m_HoldFireTime += Time.deltaTime;
                    if (GetChargeLevel(m_HoldFireTime) > oldChargeLevel)
                    {
                        AudioManager.instance.Create(gun.transform.position, gun.m_ChargeLevelUpSoundID, gun.transform);
                        Effect.EffectBuilder.Instance.Register(gun.m_ChargeLevelUpEffectID, null, gun.m_AimAttr.m_AimTrans);
                    }
                }
                else if (m_EndFire)
                {
                    EndImmediately();
                    return(true);
                }
                break;
            }
            return(false);
        }