Esempio n. 1
0
 public AttackState(Unit unit, HitPoints target)
 {
     this.unit = unit;
     Debug.Log($"{unit.name} started attacking {target.name}.");
     this.target  = target;
     targetRadius = target.GetComponent <ObjectRadius>();
 }
Esempio n. 2
0
 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>();
 }
Esempio n. 3
0
        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);
        }