示例#1
0
        public OverlayController(UiStateModel uiState,
                                 ISimulationManager simulationManager,
                                 ISimulationState simulationState,
                                 IIndicatorProvider indicatorProvider,
                                 StatusBar statusBar)
        {
            _uiState = uiState ?? throw new ArgumentNullException(nameof(uiState));
            if (simulationManager == null)
            {
                throw new ArgumentNullException(nameof(simulationManager));
            }
            if (simulationState == null)
            {
                throw new ArgumentNullException(nameof(simulationState));
            }
            if (indicatorProvider == null)
            {
                throw new ArgumentNullException(nameof(indicatorProvider));
            }
            _statusBar = statusBar ?? throw new ArgumentNullException(nameof(statusBar));

            _executeEventArgs = new ExecuteEventArgs()
            {
                Manager = simulationManager,
                Sim     = simulationState,
            };

            _updateReadinessEventArgs = new UpdateReadinessEventArgs
            {
                Sim = simulationState,
            };

            _lastHover          = HexCoords.CreateFromOffset(-1, -1);
            _hoverTileIndicator = indicatorProvider.GetIndicator("HoverTileIndicator");
        }
示例#2
0
        public AgentBase(string agentType, IIndicatorProvider indicatorProvider)
        {
            AgentType = agentType;
            Position  = new Vector2(0.0f);

            Indicators = indicatorProvider.CreateIndicatorCollection();
            _modifiers = new VersionedCollection <IModifier>(new SimpleSortedList <IModifier>(StatModelComparer));
            _labels    = new VersionedCollection <ILabel>(new HashSet <ILabel>());
            _commands  = new VersionedCollection <IAgentCommand>(new HashSet <IAgentCommand>());

            _stats = new BaseStatsModel();
        }
示例#3
0
        public MapTileModel(HexCoords coords, IConfig config, IIndicatorProvider indicatorProvider)
        {
            Coords = coords;

            _agents = new VersionedCollection <IExtendedAgent>(new HashSet <IExtendedAgent>());

            // copy down config
            var radius = config.GetFloat(CoreConfig.TileRadius);

            // calculate position
            var radiusH = HexUtils.GetRadiusHeight(radius);

            var x = Coords.Column * (radius + radius * HexUtils.COS60);
            var y = ((Coords.Column & 1) * radiusH) + ((Coords.Row - (Coords.Column & 1)) * 2 * radiusH);

            Position   = new Vector2(x, y);
            Indicators = indicatorProvider.CreateIndicatorCollection();
        }
示例#4
0
        public SocketTowerBehaviour(IConfig config, IExtendedAgent host, IIndicatorProvider indicatorProvider)
        {
            // set label
            var labelIndicatorName = config.GetString(CfgTextIndicatorName);
            var labelIndicator     = (TextIndicator)indicatorProvider.GetIndicator(labelIndicatorName);

            var labelText = string.Format("{0},{1}", host.Tile.Coords.Q, host.Tile.Coords.R);

            labelIndicator.SetLabelText(labelText);

            host.Indicators.Add(labelIndicator);

            // set position
            host.Position = host.Tile.Position;

            foreach (var indicator in host.Indicators)
            {
                indicator.Position = host.Position;
            }
        }
示例#5
0
 public MapLoader(IConfig config, IIndicatorProvider indicatorProvider, ISimulationManager simulationManager)
 {
     _config            = config ?? throw new ArgumentNullException(nameof(config));
     _indicatorProvider = indicatorProvider ?? throw new ArgumentNullException(nameof(indicatorProvider));
     _simulationManager = simulationManager ?? throw new ArgumentNullException(nameof(simulationManager));
 }