Exemple #1
0
        /// <summary>
        /// Sets the simulation up by configurating parameters and the like
        /// </summary>
        private void SetupSimulation()
        {
            // Add everyones token
            foreach (var user in Session.Users)
            {
                _secureTokensWaiting.Add(user.SecureToken);
            }

            // The state can be generated based on the session information passed down
            _simulationState = SimulationStateFactory.CreateSimulationState(Session);

            _serviceContainer = new ServiceContainer(_simulationState);

            var detonationService = new DetonationService();
            var powerupService    = new PowerupService();

            // Add services we might need
            _serviceContainer.AddService(detonationService);
            _serviceContainer.AddService(powerupService);

            _serviceContainer.EntityRemoved += _serviceContainer_EntityRemoved;
            _serviceContainer.EntityAdded   += _serviceContainer_EntityAdded;

            // Start the game timer immediately
            //TODO: Don't start the timer until everyone is loaded
            _timer.Start();

            _serviceContainer.PlayersAlive = Session.Users.Count;
        }
    public PowerupService()
    {
        instance = this;

        ServiceLocator.Register <IPowerupService>(this);

        ServiceLocator.Request <IShotResultService>().RegisterListener(Clean);

        if (rivalInventory == null)
        {
            rivalInventory = new PowerupInventory(true);
        }
    }