示例#1
0
    protected override IEnumerator movementPattern()
    {
        while (true)
        {
            Vector3 forward = transform.up;
            transform.position += (forward * Speed * Time.deltaTime);
            Vector3 pos = transform.position;

            if (CameraUtility.ClampPositionToCamera(ref pos))
            {
                Vector3 LookDir = Vector3.Reflect(transform.up, Vector3.right);

                transform.up = LookDir;
            }

            yield return(null);
        }
    }
示例#2
0
    private void Update()
    {
        if (InputManager.JoystickIsActive == false)
        {
            Time.timeScale = .1f;
        }
        else
        {
            Time.timeScale = 1f;
        }

        Vector3 newPos = Vector3.zero;

        newPos.x = (InputManager.GetAxis(Joystick.Keys.xAxis) * moveSpeed);
        newPos.y = (InputManager.GetAxis(Joystick.Keys.yAxis) * moveSpeed);
        newPos  += transform.position;
        CameraUtility.ClampPositionToCamera(ref newPos);
        transform.position = newPos;
    }