Ejemplo n.º 1
0
        private void Start()
        {
            playerNameText.text = photonView.Owner.NickName;

            respawnPosition = GameObject.FindGameObjectWithTag("Respawn").transform.position;

            transform.position = respawnPosition;

            //get all important components of the player
            rb             = GetComponent <Rigidbody2D>();
            spriteRenderer = GetComponent <SpriteRenderer>();
            animator       = GetComponent <Animator>();
            actualJumps    = 0;

            //subscribe the events
            chatController = GameObject.FindGameObjectWithTag("Chat").GetComponent <GeneralChatController>();
            chatController.OnChat.AddListener(BlockMovements);
            chatController.OnDisableChat.AddListener(ReleaseMovements);

            //assign the camera to the player if the player controlls this GO
            if (photonView.IsMine)
            {
                GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMovement>().AssignCameraToLocalPlayer(this.gameObject);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// button function called to text the player on this profile
        /// </summary>
        public void SendMessage()
        {
            GeneralChatController chatController = GameObject.FindGameObjectWithTag("Chat").GetComponent <GeneralChatController>(); //gets the chat controller

            chatController.ShowChat(true, "@p " + playerName + " ");                                                                //writes the command inside the chat
        }