Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        Vector2 cStateMove = moveController.GetDirection();

        rb.AddForce(new Vector3(cStateMove.x, 0, cStateMove.y) * runSpeed - rb.velocity, ForceMode.VelocityChange);
        if (cStateMovePrev == Vector2.zero && cStateMove != Vector2.zero)
        {
            runSound.Play();
        }
        else if (cStateMovePrev != Vector2.zero && cStateMove == Vector2.zero)
        {
            runSound.Stop();
        }
        cStateMovePrev = cStateMove;

        AimControllerState cStateAim = aimController.GetAim();

        aimMark.transform.position = cStateAim.aim;

        ShotControllerState cStateShot = shotController.GetControllerState();

        aimVia = cStateAim.aimVia;
        if (shottable)
        {
            if (cStateShot.shotA)
            {
                ballController.projectile(cStateAim.aim, cStateAim.aimVia, spinA);
                shotSound.Play();
            }
            else if (cStateShot.shotB)
            {
                ballController.projectile(cStateAim.aim, cStateAim.aimVia, spinB);
                shotSound.Play();
            }
        }
        else if (cStateShot.toss)
        {
            if (ballController.bounds >= 2)
            {
                toss(3);
            }
        }
    }