예제 #1
0
 void Explosion()
 {
     if (RigidSelf.velocity.sqrMagnitude < 8)
     {
         return;
     }
     EffectPlayer.PlayAtPos(explosionPath, transform.position);
     if (++_count > 2)
     {
         Destroy(gameObject);
     }
 }
예제 #2
0
 public void Execute(InteractiveObj self, Vector3 pos)
 {
     GameClient.Instance.NextTick(() =>
     {
         if (!self)
         {
             return;
         }
         EffectPlayer.PlayAtPos(EffectFX, pos);
         AudioSystem.Instance.PlayAtPos(EffectSE, pos);
         OnExecute(self, pos);
     }, EffectDelay / 1000f);
 }
예제 #3
0
 protected virtual void Settlement(Vector3 pos)
 {
     if (HitFX)
     {
         EffectPlayer.PlayAtPos(HitFX, pos);
     }
     if (HitSE)
     {
         AudioSystem.Instance.PlayAtPos(HitSE, pos);
     }
     SkillEffectBase[] effects = GetComponentsInChildren <SkillEffectBase>(true);
     for (int i = 0, length = effects.Length; i < length; ++i)
     {
         effects[i].Execute(Master, pos);
     }
 }
예제 #4
0
 protected void Death()
 {
     HP = 0;
     for (int i = 0, length = listBuff.Count; i < length; ++i)
     {
         listBuff[i].Remove(true);
     }
     listBuff.Clear();
     ForceTarget = CurrentTarget = null;
     dicFightingObjs.Clear();
     AudioSystem.Instance.PlayAtPos(clipDead, transform.position);
     EffectPlayer.PlayAtPos(effectDead, transform.position);
     OnSelfDeath();
     IsAlive = false;
     UIHeadInfo.DoUpdate(0);
     OnDeath.Invoke();
 }
예제 #5
0
    protected override CastResult OnCast()
    {
        for (int i = 0, length = Random.Range(MissleMinCount, MissleMaxCount + 1); i < length; ++i)
        {
            if (ReleaseFX)
            {
                EffectPlayer.PlayOnTransform(ReleaseFX, ReleaseFXPoint);
            }
            if (ReleaseSE)
            {
                AudioSystem.Instance.PlayOnTransform(ReleaseSE, ReleaseFXPoint);
            }
            Missle missle = Instantiate(MisslePrefab, transform.position, transform.rotation).GetOrAddComponent <Missle>();
            switch (LockType)
            {
            case SkillLockType.Position:
                switch (MissleType)
                {
                case Type.Bullet:
                    missle.InitBullet(TargetPos, MissileSpeed, Settlement);
                    break;

                default:
                    missle.Init(TargetPos, MissileSpeed, Settlement);
                    break;
                }
                break;

            case SkillLockType.NoLock:
                switch (MissleType)
                {
                case Type.Bullet:
                    //missle.InitBullet(TargetPos, MissileSpeed, Settlement);
                    break;

                default:
                    missle.gameObject.AddComponent <SphereCollider>().isTrigger = true;
                    missle.gameObject.AddComponent <Rigidbody>().isKinematic    = true;
                    missle.InitFlyFront(Master.transform.forward, MissileSpeed, SkillMaxRange, (hitObj, missleScript) =>
                    {
                        if (hitObj)
                        {
                            InteractiveObj target = hitObj.GetComponent <InteractiveObj>();
                            if (target)
                            {
                                if (target.IsAlive && target.IsEnemy(Master.Camp))
                                {
                                    Settlement(target);
                                    Destroy(missleScript.gameObject);
                                }
                                return;
                            }
                            Q_SceneObj sceneObj = hitObj.GetComponent <Q_SceneObj>();
                            if (sceneObj)
                            {
                                switch (sceneObj.objType)
                                {
                                case Q_SceneObj.Type.Skill:
                                case Q_SceneObj.Type.Item:
                                case Q_SceneObj.Type.NeedItem:
                                    break;

                                default:
                                    return;
                                }
                            }
                        }
                        if (HitFX)
                        {
                            EffectPlayer.PlayAtPos(HitFX, missleScript.transform.position);
                        }
                        if (HitSE)
                        {
                            AudioSystem.Instance.PlayAtPos(HitSE, missleScript.transform.position);
                        }
                        missleScript.Alive = false;
                        Destroy(missleScript.gameObject);
                    });
                    break;
                }
                break;

            default:
                if (Target)
                {
                    missle.Init(Target.transform, MissileSpeed, (tsf) => Settlement(tsf.GetComponent <InteractiveObj>()));
                }
                else
                {
                    missle.Init(TargetPos, MissileSpeed, Settlement);
                }
                break;
            }
            missle.SetLifeTime(MissleLifeTime);
            if (FlySE)
            {
                AudioSystem.Instance.PlayOnTransform(FlySE, missle.transform);
            }
        }
        return(CastResult.Success);
    }