Пример #1
0
    void Update()
    {
        // Get player input
        Vector3 input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

        MoveComponent moveComponent = GetComponent <MoveComponent>();

        // Check for attached MoveComponent
        if (moveComponent != null)
        {
            // Move/animate player
            moveComponent.ManageMovement(input);
        }
        else
        {
            GameController.LogWarning("Unable to execute MoveCommand on " + name + " - no MoveComponent found");
        }
    }
    public override void execute(Actor actor)
    {
        // Get player input
        Vector2 input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

        MoveComponent moveComponent = actor.GetComponent <MoveComponent>();

        // Check for attached MoveComponent
        if (moveComponent != null)
        {
            // Move/animate player
            moveComponent.ManageMovement(input);
        }
        else
        {
            GameController.LogWarning("Unable to execute MoveCommand on actor " + actor.name + " - no MoveComponent found", GameController.LogCommands);
        }
    }
Пример #3
0
    public override void execute(Actor actor)
    {
        // Get player input
        // TODO: design this command to handle enemy AI movement as well
        //float vertical = Input.GetAxis("Vertical");
        //float horizontal = Input.GetAxis("Horizontal");

        Vector2 input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

        MoveComponent moveComponent = actor.GetComponent <MoveComponent>();

        // Check for attached MoveComponent
        if (moveComponent != null)
        {
            // Move/animate player
            moveComponent.ManageMovement(input);
        }
        else
        {
            GameController.LogCommands.LogWarning("Unable to execute MoveCommand on actor " + actor.name + " - no MoveComponent found");
        }
    }