public void OnObjectSpawned(GameObject obj) { MoveToGridObject move = obj.GetComponent <MoveToGridObject>(); if (move == null) { return; } move.Target = Target; }
public bool IsValidTarget(HealthComponent other) { if (other == null || other.Side == this.Side) { return(false); } bool bAttack = true; MoveToGridObject move = GetComponent <MoveToGridObject>(); if (move != null && move.Target != null) { // check if we have reached the thing we are attacking //bAttack = move.Target.gameObject == other.gameObject; } return(bAttack); }