public void Attack(ReactiveEntity actor) { //Debug.Log("trying to attack player"); //set up to where they can also attack npc's SetState(ActionState.Attacking); if (actor.GetComponent<Player>()) { Player.Instance.Defense(this.enemyStats.damage, gameObject.name); } else { NPC enemy = actor.GetComponent<NPC>(); if (enemy != null) { enemy.Defense(this.enemyStats.damage, gameObject.name); } } }
public override void Interact<T>(T component) { ReactiveEntity interactable = component.GetComponent<ReactiveEntity>(); if (interactable != null) { Player pl = interactable.GetComponent<Player>(); if (pl != null) { //Debug.Log(pl.gameObject.name + " attacking " + gameObject.name); pl.Attack(this); } } }