DisplayHelp() public method

Displays context-sensitive help.
public DisplayHelp ( string sourceUrl ) : void
sourceUrl string The URL from which the request came.
return void
Ejemplo n.º 1
0
    void Update()
    {
        if (isLocalPlayer)
        {
            if (!activeChat && Input.GetKeyDown(KeyCode.H))
            {
                if (displayHelp)
                {
                    help.CloseHelp();
                    enableMove    = true;
                    availableChat = true;
                }
                else
                {
                    enableMove    = false;
                    availableChat = false;
                    help.DisplayHelp();
                }
                displayHelp = !displayHelp;
            }


            if (enableMove)
            {
                // Mouvement translation
                xTranslation = Input.GetAxis("Horizontal");
                zTranslation = Input.GetAxis("Vertical");

                // Mouvement rotation
                yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
                xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;

                // Speed
                if (Input.GetKey(KeyCode.LeftShift))
                {
                    speed = true;
                    //vitesseMarche = 4;
                    force = 240;
                }
                else
                {
                    speed = false;
                    //vitesseMarche = 2;
                    force = 70;
                }
                // Activation animation
                animScript.AnimMove(anim, xTranslation, zTranslation, speed);

                // Mouvement joueur
                //transform.Translate(xTranslation * vitesseLaterale * Time.deltaTime, 0, zTranslation * vitesseMarche * Time.deltaTime);
                if (xTranslation > 0)
                {
                    vectorTrans.x = mass * force;
                }
                else if (xTranslation < 0)
                {
                    vectorTrans.x = mass * (-force);
                }
                else
                {
                    vectorTrans.x = 0;
                }
                if (zTranslation > 0)
                {
                    vectorTrans.z = mass * force;
                }
                else if (zTranslation < 0)
                {
                    vectorTrans.z = mass * (-force);
                }
                else
                {
                    vectorTrans.z = 0;
                }
                GetComponent <Rigidbody>().AddRelativeForce(vectorTrans);



                xRotation        = Mathf.Clamp(xRotation, -80, 100);
                currentRotationX = Mathf.SmoothDamp(currentRotationX, xRotation, ref xRotationV, lookSmoothness);
                currentRotationY = Mathf.SmoothDamp(currentRotationY, yRotation, ref yRotationV, lookSmoothness);

                transform.rotation           = Quaternion.Euler(0, yRotation, 0);
                head.transform.localRotation = Quaternion.Euler(xRotation, 0, 0);
//                maCamera.transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
            }

            //sur appuis de escape, on active/desactive la sourie
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                afficheSourie(!Cursor.visible);
            }

            //sur appuis de la touche entrée
            if ((Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return)) && availableChat)
            {
                string textChat = GameObject.Find("InputFieldChat").GetComponent <InputField>().text;
                if (textChat != "")
                {
                    enableMove = true;
                    activeChat = false;
                    GameObject.Find("Chat").GetComponent <Chat>().SendMessage(GameObject.Find("InputFieldChat").GetComponent <InputField>());
                    GameObject.Find("InputFieldChat").GetComponent <InputField>().text = "";
                }
                else
                {
                    enableMove = false;
                    activeChat = true;
                    GameObject.Find("InputFieldChat").GetComponent <InputField>().ActivateInputField();
                }
            }
        }
    }