public void Calculate()
    {
        float vel1 = float.Parse(v1.text);
        float vel2 = float.Parse(v2.text);
        float t    = 500 / (vel1 + vel2);
        float x1   = -250 + (vel1 * t);
        float x2   = -250 + (vel2 * t);

        p.text = x1.ToString();

        p1.Move(t, x1, vel1, true);
        p2.Move(t, x2, vel2, false);

        Debug.Log("x1f: " + x1 + "  " + "x2f: " + x2 + "  t: " + t);
    }
    void Update()
    {
        float xMove = Input.GetAxisRaw("Horizontal");
        float zMove = Input.GetAxisRaw("Vertical");

        Vector3 moveHorizontal = transform.right * xMove;
        Vector3 moveVertical   = transform.forward * zMove;

        Vector3 velocity = (moveHorizontal + moveVertical).normalized * speed;

        move.Move(velocity);

        float yRot = Input.GetAxisRaw("Mouse X");

        Vector3 rotation = new Vector3(0f, yRot, 0f) * lookSensitivity;

        move.Rotation(rotation);

        float xRot = Input.GetAxisRaw("Mouse Y");

        Vector3 cameraRotation = new Vector3(-xRot, 0f, 0f) * lookSensitivity;

        move.RotateCamera(cameraRotation);
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        if (canMove)
        {
            actions act = atb.GetActions();

            //Movimentação
            Vector2 dire = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
            movementPlayer.Move(dire);

            //Pegando posição do mouse no mundo

            /*Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
             * Vector2 delta = mousePos;
             * delta.x -= transform.position.x;
             * delta.y -= transform.position.y;
             * //Rotacionar
             * float angZ = Vector2.SignedAngle(Vector2.up, delta);
             * movementPlayer.TurnTo(angZ);*/

            weaponInfs wp = act.GetWeaponInfs();
            //Comando de atirar

            /*if (Input.GetButton("Fire1"))
             * {
             *  if (Input.GetButtonDown("Fire1"))
             *  {
             *      act.Fire();
             *  }
             * }
             * else if (wp && wp.IsContinuous())
             * {
             *  act.StopFire();
             * }*/
        }
    }
示例#4
0
 private void FixedUpdate()
 {
     controller.Move(false, jumpInput, horizontalInput);
 }