Example #1
0
    // depending on the current command being processed, the Actor may need to update its position to move
    // towards one of the waypoints; otherwise, return the current position to show that no movement is necessary
    private Vector3 FindTargetWaypoint()
    {
        if (current.Instruction == OpCode.INPUT)
        {
            return(InputWaypoint.transform.position);
        }
        else if (current.Instruction == OpCode.OUTPUT)
        {
            return(OutputWaypoint.transform.position);
        }
        else if (current.Instruction == OpCode.MOVE_TO || current.Instruction == OpCode.MOVE_FROM ||
                 current.Instruction == OpCode.COPY_TO || current.Instruction == OpCode.COPY_FROM ||
                 current.Instruction == OpCode.ADD || current.Instruction == OpCode.SUBTRACT ||
                 current.Instruction == OpCode.JUMP_IF_EQUAL || current.Instruction == OpCode.JUMP_IF_GREATER ||
                 current.Instruction == OpCode.JUMP_IF_LESS)
        {
            // retrieve the waypoint of the current card
            CurrentArg = current.Arg;
            CardLogic card     = cardContainer.GetCard((int)CurrentArg);
            var       waypoint = card.GetWaypoint();
            waypoint.z = transform.position.z;
            return(waypoint);
        }

        return(transform.position);
    }