Esempio n. 1
0
 public void DamagePlayer(int damage)
 {
     playerStats.Health -= damage;
     if (playerStats.Health <= 0)
     {
         WrathMaster.KillPlayer(this);
     }
 }
Esempio n. 2
0
 public void DamageEnemy(int damage)
 {
     stats.Health -= damage;
     if (stats.Health <= 0)
     {
         WrathMaster.KillEnemy(this);
     }
 }
Esempio n. 3
0
 void Start()
 {
     if (WM == null)
     {
         WM = GameObject.FindGameObjectWithTag("GameController").GetComponent <WrathMaster> ();
     }
     spawnPlayer();
     StartCoroutine(Waves());
     StartCoroutine(shooterWaves());
 }
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.gameObject.tag == "Enemy")
     {
         WrathEnemy enemy      = coll.gameObject.GetComponent <WrathEnemy> ();
         GameObject body       = GetComponent <Collider2D> ().gameObject;
         GameObject bodyParent = body.transform.parent.gameObject;
         bodyParent.GetComponent <WrathCharacter> ().DamagePlayer(Damage);
         Debug.Log("Player took" + "34" + "damage.");
         WrathMaster.KillEnemy(enemy);
     }
 }
Esempio n. 5
0
    void Update()
    {
        if (player == null)
        {
            WrathMaster.KillEnemy(this);
        }

        Vector2 difference = player.position - transform.position;                      //subtracting the position of the player from the mouse position
        float   rotZ       = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;   // find the angle in degrees

        transform.rotation  = Quaternion.Euler(0f, 0f, rotZ + rotationOffset);
        transform.position += transform.up * stats.moveSpeed * Time.deltaTime;

        if (isShooter)
        {
            if (Time.time > timeToFire)
            {
                timeToFire = Time.time + 1 / stats.fireRate;
                Shoot();
            }
        }
    }