Пример #1
0
    private void useAnimalPool(int nodeID, List <GameObject> pool, List <Vector2> points, string size)
    {
        GameObject node  = nodes[nodeID];
        WorldNode  wnode = wnodes[nodeID];

        for (int i = 0; i < pool.Count; i++)
        {
            if (points.Count == 0)
            {
                for (int j = i; j < pool.Count; j++)
                {
                    pool[j].SetActive(false);
                }
                break;
            }
            Vector2    point      = points[0];
            GameObject poolObject = pool[i];
            Wildlife   wildlife   = poolObject.GetComponent <Wildlife>();
            poolObject.transform.position = wildlife.SetFloorPosition(point);
            poolObject.SetActive(true);
            wildlife.Reset();
            points.Remove(point);
        }
        for (int i = 0; i < points.Count; i++)
        {
            Vector2           point    = points[i];
            List <GameObject> animals  = beastiary[size];
            GameObject        animal   = Instantiate(animals[Random.Range(0, animals.Count)], node.transform.Find("Wildlife").Find(size));
            Wildlife          wildlife = animal.GetComponent <Wildlife>();
            wildlife.Init();
            wildlife.SetNodeID(nodeID);
            animal.transform.position = wildlife.SetFloorPosition(point);
            wnode.AddPoolObject(animal, pool);
        }
    }
Пример #2
0
    // public Ground[] groundAlterations;


    public Town(string tileType)
    {
        name      = "testName";
        X         = 50;
        Z         = 50;
        buildings = new List <House>();
        // Generate Wildlife
        wildlife = new Wildlife(X, Z, tileType);
        // Load in Building Components
        componentTypes = BuildingComponent.LoadBuildingComponentsFromFile(@"TSV\BuildingComponentInfo");
    }
        protected override void LoadContent()
        {
            sky = new Sky(sim);
            sky.LoadContent(sim.Content);
            weather = new Weather(sim);
            weather.LoadContent();
            wildlife = new Wildlife(sim);
            wildlife.LoadContent();
            lighting = new Lighting(this);

            PresentationParameters pp = GraphicsDevice.PresentationParameters;

            worldRenderTarget = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, 1, SurfaceFormat.Color);
        }
Пример #4
0
 public Battle(string type, List <Character> protagonist, Hex embattledTile)
 {
     if (type == "encounter")
     {
         // Generate a Battlefield
     }
     else if (type == "foundation")
     {
         // Assign the town founders
         sideA = protagonist;
         // Generate the enemies to be fought
         sideB = GenerateEnemies(embattledTile);
         // Generate a Battlefield at the location the town is to be founded.
         // Size of the battlefield depends upon the number of participants
         int dimension = 20 + 5 * (sideA.Count + sideB.Count - 2);
         battlefield = new Wildlife(dimension, dimension, embattledTile.type);
         // Generate Unit Locations
     }
 }
        protected override void LoadContent()
        {
            sky = new Sky(sim);
            sky.LoadContent(sim.Content);
            weather = new Weather(sim);
            weather.LoadContent();
            wildlife = new Wildlife(sim);
            wildlife.LoadContent();
            lighting = new Lighting(this);

            PresentationParameters pp = GraphicsDevice.PresentationParameters;
            worldRenderTarget = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, 1, SurfaceFormat.Color); 
        }