示例#1
0
 public void BulletTrigger(ExplodeObject expObj)
 {
     if (Cannon.CheckSuitability(expObj.objectType, bullet.bulletType))
     {
         expObj.MakeDamage(GetValueByState(bullet.damageHealthParams.damage, currentState));
         currentState += 1;
         if (currentState == 3)
         {
             ObjectsPool.PushObject(bullet.poolPath, bullet.gameObject);
         }
         else
         {
             triangle1Transform.localScale = new Vector3(
                 GetValueByState(triangle1Transform.localScale.x, currentState),
                 GetValueByState(triangle1Transform.localScale.y, currentState),
                 GetValueByState(triangle1Transform.localScale.z, currentState)
                 );
             triangle2Transform.localScale = new Vector3(
                 GetValueByState(triangle2Transform.localScale.x, currentState),
                 GetValueByState(triangle2Transform.localScale.y, currentState),
                 GetValueByState(triangle2Transform.localScale.z, currentState)
                 );
         }
     }
 }
示例#2
0
    public void BulletMineTrigger(ExplodeObject expObj)
    {
        if (Cannon.CheckSuitability(expObj.objectType, bullet.bulletType))
        {
            if (!explodeTimerActive)
            {
                explodeTimer.SetTimer(explodeTime);
                explodeTimerActive = true;
                StartCoroutine(explodeTimer.ActionAfterTimer(() => {
                    foreach (ExplodeObject obj in bullet.triggeredExplodeObject)
                    {
                        if (obj.gameObject.activeInHierarchy)
                        {
                            if (Cannon.CheckSuitability(obj.objectType, bullet.bulletType))
                            {
                                obj.MakeDamage(bullet.damageHealthParams.damage);
                            }
                        }
                    }

                    string effectPath = "";
                    if (isShutterMine)
                    {
                        effectPath = "Prefabs/Effects/bullet2ExplodeShatter";
                    }
                    else
                    {
                        effectPath = "Prefabs/Effects/bullet2Explode";
                    }
                    Vector3 bulletPosition       = bullet.transform.position;
                    GameObject effectObj         = ObjectsPool.PullObject(effectPath);
                    effectObj.transform.position = bulletPosition;
                    Effect effect   = effectObj.GetComponent <Effect> ();
                    effect.poolPath = effectPath;
                    effect.main.Play();
                    effect.DestoyOverTime(effect.main.main.duration);

                    if (isShutterMine)
                    {
                        string shatterPath = "Prefabs/Bullets/bullet2ShatterPart";
                        for (int i = 0; i < shattersCount; i++)
                        {
                            GameObject shatter = ObjectsPool.PullObject(shatterPath);
                            //Debug.Log(bullet.transform.position);
                            shatter.transform.position = bulletPosition;
                            Bullet sbullet             = shatter.GetComponent <Bullet> ();
                            sbullet.poolPath           = shatterPath;
                            sbullet.BulletAwake();
                            sbullet.bulletType = bullet.bulletType;
                        }
                    }

                    ObjectsPool.PushObject(bullet.poolPath, this.gameObject);
                }));
            }
        }
    }
示例#3
0
 public void DefaultBulletTrigger(ExplodeObject expObject)
 {
     if (Cannon.CheckSuitability(expObject.objectType, bulletType))
     {
         expObject.MakeDamage(damageHealthParams.damage);
     }
     foreach (ParticleSystem effect in effects)
     {
         effect.Stop();
     }
     ObjectsPool.PushObject(poolPath, this.gameObject);
 }