Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (canDamage)
     {
         collision.BroadcastMessage("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);
     }
 }
    void onTriggerEnterEvent(Collider2D col)
    {
        if (col.tag == "WolfPickup")
        {
            hasWolfForm = true;
            audio.PlayOneShot(pickupSound);
            Destroy(col.gameObject);
        }
        else if (col.tag == "HammerPickup")
        {
            hasHammer = true;
            SceneManager.LoadScene(2);
            audio.PlayOneShot(pickupSound);
            Destroy(col.gameObject);
        }
        else if (col.tag == "KeyPickup")
        {
            hasKey = true;
            audio.PlayOneShot(pickupSound);
            Destroy(col.gameObject);
        }
        else if (col.tag == "HealthPickup")
        {
            health += 25;
            audio.PlayOneShot(pickupSound);
            Destroy(col.gameObject);
        }


        if (col.tag == "Door" && hasKey)
        {
            col.BroadcastMessage("OpenDoor", SendMessageOptions.DontRequireReceiver);
            hasKey = false;
        }
    }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Enemy")
     {
         float baseDamage = heavyMeleeAbilityStats.GetDamage();
         collision.BroadcastMessage("TakeDamage", baseDamage * currentDamageScale);
     }
 }
 void OnTriggerEnter2D(Collider2D ent)
 {
     if (ent.tag == "Player")
     {
         print("broadcasting to player");
         ent.BroadcastMessage("Die", "Crushed");
     }
 }
Exemplo n.º 5
0
 private void OnTriggerEnter2D(Collider2D _Collision)
 {
     if (_Collision.CompareTag("Player") && _HealingAmmount > 0)
     {
         _Collision.BroadcastMessage("Heal", _HealingAmmount);
         Die();
     }
 }
Exemplo n.º 6
0
 private void OnTriggerEnter2D(Collider2D _Collision)
 {
     if (_Collision.CompareTag("Player") && _ImmuneDuration > 0)
     {
         _Collision.BroadcastMessage("StartInvincibility", _ImmuneDuration);
         Die();
     }
 }
    //private void OnTriggerStay2D(Collider2D collision)
    //{
    //	if (enableHeal){
    //		if (collision.tag == "Player"){
    //			collision.BroadcastMessage("RestoreHealthBy", amountPerHeal);
    //		}
    //	}
    //	enableHeal = false;
    //}

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            collision.BroadcastMessage("RestoreHealthBy", amountPerHeal);
        }
        collider2D.enabled = false;
    }
Exemplo n.º 8
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Bit Receptor")
     {
         other.BroadcastMessage("beginPulse");
         End_Journey();
     }
 }
Exemplo n.º 9
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject != emmitedFrom)
     {
         Debug.Log("Hit Target - Damage");
         collision.BroadcastMessage("OnProjectileDamage", this, SendMessageOptions.DontRequireReceiver);
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 10
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!collision.CompareTag(tagToDamage))
     {
         return;
     }
     //Debug.Log(name + " damaged " + collision, collision);
     collision.BroadcastMessage("TakeDamage", attackDamage);
 }
Exemplo n.º 11
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Coin")
     {
         col.BroadcastMessage("Kill");
     }
     else if (lives > 0 && col.tag != "Wolf")
     {
         if (extraLives[lives - 1] != null)
         {
             extraLives[lives - 1].killed = true;
         }
         else if (extraLives[lives - 2] != null)
         {
             extraLives[lives - 2].killed = true;
         }
         else if (extraLives[lives - 3] != null)
         {
             extraLives[lives - 3].killed = true;
         }
         lives -= 1;
         col.BroadcastMessage("Kill");
     }
     else
     {
         GameObject d = Instantiate(deadObject);
         d.transform.position = transform.position;
         if (isMainPlayer)
         {
             GameController.lose = true;
         }
         else
         {
             StaticContainer.ducklingsSurvived -= 1;
         }
         if (_parent != null)
         {
             _parent.lives -= 1;
         }
         Destroy(gameObject);
     }
 }
Exemplo n.º 12
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.transform.CompareTag("Player") || collision.transform.CompareTag("Ghost"))
     {
         if (!audioSource.isPlaying)
         {
             audioSource.Play();
         }
         collision.BroadcastMessage("Freeze");
         FindObjectOfType <LevelLoader>().LoadLevel(SceneManager.GetActiveScene().buildIndex + 1);
     }
 }
Exemplo n.º 13
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (tag != "Whiff")
     {
         if (other.tag == "Whiff")
         {
             other.GetComponentInParent <PlayerStateMachine>().BroadcastMessage("GetHit", punch);
         }
         else if (other.CompareTag(GetComponentInParent <PlayerStateMachine>().tag) == false && other.tag != tag)
         {
             other.BroadcastMessage("GetHit", punch);                 // send data about what attack just hit the player.
             transform.parent.GetComponentInChildren <SpriteRenderer>().sortingOrder = 1;
         }
     }
 }
Exemplo n.º 14
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        // If this is an EnemyLaser, ignore it
        if (other.CompareTag("EnemyLaser"))
        {
            return;
        }

        // If the other item is a player
        if (other.CompareTag("Player"))
        {
            // Damage player
            Player player = other.transform.GetComponent <Player>();
            if (player != null)
            {
                player.Damage();
            }

            //// Start our dying process
            StartDying();
        }

        // If the other item is a laser, start dying and tell the
        // laser to start dying as well.
        if (other.CompareTag("Laser"))
        {
            StartDying();
            // Get reference to player and invoke AddToScore(score)
            Player p = GameObject.Find("Player").GetComponent <Player>();
            if (p != null)
            {
                p.AddToScore(_myScore);
            }

            // Tell the laser to start dying
            other.BroadcastMessage("StartDying");
        }
    }
Exemplo n.º 15
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     collision.BroadcastMessage("ReachedMiddlePoint", SendMessageOptions.DontRequireReceiver);
 }
Exemplo n.º 16
0
 void OnTriggerEnter2D(Collider2D other)
 {
     other.BroadcastMessage("targetReached");
 }
Exemplo n.º 17
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     collision.BroadcastMessage(message, SendMessageOptions.DontRequireReceiver);
 }