//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 OnUnselected(ExposeToEditor obj)
        {
            Rigidbody rig = obj.GetComponent <Rigidbody>();

            if (rig)
            {
                rig.isKinematic = true;
            }

            CubemanCharacter cubeman = obj.GetComponent <CubemanCharacter>();

            if (cubeman != null)
            {
                cubeman.Move(Vector3.zero, false, false);
                cubeman.Enabled = false;
            }

            CubemanUserControl userCtrl = obj.GetComponent <CubemanUserControl>();

            if (userCtrl != null)
            {
                userCtrl.HandleInput = false;
            }
        }
 private void Start()
 {
     m_character = GetComponent <CubemanCharacter>();
     m_rigidBody = GetComponent <Rigidbody>();
 }
Esempio n. 4
0
 private void Start()
 {
     m_editor    = IOC.Resolve <IRTE>();
     m_character = GetComponent <CubemanCharacter>();
     m_rigidBody = GetComponent <Rigidbody>();
 }