Example #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (Utils.DetermineObjectType(other) != Utils.ObjectType.Player)
        {
            if (Utils.DetermineObjectType(other) == Utils.ObjectType.Wall)
            {
                Destroy(gameObject);
            }
            return;
        }
        if (!other.CompareTag(currP))
        {
            //other.SendMessage("TakeDamage", damage, SendMessageOptions.DontRequireReceiver);
            //other.GetComponent<PlayerTime>().timeRemaining -= damage;
            PlayerTime.TransferTime(damage, other.gameObject, GameObject.FindGameObjectWithTag(currP));
            Destroy(gameObject);
        }

        /*if (other.gameObject != gameObject)
         * {
         *  other.SendMessage("TakeDamage", damage, SendMessageOptions.DontRequireReceiver);
         *  other.GetComponent<PlayerTime>().timeRemaining -= damage;
         *  Destroy(gameObject);
         * }*/
    }
Example #2
0
 void Attack()
 {
     delay = 0.0f;
     if (Utils.DetermineObjectType(playerAttacked) == Utils.ObjectType.Player)
     {
         PlayerTime.TransferTime(damage, playerAttacked.gameObject, gameObject);
     }
 }