Exemplo n.º 1
0
 protected override void OnClone(GameObject original)
 {
     originalGoat = original.GetComponent <GoatDnD>();
     foreach (UI2DSprite current in sprites)
     {
         current.depth += 5;
     }
     tooltip.SetActive(false);
 }
Exemplo n.º 2
0
 public void AddGoat(GoatDnD goat)
 {
     for (int i = 0; i < maxGoats; i++)
     {
         if (!stable[i].Occupied())
         {
             stable[i].Assign(goat);
             break;
         }
     }
 }
Exemplo n.º 3
0
    public GoatDnD NewGoat()
    {
        GoatDnD temp = GameObject.Instantiate(goatFab).GetComponent <GoatDnD>();

        temp.genes = fac.createBaseCreature();
        //temp.SetPop(Random.Range(0, 5));
        //temp.SetSan(Random.Range(0, 5));
        temp.InitStats();
        for (int i = 0; i < 3; i++)
        {
            temp.sprites[i].sprite2D = temp.genes.parts[i].sprite;
        }
        return(temp);
    }
Exemplo n.º 4
0
 public void Clear(bool delete)
 {
     m.totalGoats--;
     if (delete)
     {
         NGUITools.Destroy(currentGoat.gameObject);
     }
     else
     {
         currentGoat = null;
     }
     emptySprites.SetActive(true);
     fullSprites.SetActive(false);
 }
Exemplo n.º 5
0
 public void Assign(GoatDnD goat)
 {
     if (Occupied())
     {
         Clear();
     }
     currentGoat       = goat;
     currentGoat.stall = this;
     m.totalGoats++;
     //Debug.Log(goat.transform.localScale);
     goat.transform.parent     = gridTrans;
     goat.transform.localScale = new Vector3(1f, 1f, 1f);
     myGrid.Reposition();
     emptySprites.SetActive(false);
     fullSprites.SetActive(true);
     //Debug.Log(goat.transform.localScale);
 }
Exemplo n.º 6
0
 public void Cross(GoatDnD goatA, GoatDnD goatB)
 {
     if (totalGoats < maxGoats)
     {
         GoatDnD temp = GameObject.Instantiate(goatFab).GetComponent <GoatDnD>();
         temp.genes = fac.breedCreatures(goatA.genes, goatB.genes);
         //temp.SetPop(Random.Range(0, 5));
         //temp.SetSan(Random.Range(0, 5));
         temp.InitStats();
         for (int i = 0; i < 3; i++)
         {
             temp.sprites[i].sprite2D = temp.genes.parts[i].sprite;
         }
         AddGoat(temp);
         soundEffects.playCreatureSound();
     }
     else
     {
         Debug.Log("SACRIFICE GOATS BEFORE CONSTRUCTING ADDITIONAL GOATS");
     }
 }
Exemplo n.º 7
0
    public void Sacrifice(GoatDnD sac)
    {
        if (totalGoats <= 2)
        {
            Debug.Log("YOU MUST CONSTRUCT ADDITIONAL GOATS.");
            return;
        }
        //Debug.Log("Sacrificing " + sac);
        sac.gameObject.SetActive(false);         // Prevents the tooltip from popping up after destruction.
        sac.stall.Clear();

        if (divinities.onSacrifice(sac.genes))
        {
            soundEffects.playPleasedSound();
        }
        else
        {
            soundEffects.playAngeredSound();
        }
        Turn();
    }
Exemplo n.º 8
0
    protected override void OnDragDropRelease(GameObject surface)
    {
        if (surface != null)
        {
            if (surface.tag != "Root")               // I feel bad that this is my solution, frankly.

            {
                GoatSacrifice sac = surface.GetComponent <GoatSacrifice>();
                if (sac != null)
                {
                    sac.Sacrifice(originalGoat);
                }

                GoatDnD mate = surface.GetComponentInChildren <GoatDnD>();

                if (mate != null && mate != originalGoat)
                {
                    if (m == null)
                    {
                        m = GameObject.FindGameObjectWithTag("Main").GetComponent <Main>();
                    }
                    m.Cross(originalGoat, mate);
                }
                else
                {
                    GoatContainer newhouse = surface.GetComponent <GoatContainer>();
                    if (newhouse != null)
                    {
                        // Move to new stall.
                        stall.Clear(false);
                        newhouse.Assign(originalGoat);
                    }
                }
            }
        }
        OnDragDropEnd();
        NGUITools.Destroy(gameObject);
    }
Exemplo n.º 9
0
 public void Sacrifice(GoatDnD sac)
 {
     m.Sacrifice(sac);
 }