예제 #1
0
    public void LockEvo(Critter critter)
    {
        if(critter.unlockedEvos.Contains(this)){
            critter.unlockedEvos.Remove(this);
            critter.unlockedEvos.TrimExcess();
        }

        if(critter.GetIsPlayer()){
            CheckCurrentBuyState(critter);
        }
    }
예제 #2
0
    public void CheckCurrentBuyState(Critter critter)
    {
        if(critter.GetIsPlayer()){
            if(critter){
                if (critter.activeEvos.Contains(this)){
                    if (isMajor)
                    {
                        if (critter.equipedEvos.Contains(this))
                        {
                            if (critter.lockedEvos.Contains(this))
                            {
                                currentBuyState = playerBuyState.LOCKED;
                            }
                            else
                            {
                                currentBuyState = playerBuyState.EQUIPED;
                            }
                        }
                        else
                        {
                            if (critter.lockedEvos.Contains(this))
                            {
                                currentBuyState = playerBuyState.LOCKED;
                            }
                            else if (Prerequisites1.Count > 0)
                            {
                                foreach (Adaptation item in Prerequisites1)
                                {
                                    if (critter.activeEvos.Contains(item))
                                    {
                                        currentBuyState = playerBuyState.CANEQUIP;
                                    }
                                    else
                                    {
                                        currentBuyState = playerBuyState.NOREFUND;
                                        break;
                                    }
                                }
                            }
                            else if (currentBuyState == playerBuyState.NOREFUND)
                            {
                                foreach (Adaptation item in Prerequisites2)
                                {
                                    if (critter.activeEvos.Contains(item))
                                    {
                                        currentBuyState = playerBuyState.CANEQUIP;
                                    }
                                    else
                                    {
                                        currentBuyState = playerBuyState.NOREFUND;
                                    }
                                }
                            }
                            else
                            {
                                currentBuyState = playerBuyState.CANEQUIP;
                            }
                        }
                    }

                    else if (hasUnlocks){
                        foreach(Adaptation item in Unlocks){
                            if(critter.activeEvos.Contains(item)){
                                if (item.GetCurrentBuyState() == playerBuyState.EQUIPED)
                                {
                                    currentBuyState = playerBuyState.NOREFUND;
                                    break;
                                }
                                else if (item.GetCurrentBuyState() == playerBuyState.ACTIVE)
                                {
                                    currentBuyState = playerBuyState.NOREFUND;
                                    break;
                                }
                                else
                                {
                                    currentBuyState = playerBuyState.ACTIVE;
                                }
                            }
                            else{
                                currentBuyState = playerBuyState.ACTIVE;
                            }
                        }
                    }

                    else{
                        if(!hasUnlocks){
                            currentBuyState = playerBuyState.ACTIVE;
                        }
                    }
                }

                else if(critter.unlockedEvos.Contains(this)){
                    foreach (Adaptation item in critter.activeEvos)
                    {
                        if (!item.isMajor)
                        {
                            if (item.Conflicts.Contains(this))
                            {
                                currentBuyState = playerBuyState.LOCKED;
                                break;
                            }
                            else
                            {
                                currentBuyState = playerBuyState.UNLOCKED;
                            }
                        }
                        else
                        {
                            currentBuyState = playerBuyState.UNLOCKED;
                        }
                    }
                    foreach (Adaptation item in critter.equipedEvos)
                    {
                        if (item.Conflicts.Contains(this))
                        {
                            currentBuyState = playerBuyState.LOCKED;
                            break;
                        }
                        else
                        {
                            currentBuyState = playerBuyState.UNLOCKED;
                        }
                    }
                }
                else{
                    currentBuyState = playerBuyState.LOCKED;
                }
            }
        }
    }
예제 #3
0
    //Equips Major evo to critter's dataSlot; then pushes all new requirements
    public void Equip(Critter critter, SlotData dataSlot)
    {
        dataSlot.EquipSlot(this);
        LockConflicts(critter);
        ModifyStats(critter);

        if(critter.GetIsPlayer()){
            CheckCurrentBuyState(critter);

            foreach (Adaptation item in Prerequisites1)
            {
                item.CheckCurrentBuyState(critter);
            }
            foreach (Adaptation item in Prerequisites2)
            {
                item.CheckCurrentBuyState(critter);
            }
            foreach (Adaptation item in Unlocks)
            {
                item.CheckCurrentBuyState(critter);
            }
        }

        critter.GenerateDiet();
        critter.GenerateLocomotion();
    }
