Example #1
0
    void takeMeleeDamage(PrimWepAttack primWepAttack)
    {
        health -= primWepAttack.damage;


        Vector2 moveDirection = demonBody.transform.position - primWepAttack.player.transform.position;

        demonBody.AddForce(moveDirection.normalized * -500f);

        Debug.Log("You did: " + primWepAttack.damage + " damage to: " + this.gameObject.name);

        if (health <= 0)
        {
            this.gameObject.transform.rotation = Quaternion.Euler(0, 0, 90f);
            this.SendMessage("death", health, SendMessageOptions.DontRequireReceiver);
            this.enabled = false;
        }
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     weapon = new PrimWepAttack(Iron.damage, Iron.knockback, GameObject.FindGameObjectWithTag("Player"));
     canHit = false;
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     weapon         = new PrimWepAttack(Iron.damage, Iron.knockback, GameObject.FindGameObjectWithTag("Player"));
     projectileAnim = GetComponent <Animator>();
 }