Exemplo n.º 1
0
 //called when the bullet hits something, from the OnCollisionEnter in EnemyController
 public void Collide()
 {
     //Add other destruction stuff here
     //gameObject.SetActive (false);
     if (splash != 0)
     {
         if (poison != 0)
         {
             //POISON CLOUD HERE
         }
         else
         {
             //AoE DAMAGE HERE
             //Debug.Log ("got to splash");
             knockback   = 0f;          //to avoid stacking knockback
             stun        = 0f;          //to avoid stacking stun effect
             penetration = 0f;
             GameObject splashCircle = Instantiate(Resources.Load("Prefabs/SplashCircle")) as GameObject;
             splashCircle.transform.position = this.transform.position;
             AoEController ac = splashCircle.GetComponent <AoEController>();
             ac.scale      = splashRad;
             ac.parent     = "Trap";
             ac.aoeTrapCon = this;
             ac.ScaleProps(splash);
         }
     }
     Destroy(this.gameObject);
 }
Exemplo n.º 2
0
    //called when the bullet hits something, from the OnCollisionEnter in EnemyController
    public void Collide()
    {
        Debug.Log("collided (called method Collide())");
        if (splash != 0)
        {
            if (poison != 0)
            {
                //POISON CLOUD HERE
            }
            else
            {
                //AoE DAMAGE HERE
                if (arcDmg > 0)                 //circle splash
                {
                    //Debug.Log ("got to splash");
                    knockback   = 0f;
                    stun        = 0f;
                    penetration = 0f;
                    GameObject splashCircle = Instantiate(Resources.Load("Prefabs/SplashCircle")) as GameObject;
                    splashCircle.transform.position = this.transform.position;
                    AoEController ac = splashCircle.GetComponent <AoEController>();
                    ac.scale = splashRad;
                    //Debug.Log ("splashRad is " + splashRad);
                    ac.parent       = "Bullet";
                    dmg            += arcDmg;
                    ac.aoeBulletCon = this;
                    ac.ScaleProps(splash);
                }
                else                 //normal cone splash
                {
                    knockback   = 0f;
                    stun        = 0f;
                    penetration = 0f;
                    GameObject splashCone = Instantiate(Resources.Load("Prefabs/SplashCone")) as GameObject;
                    splashCone.transform.position = this.transform.position;
                    splashCone.transform.rotation = this.transform.rotation;

                    /*splashCone.transform.rotation = new Quaternion(gameObject.transform.rotation.x,
                     *                                             gameObject.transform.rotation.y,
                     *                                             gameObject.transform.rotation.z,
                     *                                             gameObject.transform.rotation.w);*/
                    AoEController ac = splashCone.GetComponent <AoEController>();
                    ac.scale = splashRad;

                    /*Debug.Log ("old splash damage: " + dmg);
                     * Debug.Log ("old splash lifedrain: " + lifeDrain);*/
                    //Debug.Log ("splashRad is " + splashRad);
                    ac.parent       = "Bullet";
                    ac.aoeBulletCon = this;
                    ac.ScaleProps(splash);

                    /*Debug.Log ("new splash damage: " + ac.aoeBulletCon.dmg);
                     * Debug.Log ("new splash life: " + ac.aoeBulletCon.lifeDrain);*/
                }
            }
        }
        //Debug.Log ("splitCount is " + splitCount);
        if (splitCount > 0)
        {
            if (!isSplitBullet)             //only pre-split bullets
            {
                //Debug.Log ("spawned 2 split bullets");
                ScaleProps(0.5f);

                GameObject       split1  = Instantiate(Resources.Load("Prefabs/Bullet")) as GameObject;
                BulletController splitbc = split1.GetComponent <BulletController>();
                splitbc.dirScalar   = -1;
                splitbc.splitParent = this;
                //splitbc.arcDmg = 5f;
                split1.transform.position = this.transform.position;
                splitbc.SetSplitProps(this);

                GameObject       split2   = Instantiate(Resources.Load("Prefabs/Bullet")) as GameObject;
                BulletController splitbc2 = split2.GetComponent <BulletController>();
                splitbc2.dirScalar        = 1;
                splitbc2.splitParent      = this;
                split2.transform.position = this.transform.position;
                splitbc2.SetSplitProps(this);
            }
        }

        //gameObject.SetActive (false);
        if (gameObject.transform.parent != null)
        {
            Destroy(gameObject.transform.parent.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }