Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }


        if (manager.GetState() == CTFGameManager.CTF_GameState.GS_InGame)
        {
            if (m_rb.velocity.y < Mathf.Epsilon)
            {
                TrailRenderer tr = GetComponent <TrailRenderer> ();
                tr.enabled = false;
            }
            Vector3 linearVelocity;

            float rotationInput = Input.GetAxis("Horizontal");
            float forwardInput  = Input.GetAxis("Vertical");
            if (!m_speedUp)
            {
                linearVelocity = this.transform.forward * (forwardInput * m_linearSpeed);
            }
            else
            {
                linearVelocity = this.transform.forward * (forwardInput * (2.0f * m_linearSpeed));
            }

            if (Input.GetKeyDown(KeyCode.Space) && !HasFlag())
            {
                CmdJump();
            }

            float yVelocity = m_rb.velocity.y;


            linearVelocity.y = yVelocity;
            m_rb.velocity    = linearVelocity;

            Vector3 angularVelocity = this.transform.up * (rotationInput * m_angularSpeed);
            m_rb.angularVelocity = angularVelocity;
        }

        // false when power up runs out
        if (m_speedUp)
        {
            m_speedTime -= Time.deltaTime;

            if (m_speedTime <= 0)
            {
                m_speedUp   = false;
                m_speedTime = 4;
            }
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (manager.GetState() == CTFGameManager.CTF_GameState.GS_Ready)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                CmdReadyUp();
            }

            if (m_ready)
            {
                m_readyText.text = " Press Spaceebar get ready.";
            }
            else
            {
                m_readyText.text = " Press spacebar to get unready.";
            }
        }
    }