示例#1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     //DestroyObject (this);
     //Debug.Log ("boob bay");
     if (other.gameObject.tag == "EnemyMelle")
     {
         hit   = true;
         melle = other.GetComponent <EnemyScriptMelle>();
         if (!spell4)
         {
             melle.TakeDmg(player.Damage);
         }
         if (spell4)
         {
             melle.TakeDmg(player.Damage * 2);
         }
         melle.StunD(0.5f);
         //var shotTransform = Instantiate(boooom) as Transform;
         //shotTransform.position = transform.position;
         if (!massdmg)
         {
             this.renderer.enabled = true;
             DestroyObject(gameObject, 0.2f);
             speed = new Vector2(0, 0);
         }
     }
     if (other.gameObject.tag == "EnemyArcher")
     {
         hit    = true;
         archer = other.GetComponent <ArcherWar>();
         if (!spell4)
         {
             archer.TakeDmg(player.Damage);
         }
         if (spell4)
         {
             archer.TakeDmg(player.Damage * 2);
         }
         archer.StunD(0.5f);
         //var shotTransform = Instantiate(boooom) as Transform;
         //shotTransform.position = transform.position;
         if (!massdmg)
         {
             this.renderer.enabled = true;
             DestroyObject(gameObject, 0.2f);
             speed = new Vector2(0, 0);
         }
     }
     if (other.gameObject.tag == "ground")
     {
         this.renderer.enabled = true;
         hit = true;
         DestroyObject(gameObject, 0.2f);
         speed = new Vector2(0, 0);
         //Destroy(this);
     }
 }
示例#2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log("Trigger: Player Entered");

        if (other.gameObject.tag == "EnemyMelle")
        {
            EnSCR = other.GetComponent<EnemyScriptMelle> ();
            if(attacked2 || attacked3 || attacked4)
                attacked = false;
            if(attacked)
            {
                if (!critical)
                    EnSCR.TakeDmg(dmg);
                if (critical)
                {
                    EnSCR.critical = true;
                    EnSCR.TakeDmg(dmg*2);
                    critical = false;
                }
                attacked = false;
            }
            if(attacked || attacked3 || attacked4)
                attacked2 = false;
            if(attacked2)
            {
                EnSCR.StunD(0.5f);
                if(EnSCR.turn == 1 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(3000f,400f));
                if(EnSCR.turn == 2 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-400f,3000f));
                if(EnSCR.turn == 3 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-3000f,-400f));
                if(EnSCR.turn == 4 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(400f,-3000f));

                if(EnSCR.turn == 1 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-3000f,400f));
                if(EnSCR.turn == 2 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-400f,-3000f));
                if(EnSCR.turn == 3 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(3000f,-400f));
                if(EnSCR.turn == 4 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(400f,3000f));
                attacked2 = false;
            }
            if(attacked2 || attacked3 || attacked)
                attacked4 = false;
            if(attacked4)
            {
                if (!critical)
                    EnSCR.TakeDmg(dmg*1.7);
                if (critical)
                {
                    EnSCR.critical = true;
                    EnSCR.TakeDmg(dmg*2*1.7);
                    critical = false;
                }
                attacked = false;
            }
            //Debug.Log("WOW!");
        }
        if (other.gameObject.tag == "EnemyArcher")
        {
            ArcherScript = other.GetComponent<ArcherWar> ();
            if(attacked2 || attacked3 || attacked4)
                attacked = false;
            if(attacked)
            {
                if (!critical)
                    ArcherScript.TakeDmg(dmg);
                if (critical)
                {
                    ArcherScript.critical = true;
                    ArcherScript.TakeDmg(dmg*2);
                    critical=false;
                }
                attacked = false;
            }
            if(attacked || attacked3 || attacked4)
                attacked2 = false;
            if(attacked2)
            {
                ArcherScript.StunD(0.5f);
                if(ArcherScript.turnArcher == 1 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(3000f,400f));
                if(ArcherScript.turnArcher == 2 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-400f,3000f));
                if(ArcherScript.turnArcher == 3 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-3000f,-400f));
                if(ArcherScript.turnArcher == 4 && playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(400f,-3000f));

                if(ArcherScript.turnArcher == 1 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-3000f,400f));
                if(ArcherScript.turnArcher == 2 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(-400f,-3000f));
                if(ArcherScript.turnArcher == 3 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(3000f,-400f));
                if(ArcherScript.turnArcher == 4 && !playerSCR.isFacingRight)
                    other.rigidbody2D.AddForce(new Vector2(400f,3000f));
                attacked2 = false;
            }

            if(attacked2 || attacked3 || attacked)
                attacked4 = false;
            if(attacked4)
            {
                if (!critical)
                    ArcherScript.TakeDmg(dmg*2*1.7);
                if (critical)
                {
                    ArcherScript.critical = true;
                    ArcherScript.TakeDmg(dmg*1.7);
                    critical=false;
                }
                attacked4= false;
            }
            //Debug.Log("WOW!");
        }
    }
