public AttackState(Unit unit, HitPoints target) { this.unit = unit; Debug.Log($"{unit.name} started attacking {target.name}."); this.target = target; targetRadius = target.GetComponent <ObjectRadius>(); }
public ChaseState(Unit unit, HitPoints target, float stopDistance) { this.target = target; this.stopDistance = stopDistance; agent = unit.Agent; agent.speed = unit.CurrentJob.movementSpeed; path = new NavMeshPath(); targetRadius = target.GetComponent <ObjectRadius>(); }
protected MoveState PushMoveState(Unit unit, Vector3 moveDestination, float stopDistance, ObjectRadius objectRadius = null) { if (objectRadius != null) { moveDestination = objectRadius.GetClosestPoint(moveDestination); } var moveState = new MoveState(unit, moveDestination, stopDistance); PushState(moveState); return(moveState); }