예제 #4
0
    private void UnlockConflicts(Critter critter)
    {
        bool isPlayer = critter.GetIsPlayer();

        foreach (Adaptation item in Conflicts){
            if(critter.lockedEvos.Contains(item)){

                if (!item.LockCheck(critter)){
                    item.UnlockConflict(critter);

                    if (isPlayer){
                        item.CheckCurrentBuyState(critter);
                    }
                }
            }
        }
    }
예제 #5
0
    public void BuyEvo(Critter critter)
    {
        float pts = critter.GetEvoPts();

        if (pts >= cost && !critter.activeEvos.Contains(this)) {
            Activate(critter);

            critter.ModifyEvoPts(-cost);

            if(isMajor && !critter.GetIsPlayer()){
                EquipOpenSlot(critter);
            }
        }

        critter.statUpdateQueued = true;
    }
예제 #6
0
    void Deactivate(Critter critter)
    {
        critter.activeEvos.Remove(this);
        critter.unlockedEvos.Add(this);
        critter.activeEvos.TrimExcess();
        critter.unlockedEvos.TrimExcess();

        LockUnlocks(critter);

        if (!isMajor){
            RefundStats(critter);
            UnlockConflicts(critter);
        }

        if(critter.GetIsPlayer()){
            CheckCurrentBuyState(critter);

            foreach (Adaptation item in Prerequisites1)
            {
                item.CheckCurrentBuyState(critter);
            }
            foreach (Adaptation item in Prerequisites2)
            {
                item.CheckCurrentBuyState(critter);
            }
            foreach (Adaptation item in Unlocks)
            {
                item.CheckCurrentBuyState(critter);
            }
        }
    }
예제 #7
0
    public void UnlockEvo(Critter critter)
    {
        bool isPlayer = critter.GetIsPlayer();
        bool shouldUnlock = CheckPrereqsCompleted(critter);

        if(!critter.unlockedEvos.Contains(this)){
            if (shouldUnlock) {
                critter.unlockedEvos.Add(this);
                critter.unlockedEvos.TrimExcess();

                if (isPlayer)
                {
                    foreach (Adaptation item in Prerequisites1)
                    {
                        item.CheckCurrentBuyState(critter);
                    }

                    foreach (Adaptation item in Prerequisites2)
                    {
                        item.CheckCurrentBuyState(critter);
                    }

                    foreach (Adaptation item in Unlocks)
                    {
                        item.CheckCurrentBuyState(critter);
                    }

                    CheckCurrentBuyState(critter);
                }
            }
        }
    }
예제 #8
0
    //Unequips evo from selected slot on selected critter and updates buttons for player.
    public void Unequip(Critter critter, SlotData dataSlot)
    {
        dataSlot.UnequipSlot();
        UnlockConflicts(critter);

        RefundStats(critter);

        if(critter.GetIsPlayer()){
            CheckCurrentBuyState(critter);

            foreach (Adaptation item in Prerequisites1)
            {
                item.CheckCurrentBuyState(critter);
            }
            foreach (Adaptation item in Prerequisites2)
            {
                item.CheckCurrentBuyState(critter);
            }
            foreach (Adaptation item in Unlocks)
            {
                item.CheckCurrentBuyState(critter);
            }
            foreach (Adaptation item in Conflicts)
            {
                item.CheckCurrentBuyState(critter);
            }
        }
        critter.UnequipSpecials(this);
    }
예제 #9
0
    public void UnlockCritterStartEvos(Critter critter)
    {
        foreach(Adaptation targetEvo in startingUnlocks){
            if(!critter.activeEvos.Contains(targetEvo)) {
                targetEvo.BuyEvo(critter);

                if(critter.GetIsPlayer()){
                    if (targetEvo.isMajor) {
                        targetEvo.EquipOpenSlot(critter);
                    }
                }
            }
        }
    }
예제 #10
0
    //Cleans a creature from lists and game when they go extinct.
    public void Extinction(Critter DeadCritter)
    {
        totalCritters--;

        //print ("Critter# " + DeadCritter.GetNumber() + " done gone extint. Total Critters = " + totalCritters + ".\r\n");
        if (DeadCritter.GetIsPlayer())
        {
            EndGame();
        }
        else
        {
            CritterList.Remove(DeadCritter);
            CritterList.TrimExcess();

            DeadCritter.gameObject.SetActive(false);

            //turnTimer.PhaseComplete();
        }
    }