private void Transition()
    {
        //if (Input.GetKeyDown(KeyCode.B))
        //    ToPlayerBounceState();
        //if (Input.GetKeyDown(KeyCode.C))
        //    ToPlayerSneakState();
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray ray = player.mainCamera.GetComponent <Camera>().ScreenPointToRay(new Vector3(x, y));

            var newTarget = player.GetTarget(ray);

            if (newTarget == null || newTarget == player.targetObject)
            {
                player.skipFrame     = true;
                player.settingTarget = false;
                player.targeting     = false;
                ToPlayerWalkState();
            }
            else
            {
                player.targetObject  = newTarget;
                player.settingTarget = true;
            }
        }
        //if (player.rigidbody.velocity == Vector3.zero)
        //    ToPlayerIdleState();
    }
Example #2
0
    private void Transition()
    {
        //if (Input.GetKeyDown (KeyCode.B))
        //	ToPlayerBounceState ();
        //if (Input.GetKeyDown (KeyCode.C))
        //	ToPlayerSneakState ();
        if (Input.GetAxis("Vertical") != 0 || Input.GetAxis("Horizontal") != 0 || player.rigidbody.velocity != Vector3.zero)
        {
            ToPlayerWalkState();
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray ray = player.mainCamera.GetComponent <Camera>().ScreenPointToRay(new Vector3(x, y));

            player.targetObject = player.GetTarget(ray);

            if (player.targetObject != null)
            {
                player.settingTarget = true;
                player.targeting     = true;
                ToPlayerTargetState();
            }
        }
    }
    private void Transition()
    {
        //		if (Input.GetKeyDown (KeyCode.LeftCommand) || Input.GetKeyDown (KeyCode.RightCommand))
        //			ToPlayerBounceState ();
        if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift) || Input.GetKeyDown(KeyCode.C))
        {
            ToPlayerWalkState();
        }
        //		if (player.rigidbody.velocity == Vector3.zero)
        //			ToPlayerIdleState ();

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray ray = player.mainCamera.GetComponent <Camera>().ScreenPointToRay(new Vector3(x, y));

            player.targetObject = player.GetTarget(ray);

            if (player.targetObject != null)
            {
                player.targeting = true;
                ToPlayerTargetState();
            }
        }
    }
    private void Transition()
    {
        //if (Input.GetKeyDown (KeyCode.C))
        //	ToPlayerSneakState ();
        //if (Input.GetKeyDown (KeyCode.B) || player.collided)
        //	ToPlayerWalkState ();

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray ray = player.mainCamera.GetComponent <Camera>().ScreenPointToRay(new Vector3(x, y));

            player.targetObject = player.GetTarget(ray);

            if (player.targetObject != null)
            {
                player.targeting = true;
                ToPlayerTargetState();
            }
        }
    }