Exemplo n.º 1
0
    // Waypoint-aware path setting. TODO there are like 5 methods for this,
    // perhaps some can be cut?
    public void SetUnitDestination(MoveWaypoint waypoint)
    {
        MoveCommandType moveType;

        // TODO we have two enums for the same thing, remove one:
        switch (waypoint.moveMode)
        {
        case MoveWaypoint.MoveMode.fastMove:
            moveType = MoveCommandType.Fast;
            break;

        case MoveWaypoint.MoveMode.normalMove:
            moveType = MoveCommandType.Slow;
            break;

        case MoveWaypoint.MoveMode.reverseMove:
            moveType = MoveCommandType.Reverse;
            break;

        default:
            throw new System.Exception("Impossible state");
        }

        float a = Pathfinder.SetPath(waypoint.Destination, moveType);

        if (a < Pathfinder.Forever)
        {
            SetUnitFinalHeading(waypoint.Heading);
        }
    }
Exemplo n.º 2
0
 private void OnEnable()
 {
     _waypoints = (MoveWaypoint)target;
 }