Beispiel #1
0
 // Start is called before the first frame update
 void Awake()
 {
     fey = GameObject.FindWithTag("Fey").GetComponent <Fey>();
     PlayerPrefs.SetInt("wasDead", true?1:0);
     PlayerPrefs.SetInt("hasBuddy", false?1:0);
     PlayerPrefs.SetInt("Health", fey.Health);
 }
Beispiel #2
0
 private void Start()
 {
     parent = gameObject.GetComponentInParent <Fey>();
 }
Beispiel #3
0
    //cooldown before object can take damage again

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (!(other.CompareTag("Player") &&
              this.CompareTag("Player")) &&
            !(other.CompareTag("Player") && this.CompareTag("Fey")) &&
            !(other.CompareTag("Fey") &&
              this.CompareTag("Player")) &&
            !(other.CompareTag("Fey") &&
              this.CompareTag("Fey")) &&
            !(other.CompareTag("Buddy Bullet") &&
              this.CompareTag("Buddy Bullet")) &&
            !(other.CompareTag("Buddy Bullet") &&
              this.CompareTag("Fey")) &&
            !(other.CompareTag("Fey") &&
              this.CompareTag("Buddy Bullet")) &&
            !(other.CompareTag("Enemy") && this.CompareTag("Enemy")) &&
            !(other.CompareTag("EnemyBullet") && this.CompareTag("EnemyBullet")) &&
            !(other.CompareTag("EnemyBullet") && this.CompareTag("Enemy")) &&
            !(other.CompareTag("Enemy") && this.CompareTag("EnemyBullet"))

            )
        {
            IDamage hit = other.GetComponent <IDamage>();
            if (hit != null)
            {
                if (this.CompareTag("Button"))
                {
                    Debug.Log(this);
                    hit.Damage(1);
                }
                else if (other.CompareTag("Fey") && other.gameObject.layer != 10)
                {
                    Debug.Log("fey hurted");
                    Fey fey = other.GetComponent <Fey>();
                    if (!fey._immunity)
                    {
                        hit.Damage(damageDealt);
                        fey.tookDamage();
                    }
                }
                else if (other.CompareTag("Enemy") && gameObject.layer != 16)
                {
                    Enemy enemy = other.GetComponent <Enemy>();
                    if (enemy != null)
                    {
                        if (!enemy._immunity)
                        {
                            hit.Damage(damageDealt);
                            enemy.tookDamage();
                        }
                    }
                }
                else if (other.CompareTag("EnemyBullet"))
                {
                    hit.Damage(damageDealt);
                }
                else
                {
                    hit.Damage(damageDealt);
                }
            }

            /*if (hit != null){
             *  if (this.CompareTag("Button"))
             *  {
             *      Debug.Log(this);
             *      hit.Damage(1);
             *  }
             *  else
             *      {
             *          if (damageDealt > 0)
             *          {
             *              //Debug.Log("hit: " + other.name);
             *              //call our interface in order to access its methods related to the object this is attached to
             *              //should be attached to the fight hitbox.
             *              if (_immunity == false)
             *              {
             *                  hit.Damage(damageDealt);
             *
             *                  _immunity = true;
             *                  StartCoroutine(EnemyImmunityCoolDown());
             *              }
             *          }
             *      }
             *  }*/
        }
    }
Beispiel #4
0
 // Start is called before the first frame update
 private void Awake()
 {
     parent = gameObject.GetComponentInParent <Fey>();
 }