public void OnPlayerDie(GameCharacter gameCharacter)
        {
            m_gameOver = true;
            m_cubemans.Remove(gameCharacter);
            TxtTip.gameObject.SetActive(false);

            StartCoroutine(ShowText("Game Over!"));
            for (int i = 0; i < m_cubemans.Count; ++i)
            {
                m_cubemans[i].IsActive = false;
            }
        }
        //protected override void StartOverride()
        //{
        //    base.StartOverride();

        //}

        private void StartGame()
        {
            m_gameOver     = false;
            m_playerCamera = FindObjectOfType <RTHandlesDemoSmoothFollow>();
            if (m_playerCamera != null)
            {
                Canvas canvas = GetComponentInChildren <Canvas>();
                Camera cam    = m_playerCamera.GetComponent <Camera>();
                canvas.worldCamera   = cam;
                canvas.planeDistance = cam.nearClipPlane + 0.01f;
            }


            //m_dof = m_playerCamera.GetComponent<DepthOfField>();
            m_cubemans = new List <GameCharacter>();

            CubemanUserControl[] cubemans = FindObjectsOfType <CubemanUserControl>().OrderBy(c => c.name).ToArray();
            for (int i = 0; i < cubemans.Length; ++i)
            {
                Rigidbody rig = cubemans[i].GetComponent <Rigidbody>();
                if (rig)
                {
                    rig.isKinematic = false;
                }

                CubemanCharacter character = cubemans[i].GetComponent <CubemanCharacter>();
                if (character)
                {
                    character.Enabled = true;
                }

                GameCharacter gameCharacter = cubemans[i].GetComponent <GameCharacter>();
                if (gameCharacter == null)
                {
                    gameCharacter = cubemans[i].gameObject.AddComponent <GameCharacter>();
                }

                if (gameCharacter != null)
                {
                    gameCharacter.Game = this;
                }

                if (m_playerCamera != null)
                {
                    gameCharacter.Camera = m_playerCamera.transform;
                }

                m_cubemans.Add(gameCharacter);
            }

            Begin();
        }
        public void OnPlayerFinish(GameCharacter gameCharacter)
        {
            m_score++;
            UpdateScore();

            SwitchPlayer(gameCharacter, 1.0f, true);
            m_cubemans.Remove(gameCharacter);

            if (IsGameCompleted())
            {
                m_gameOver = true;
                TxtTip.gameObject.SetActive(false);
                StartCoroutine(ShowText("Congratulation! \n You have completed a great game "));
            }
        }
        public void SwitchPlayer(GameCharacter current, float delay, bool next)
        {
            if (m_gameOver)
            {
                return;
            }

            int index = 0;

            if (current != null)
            {
                current.IsActive = false;
                index            = m_cubemans.IndexOf(current);
                if (next)
                {
                    index++;
                    if (index >= m_cubemans.Count)
                    {
                        index = 0;
                    }
                }
                else
                {
                    index--;
                    if (index < 0)
                    {
                        index = m_cubemans.Count - 1;
                    }
                }
            }

            m_current = m_cubemans[index];
            if (current == null)
            {
                ActivatePlayer();
            }
            else
            {
                StartCoroutine(ActivateNextPlayer(delay));
            }
        }