Пример #1
0
        //[Inject]
        //public void Construct(
        //	SearchTrackManager.Factory searchTrackManagerFactory,
        //	GuardManager guardManager
        //)
        //{
        //	_guardManager = guardManager;
        //	_searchTrackManagerFactory = searchTrackManagerFactory;
        //}

        public SquadManager(
            List <GuardStateBrainPBT> guards,
            SearchTrackManager.Factory searchTrackManagerFactory,
            GuardManager guardManager
            )
        {
            _guards = guards.Copy();
            _searchTrackManagerFactory = searchTrackManagerFactory;
            _guardManager = guardManager;

            _guards.ForEach(
                (guard) => _guardManager.RegisterNonPatrolRouteGuard(guard)
                );

            _drones       = new List <SquadDroneBehaviour>();
            _leftPhalanx  = new List <SquadDroneBehaviour>();
            _rightPhalanx = new List <SquadDroneBehaviour>();

            _phalanxes = new List <SquadDroneBehaviour>[]
            {
                _leftPhalanx,
                _rightPhalanx
            };

            _leader = guards.Pop().SquadLeaderBehaviour;
            _leader.gameObject.SetActive(true);
            _leader.Init(this);


            _allSquadMembers = new List <SquadMember>()
            {
                (SquadMember)_leader
            };

            AddDrones(
                guards.Map((guard) => guard.SquadDroneBehaviour)
                );

            SetupListeners();
        }