示例#1
0
 public WorldModel()
 {
     Entities = new EntityManager(this);
     EntityManager.Reset(true);
     Effects       = new EffectsManager(this);
     Input         = new WorldInput(this);
     Interaction   = new WorldInteraction(this);
     m_WorldClient = new WorldClient(this);
 }
示例#2
0
        }                                           // InWorld allows us to tell when our character object has been loaded in the world.

        // ============================================================================================================
        // Ctor, Initialization, Dispose, Update
        // ============================================================================================================
        public WorldModel()
        {
            Service.Add <WorldModel>(this);
            _engine        = Service.Get <UltimaGame>();
            _network       = Service.Get <INetworkClient>();
            _userInterface = Service.Get <UserInterfaceService>();
            Entities       = new EntityManager(this);
            Entities.Reset(true);
            Effects     = new EffectManager(this);
            Statics     = new StaticManager();
            Input       = new WorldInput(this);
            Interaction = new WorldInteraction(this);
            Client      = new WorldClient(this);
        }
        public WorldModel()
            : base()
        {
            UltimaServices.Register <WorldModel>(this);

            m_Engine        = UltimaServices.GetService <UltimaEngine>();
            m_Network       = UltimaServices.GetService <INetworkClient>();
            m_UserInterface = UltimaServices.GetService <UserInterfaceService>();

            Entities = new EntityManager(this);
            EntityManager.Reset(true);

            Effects     = new EffectsManager(this);
            Input       = new WorldInput(this);
            Interaction = new WorldInteraction(this);
            Client      = new WorldClient(this);
        }
示例#4
0
    private void Start()
    {
        WorldInput input = World.instance.input;

        // Get spawn points
        List <Vector2Int> enemySpawnPoints = World.instance.GetAllObjectPoints(World.WorldObject.Enemy);

        // Create enemeis
        enemies = new List <Enemy>();
        CreateEnemiesBasedOnData(input.enemies, enemySpawnPoints.Count);

        // Place enemies at right positions
        for (int i = 0; i < enemySpawnPoints.Count; i++)
        {
            enemies[i].UpdatePosition(enemySpawnPoints[i]);
        }
    }
示例#5
0
    public void IncrementLevel()
    {
        money += Random.Range(25, 35);

        if (levelNumber != 0)
        {
            attackCellChance += 10;
            if (attackCellChance >= 75)
            {
                attackCellChance = 75;
            }
            numberOfUnits += inputs[levelNumber - 1].rewardUnits;
        }

        input = inputs[levelNumber];
        levelNumber++;
    }
示例#6
0
        // ================================================================================
        // Ctor, Initialization, Dispose, Update
        // ================================================================================
        public WorldModel()
            : base()
        {
            ServiceRegistry.Register <WorldModel>(this);

            m_Engine        = ServiceRegistry.GetService <UltimaGame>();
            m_Network       = ServiceRegistry.GetService <INetworkClient>();
            m_UserInterface = ServiceRegistry.GetService <UserInterfaceService>();

            Entities = new EntityManager(this);
            Entities.Reset(true);
            Effects = new EffectManager(this);
            Statics = new StaticManager();

            Input       = new WorldInput(this);
            Interaction = new WorldInteraction(this);
            Client      = new WorldClient(this);
        }
示例#7
0
    public void GenerateWorld(WorldInput input)
    {
        this.input = input;
        cameraTarget.transform.position = new Vector3(input.size.x / 2, input.size.y / 2 - input.size.y / 9, 0);
        worldMap = new WorldObject[input.size.x, input.size.y];

        // Basic ground
        for (int y = 0; y < input.size.y; y++)
        {
            for (int x = 0; x < input.size.x; x++)
            {
                groundMap.SetTile(new Vector3Int(x, y, 0), groundTiles[Random.Range(0, groundTiles.Count)]);
                worldMap[x, y] = WorldObject.Empty;
            }
        }

        // Create huts
        int hutsToCreate            = Random.Range(input.minHuts, input.maxHuts);
        List <Vector2Int> hutPoints = new List <Vector2Int>();

        while (hutPoints.Count < hutsToCreate)
        {
            Vector2Int point = new Vector2Int(Random.Range(0, input.size.x), Random.Range(0, input.size.y));
            if (worldMap[point.x, point.y] == WorldObject.Empty)
            {
                worldMap[point.x, point.y] = WorldObject.Hut;
                hutPoints.Add(point);
            }
        }

        // Create enemy positons
        int enemiesToCreate = Random.Range(input.minEnemies, input.maxEnemies);
        List <Vector2Int> enemySpawnPoints = new List <Vector2Int>();

        while (enemySpawnPoints.Count < enemiesToCreate)
        {
            Vector2Int point = new Vector2Int(Random.Range(0, input.size.x), Random.Range(0, input.size.y));
            if (worldMap[point.x, point.y] == WorldObject.Empty)
            {
                worldMap[point.x, point.y] = WorldObject.Enemy;
                enemySpawnPoints.Add(point);
            }
        }
    }