// Update is called once per frame
    void Update()
    {
        movement.x = 0; movement.y = 0;

        if (_canmove || _canserve)
        {
            if (CrossPlatformInputManager.GetButtonDown("Jump"))
            {
                if (_canserve)
                {
                    _canserve = false;
                    animator.SetTrigger("ServeKick");
                    server.Send("ANIMATIONTRIGGER|" + name + "%ServeKick", true);
                    kickController.ServeKick(_power, _int);
                }
                else
                {
                    animator.SetTrigger("NormalKick");
                    server.Send("ANIMATIONTRIGGER|" + name + "%NormalKick", true);
                    _canmove = false;
                    Invoke("EnableMove", 0.471f);
                    kickController.NormalKick(_power, _int);
                }
            }
            else if (CrossPlatformInputManager.GetButtonDown("Fire2"))
            {
                if (!_canserve)
                {
                    animator.SetTrigger("NormalKick");
                    server.Send("ANIMATIONTRIGGER|" + name + "%NormalKick", true);
                    _canmove = false;
                    Invoke("EnableMove", 0.471f);
                    kickController.PassBall();
                }
            }
            else if (CrossPlatformInputManager.GetButtonDown("Fire3"))
            {
                if (!_canserve)
                {
                    animator.SetTrigger("NormalKick");
                    server.Send("ANIMATIONTRIGGER|" + name + "%NormalKick", true);
                    _canmove = false;
                    Invoke("EnableMove", 0.471f);
                    kickController.PassBall(true);
                }
            }
        }

        if (_canmove)
        {
            movement.x = CrossPlatformInputManager.GetAxisRaw("Horizontal");
            movement.y = CrossPlatformInputManager.GetAxisRaw("Vertical");

            animator.SetBool("IsMoving", (movement.x != 0 || movement.y != 0));
        }
        else
        {
            animator.SetBool("IsMoving", false);
        }
    }
Example #2
0
    public void DoKick()
    {
        if (_canmove || _canserve)
        {
            //animator.SetTrigger("NormalKick");
            //server.Send("ANIMATIONTRIGGER|" + name + "%NormalKick", true);
            //kickController.NormalKick();
            //_canmove = false;
            //Invoke("EnableMove", 0.471f);
            //  Debug.Log(_canserve + " can serve");

            if (_canserve)
            {
                _canserve = false;
                animator.SetTrigger("ServeKick");
                server.Send("ANIMATIONTRIGGER|" + name + "%ServeKick", true);
                kickController.ServeKick(_power, _int);
            }
            else
            {
                animator.SetTrigger("NormalKick");
                server.Send("ANIMATIONTRIGGER|" + name + "%NormalKick", true);
                _canmove = false;
                Invoke("EnableMove", 0.471f);
                kickController.NormalKick(_power, _int);
            }
        }
    }