Exemplo n.º 1
0
 public void OpenMoveBirbModal(Enums.BirbLocation location, int birbIndex)
 {
     if (moveBirbModal == null)
     {
         moveBirbModal = Instantiate(moveBirbPrefab, popupParent, false);
         moveBirbModal.GetComponent <BirbMover>().index           = birbIndex;
         moveBirbModal.GetComponent <BirbMover>().currentLocation = location;
     }
 }
Exemplo n.º 2
0
 public override bool TryAddBirb(Birb birb, Enums.BirbLocation location)
 {
     if (base.TryAddBirb(birb, location))
     {
         ResetBreeding();
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
 public override bool MoveBirb(Enums.BirbLocation location)
 {
     if (base.MoveBirb(location))
     {
         hh.birbList.Remove(this);
         Destroy(this.gameObject);
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
    public Birb SetBirbStats(Birb birb)
    {
        speciesId    = birb.speciesId;
        birbColor    = birb.birbColor;
        birbSprite   = birb.birbSprite;
        parents      = birb.parents;
        status       = birb.status;
        stats        = birb.stats;
        birbLocation = birb.birbLocation;
        hatched      = birb.hatched;

        SetBirbSpritesAndColours();

        return((Birb)this.MemberwiseClone());
    }
Exemplo n.º 5
0
 public override bool TryAddBirb(Birb birb, Enums.BirbLocation location)
 {
     openBirbSlot = CheckForOpenBirbSlot();
     if (openBirbSlot >= 0)
     {
         GameObject go = Instantiate(birbPrefab, Vector3.zero, Quaternion.identity);
         go.transform.SetParent(birbTransform);
         go.GetComponent <RectTransform>().offsetMax = Vector2.zero;
         go.GetComponent <RectTransform>().offsetMin = Vector2.zero;
         birbList.Add(go.GetComponent <HatchingBirb>());
         birbList[openBirbSlot].SetBirbStats(birb);
         birbList[openBirbSlot].birbLocation = location;
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
    public Birb CreateNewBirbFromParents(Birb parent1, Birb parent2, Enums.BirbLocation location = Enums.BirbLocation.NestParentsEgg)
    {
        parents = new List <Birb>();
        parents.Add(parent1.GetCopy());
        parents.Add(parent2.GetCopy());
        hatched = false;

        int species = Random.Range(0, parents.Count);

        speciesId  = parents[species].speciesId;
        birbSprite = parents[species].birbSprite;

        BirbColors tempColors = new BirbColors();

        //generate birb from parents if it has any, otherwise use defaults
        //TODO: make better algorithm here for getting parent traits
        tempColors.head  = parents[Random.Range(0, parents.Count)].birbColor.head;
        tempColors.body  = parents[Random.Range(0, parents.Count)].birbColor.body;
        tempColors.tail  = parents[Random.Range(0, parents.Count)].birbColor.tail;
        tempColors.wings = parents[Random.Range(0, parents.Count)].birbColor.wings;

        birbColor = tempColors.MutateColors(tempColors);

        stats.breedTime     = parents[Random.Range(0, parents.Count)].stats.breedTime;
        stats.carryWeight   = parents[Random.Range(0, parents.Count)].stats.carryWeight;
        stats.collectAmount = parents[Random.Range(0, parents.Count)].stats.collectAmount;
        stats.collectTime   = parents[Random.Range(0, parents.Count)].stats.collectTime;
        stats.growthPercent = 0f;
        stats.growthRate    = parents[Random.Range(0, parents.Count)].stats.growthRate;
        stats.hatchTime     = parents[Random.Range(0, parents.Count)].stats.hatchTime;
        stats.moveSpeed     = parents[Random.Range(0, parents.Count)].stats.moveSpeed;
        stats.sight         = parents[Random.Range(0, parents.Count)].stats.sight;

        birbLocation = location;

        return((Birb)this.MemberwiseClone());

        //else
        //{
        //    //tempColors = GameObject.Find("CrappyDatabas").GetComponent<CrappyDatabase>().GetSpeciesById(speciesId).GetWeightedDefaultColor();
        //}

        //birbImage = GameObject.Find("CrappyDatabas").GetComponent<CrappyDatabase>().GetSpeciesById(speciesId).image;
    }
Exemplo n.º 7
0
    public virtual bool MoveBirb(Enums.BirbLocation destination)
    {
        if (destination == birbLocation)
        {
            return(false);
        }
        else
        {
            switch (destination)
            {
            case Enums.BirbLocation.Aviary:
                if (GameObject.FindGameObjectWithTag("AviaryHandler").GetComponent <AviaryHandler>().TryAddBirb(this, Enums.BirbLocation.Aviary))
                {
                    return(true);
                }
                break;

            case Enums.BirbLocation.NestParent:
                if (GameObject.FindGameObjectWithTag("BreedingHandler").GetComponent <BreedingHandler>().TryAddBirb(this, Enums.BirbLocation.NestParent))
                {
                    return(true);
                }
                break;

            case Enums.BirbLocation.Collection:
                if (GameObject.FindGameObjectWithTag("CollectionHandler").GetComponent <CollectionHandler>().TryAddBirb(this, Enums.BirbLocation.Collection))
                {
                    return(true);
                }
                break;

            case Enums.BirbLocation.NestHatching:
                if (GameObject.FindGameObjectWithTag("HatchingHandler").GetComponent <HatchingHandler>().TryAddBirb(this, Enums.BirbLocation.NestHatching))
                {
                    return(true);
                }
                break;
            }
        }
        return(false);
    }
Exemplo n.º 8
0
    public virtual bool TryAddBirb(Birb birb, Enums.BirbLocation location)
    {
        switch (location)
        {
        case Enums.BirbLocation.Aviary:
            if (!birb.hatched)
            {
                return(false);
            }
            break;

        case Enums.BirbLocation.NestParent:
            if (!birb.hatched)
            {
                return(false);
            }
            break;

        default:
            break;
        }

        openBirbSlot = CheckForOpenBirbSlot();
        if (openBirbSlot >= 0)
        {
            GameObject go = Instantiate(birbPrefab, Vector3.zero, Quaternion.identity);
            go.transform.SetParent(birbTransform.GetChild(FindOpenBirbSlot()));
            go.GetComponent <RectTransform>().offsetMax = Vector2.zero;
            go.GetComponent <RectTransform>().offsetMin = Vector2.zero;
            birbList.Add(go.GetComponent <T>());
            birbList[openBirbSlot].SetBirbStats(birb);
            birbList[openBirbSlot].birbLocation = location;
            return(true);
        }
        return(false);
    }
Exemplo n.º 9
0
 public virtual void MoveBirbInBirbList(int index, Enums.BirbLocation toLocation)
 {
     birbList[index].MoveBirb(toLocation);
 }