示例#1
0
    void Update()
    {
        float dt = Time.deltaTime;

        //Process state
        switch (this.folkState)
        {
        default:
        case FolkState.Idle:
            idleState(dt);
            break;

        case FolkState.Wandering:
            wanderingState(dt);
            break;

        case FolkState.Travelling:
            travellingState(dt);
            break;
        }

        //Process actions

        Vector3 vect = new Vector3();

        float d = dt;

        while (actionQueue.Count > 0 && d > 0f)
        {
            ActionNode an = actionQueue[0];

            d = an.getVector(d, ref vect);

            transform.position += transform.TransformVector(vect);

            if (d > 0f)
            {
                actionQueue.Remove(an);
            }
        }
    }