示例#1
0
    public void Spawn(int quantity)
    {
        Vector3    position = path?.GetWaypointByIndexClamped(0) ?? transform.position;
        Quaternion rotation = this.transform.rotation;

        for (int i = 0; i < quantity; i++)
        {
            GameObject unitObject = Instantiate(unitPrefab, position, rotation);
            AI.UnitAI  ai         = unitObject.GetComponent <Unit>()?.ai;
            if (ai != null)
            {
                ai.followPath = path;
            }
        }
    }
示例#2
0
 public UnitPathFollowing(UnitAI ai)
 {
     this.ai     = ai;
     updateTimer = new Timer(updateInterval);
     updateTimer.SetOnEdge();
 }
 public FollowObjectState(UnitAI ai, Transform target, float keepDistance = 1f)
 {
     this.ai           = ai;
     this.target       = target;
     this.keepDistance = keepDistance;
 }
 public MoveToPositionState(UnitAI ai, Vector2 destination, AIState nextState)
     : this(ai, destination)
 {
     this.nextState = nextState;
 }
 public MoveToPositionState(UnitAI ai, Vector2 destination) : base(0.26f)
 {
     this.ai          = ai;
     this.destination = destination;
 }