示例#3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log("Trigger: Player Entered");

        if (other.gameObject.tag == "EnemyMelle")
        {
            EnSCR = other.GetComponent <EnemyScriptMelle> ();
            if (attacked2 || attacked3 || attacked4)
            {
                attacked = false;
            }
            if (attacked)
            {
                if (!critical)
                {
                    EnSCR.TakeDmg(dmg);
                }
                if (critical)
                {
                    EnSCR.critical = true;
                    EnSCR.TakeDmg(dmg * 2);
                    critical = false;
                }
                attacked = false;
            }
            if (attacked || attacked3 || attacked4)
            {
                attacked2 = false;
            }
            if (attacked2)
            {
                EnSCR.StunD(0.5f);
                if (EnSCR.turn == 1 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(3000f, 400f));
                }
                if (EnSCR.turn == 2 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-400f, 3000f));
                }
                if (EnSCR.turn == 3 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-3000f, -400f));
                }
                if (EnSCR.turn == 4 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(400f, -3000f));
                }

                if (EnSCR.turn == 1 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-3000f, 400f));
                }
                if (EnSCR.turn == 2 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-400f, -3000f));
                }
                if (EnSCR.turn == 3 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(3000f, -400f));
                }
                if (EnSCR.turn == 4 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(400f, 3000f));
                }
                attacked2 = false;
            }
            if (attacked2 || attacked3 || attacked)
            {
                attacked4 = false;
            }
            if (attacked4)
            {
                if (!critical)
                {
                    EnSCR.TakeDmg(dmg * 1.7);
                }
                if (critical)
                {
                    EnSCR.critical = true;
                    EnSCR.TakeDmg(dmg * 2 * 1.7);
                    critical = false;
                }
                attacked = false;
            }
            //Debug.Log("WOW!");
        }
        if (other.gameObject.tag == "EnemyArcher")
        {
            ArcherScript = other.GetComponent <ArcherWar> ();
            if (attacked2 || attacked3 || attacked4)
            {
                attacked = false;
            }
            if (attacked)
            {
                if (!critical)
                {
                    ArcherScript.TakeDmg(dmg);
                }
                if (critical)
                {
                    ArcherScript.critical = true;
                    ArcherScript.TakeDmg(dmg * 2);
                    critical = false;
                }
                attacked = false;
            }
            if (attacked || attacked3 || attacked4)
            {
                attacked2 = false;
            }
            if (attacked2)
            {
                ArcherScript.StunD(0.5f);
                if (ArcherScript.turnArcher == 1 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(3000f, 400f));
                }
                if (ArcherScript.turnArcher == 2 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-400f, 3000f));
                }
                if (ArcherScript.turnArcher == 3 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-3000f, -400f));
                }
                if (ArcherScript.turnArcher == 4 && playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(400f, -3000f));
                }

                if (ArcherScript.turnArcher == 1 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-3000f, 400f));
                }
                if (ArcherScript.turnArcher == 2 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(-400f, -3000f));
                }
                if (ArcherScript.turnArcher == 3 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(3000f, -400f));
                }
                if (ArcherScript.turnArcher == 4 && !playerSCR.isFacingRight)
                {
                    other.rigidbody2D.AddForce(new Vector2(400f, 3000f));
                }
                attacked2 = false;
            }

            if (attacked2 || attacked3 || attacked)
            {
                attacked4 = false;
            }
            if (attacked4)
            {
                if (!critical)
                {
                    ArcherScript.TakeDmg(dmg * 2 * 1.7);
                }
                if (critical)
                {
                    ArcherScript.critical = true;
                    ArcherScript.TakeDmg(dmg * 1.7);
                    critical = false;
                }
                attacked4 = false;
            }
            //Debug.Log("WOW!");
        }
    }