Пример #1
0
        private void AddBehaviours()
        {
            var  behaviours           = RootGameObject.GetComponentsInChildren <MonoBehaviour>(true);
            bool haveRootInputControl = false;
            bool haveJoints           = false;

            foreach (MonoBehaviour behaviour in behaviours)
            {
                if (behaviour == null)
                {
                    continue;
                }

                bool haveInputControlInObject;
                bool haveInputControlInRoot;
                AddInputControl(behaviour, out haveInputControlInObject, out haveInputControlInRoot);

                if (haveInputControlInObject)
                {
                    haveRootInputControl = true;
                }

                AddGameModeSwitchControls(behaviour);
                AddCollidersAware(behaviour);
                AddObjectTransforms(behaviour);
            }

            if (!haveRootInputControl)
            {
                var inputController = new InputController(this, RootGameObject,
                                                          true, true);
                _inputControllers.Add(-1, inputController);
                LogManager.GetCurrentClassLogger().Info("Added input controller on " + RootGameObject.name);
            }

            Entity.AddInputControls(_inputControllers);
        }
 public void Init(InputController inputController)
 {
     _inputController = inputController;
 }