Ejemplo n.º 1
0
    /// <summary>
    /// Add a MoveTo action to the queue
    /// </summary>
    /// <param name="priority">How important the action is</param>
    /// <param name="goalPoint">The point the OM is walking to</param>
    /// <param name="waitBeforeMoving">How long the OM should wait before moving to the goalPoint</param>
    /// <param name="thoughtItem">The sprite to put in the thought bubble. Can be left null for no item to be shown</param>
    /// <param name="discardTime">The amount of time this action can spend in the queue without being discarded. 0 for infinite.</param>
    public void AddMoveToAction(float priority, string name, OM_MoveData goalPoint, float waitBeforeMoving,
                                Sprite thoughtItem = null, float discardTime = 0)
    {
        OM_Action_MoveTo action = new OM_Action_MoveTo(priority, name, goalPoint, waitBeforeMoving, thoughtItem, discardTime);

        OM_ActionQueue.Enqueue(action, action.Priority);
    }
Ejemplo n.º 2
0
    void SetNextPoint(OldMan om, OM_MoveData point)
    {
        //Only slow down the Old Man if they have to wait at the point
        if (point.WaitAfterReaching > 0)
        {
            om.Agent.autoBraking = true;
        }
        else
        {
            om.Agent.autoBraking = false;
        }

        // Send the NavMesh agent to that point
        om.Agent.destination = point.Point;
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Create an action where the Old Man walks to a set point
    /// </summary>
    /// <param name="priority">How important the action is</param>
    /// <param name="name">The name of this action</param>
    /// <param name="goalPoint">The point the OM is walking to</param>
    /// <param name="waitBeforeMoving">How long the OM should wait before moving to the goalPoint</param>
    /// <param name="thoughtItem">The sprite to put in the thought bubble. Can be left null for no item to be shown</param>
    /// <param name="discardTime">The amount of time this action can spend in the queue without being discarded. 0 for infinite.</param>
    public OM_Action_MoveTo(float priority, string name, OM_MoveData goalPoint, float waitBeforeMoving,
                            Sprite thoughtItem = null, float discardTime = 0)
        : base(priority, name, OM_ActionType.MoveTo, thoughtItem, discardTime)
    {
        this.goalPoint        = goalPoint;
        this.waitBeforeMoving = waitBeforeMoving;

        if (waitBeforeMoving > 0)
        {
            state = MoveToState.WaitingBefore;
        }
        else
        {
            state = MoveToState.WalkingTo;
        }
        waitTimer = 0;
    }