Beispiel #1
0
    void SetOldGroundStats(GameObject originalLand, GameObject storedLand)
    {
        GroundLogic ol = originalLand.GetComponent <GroundLogic> ();
        GroundLogic sl = storedLand.GetComponent <GroundLogic> ();

        sl.hasPa           = ol.hasPa;
        sl.placedStructure = ol.placedStructure;
        sl.occupied        = ol.occupied;
        sl.multiplier      = ol.multiplier;
        sl.roads           = ol.roads;
        sl.owner           = ol.owner;
    }
Beispiel #2
0
    //LayoutObjectAtRandom accepts an array of game objects to choose from along with a minimum and maximum range for the number of objects to create.
    void LayoutObjectAtRandom(GameObject resource, string name)
    {
        int count = 16;

        for (int i = 0; i < count; i++)
        {
            Vector3 randomPosition = RandomPosition();

            RaycastHit2D hit = Physics2D.Raycast(new Vector2(randomPosition.x, randomPosition.y), Vector2.zero);
            if (hit.collider != null)
            {
                GroundLogic tile = hit.collider.gameObject.GetComponent <GroundLogic>();
                tile.resource = name;
                Debug.Log("should be 16 of these " + name);
                Instantiate(resource, randomPosition, Quaternion.identity);
            }
        }
    }
Beispiel #3
0
 void ProcessResources(GroundLogic land)
 {
     if (land.resource == "Kauri")
     {
         this.data.Kauri += land.multiplier;
     }
     if (land.resource == "Moa")
     {
         this.data.Moa += land.multiplier;
     }
     if (land.resource == "Pounamu")
     {
         this.data.Pounamu += land.multiplier;
     }
     if (land.resource == "Flax")
     {
         this.data.Flax += land.multiplier;
     }
     this.data.Kumara += land.multiplier;
 }