Example #1
0
        public void Init(Unit unit)
        {
            _unit = unit;
            Id    = _unit.Id;

            _partViewsManager = ManagerProvider.Instance.PartViewsManager;

            _unit.Partset.OnPartAttached += OnPartAttached;
            _unit.Partset.OnPartDetached += OnPartDetached;
            foreach (var pair in _unit.Partset.Slots)
            {
                if (pair.Value.Part != null)
                {
                    OnPartAttached(pair.Value);
                }
            }

            TargetView = GetComponentInChildren <TargetView>();
        }
Example #2
0
        protected override void Awake()
        {
            base.Awake();

            GameSettings = GameSettings.Instance;

            UnitObjectManager = GameObject.FindObjectOfType <UnitObjectManager>();
            UnitViewManager   = GameObject.FindObjectOfType <UnitViewManager>();
            InputManager      = GameObject.FindObjectOfType <InputManager>();
            PartViewsManager  = GameObject.FindObjectOfType <PartViewsManager>();
            ShotViewsManager  = GameObject.FindObjectOfType <ShotViewsManager>();

            UnitManager         = new UnitManager();
            PartsManager        = new PartsManager();
            TimeManager         = new TimeManager();
            SelectionManager    = new SelectionManager();
            CommandManager      = new CommandManager();
            InputContextManager = new InputContextManager();
            PlayerManager       = new PlayerManager();
            VisibilityManager   = new VisibilityManager();
            ShotsManager        = new ShotsManager();

            _managers[UnitManager.ManagerType]         = UnitManager;
            _managers[UnitViewManager.ManagerType]     = UnitViewManager;
            _managers[UnitObjectManager.ManagerType]   = UnitObjectManager;
            _managers[InputManager.ManagerType]        = InputManager;
            _managers[SelectionManager.ManagerType]    = SelectionManager;
            _managers[CommandManager.ManagerType]      = CommandManager;
            _managers[TimeManager.ManagerType]         = TimeManager;
            _managers[InputContextManager.ManagerType] = InputContextManager;
            _managers[PlayerManager.ManagerType]       = PlayerManager;
            _managers[VisibilityManager.ManagerType]   = VisibilityManager;
            _managers[ShotsManager.ManagerType]        = ShotsManager;
            _managers[ShotViewsManager.ManagerType]    = ShotViewsManager;
            _managers[PartsManager.ManagerType]        = PartsManager;
            _managers[PartViewsManager.ManagerType]    = PartViewsManager;

            foreach (var manager in _managers.Values)
            {
                manager.Init();
            }
        }