Beispiel #1
0
    public void SetPlayerHab(bool isPlayer)
    {
        if(!isPlayer){
            if(playerIcon.activeInHierarchy){
                playerIcon.GetComponent<PlayerIndicator>().Deactivate();
                WarningsController.EndAllHabWarnings(this);
            }
        }
        else{
            if(!playerIcon.activeInHierarchy){
                playerIcon.GetComponent<PlayerIndicator>().Activate(player.GetCritter());

                LocalEventController localControl = GetComponent<LocalEventController>();
                LocalEventController.localEvent localEvent = localControl.GetActiveLocalEventType();

                if (localEvent != LocalEventController.localEvent.NONE)
                {
                    WarningsController warnControl = FindObjectOfType<WarningsController>();
                    GlobalWarning.subType[] subs = new GlobalWarning.subType[1];
                    Sprite[] sprites = new Sprite[1];

                    subs[0] = GlobalWarning.subType.NONE;
                    sprites[0] = HexEventIcons.GetEventSprite(localEvent);

                    warnControl.AddWarning(this, GlobalWarning.warningType.EVENT, subs, sprites);
                }
            }
        }
        isPlayerHab = isPlayer;

        happyMeter.SetPlayerHab(isPlayer);
    }
Beispiel #2
0
    private void CheckSCORE()
    {
        bool isOk = VerifySurvivalSCORE();
        Color32 color = new Color32(255, 255, 255, 255);

        if(critter){
            if(!isOk){
                if(activeSCOREWarning == null){
                    Sprite[] sprt = new Sprite[1];
                    sprt[0] = sprites[10];
                    GlobalWarning.subType[] exType = new GlobalWarning.subType[1];
                    exType[0] = GlobalWarning.subType.NONE;

                    CreateWarning(warningType.SCORE, sprt[0], color);
                    warnControl.AddWarning(habitat, GlobalWarning.warningType.SCORE, exType, sprt);
                }
            }
            else{
                if(activeSCOREWarning){
                    RemoveWarning(activeSCOREWarning);
                }
            }
        }
    }
Beispiel #3
0
    private void CheckRESTRICT()
    {
        Adaptation.restriction[] restrictions = new Adaptation.restriction[0];
        Adaptation.restriction failItem = Adaptation.restriction.COLD;
        restrictions = critter.GetRestrictions();
        bool value = true;

        foreach (Adaptation.restriction item in restrictions)
        {
            bool canSurvive = habitat.MeetsRestrictionRequirements(item);

            if (canSurvive == false)
            {
                value = false;
                failItem = item;
                break;
            }
        }

        if (activeRESTRICTWarning == null)
        {
            if (!value)
            {
                Sprite[] sprt = new Sprite[1];
                sprt[0] = sprites[11];
                GlobalWarning.subType[] exType = new GlobalWarning.subType[1];
                exType[0] = GlobalWarning.subType.NONE;

                CreateWarning(warningType.RESTRICT, sprt[0], IconController.GetRestrictionIconColor(failItem));
                warnControl.AddWarning(habitat, GlobalWarning.warningType.RESTRICT, exType, sprt);
            }
        }
        else
        {
            if (value)
            {
                RemoveWarning(activeRESTRICTWarning);
            }
        }
    }
Beispiel #4
0
    private void CheckPOP(float popValue)
    {
        bool isOk = VerifyPOP();
        Color32 color = new Color32(255, 255, 255, 255);

        if (critter){
            popValues.Add(popValue);

            while(popValues.Count > 3){
                popValues.RemoveAt(0);
                popValues.TrimExcess();
            }

            if(activePOPWarning == null){
                if(!isOk){
                    Sprite[] sprt = new Sprite[1];
                    sprt[0] = sprites[9];
                    GlobalWarning.subType[] exType = new GlobalWarning.subType[1];
                    exType[0] = GlobalWarning.subType.NONE;

                    CreateWarning(warningType.POP, sprt[0], color);
                    warnControl.AddWarning(habitat, GlobalWarning.warningType.POP, exType, sprt);
                }
            }

            else{
                if(isOk){
                    RemoveWarning(activePOPWarning);
                }
            }
        }
    }
Beispiel #5
0
    private void CheckLOCO()
    {
        Critter.locomotionType[] locos = critter.GetLocomotion();
        bool value;

        foreach (Critter.locomotionType item in locos)
        {
            value = habitat.MeetsLocomotionRequirements(item);

            if (activeLOCOWarning == null)
            {
                if (!value)
                {
                    Sprite[] sprt = new Sprite[1];
                    sprt[0] = DetermineLocoSprite(item);
                    GlobalWarning.subType[] exType = new GlobalWarning.subType[1];
                    exType[0] = WarningsController.GetLocoSubType(item);

                    CreateWarning(warningType.LOCO, sprt[0], IconController.GetLocoColor(item));
                    warnControl.AddWarning(habitat, GlobalWarning.warningType.LOCO, exType, sprt);
                }
                else { break; }
            }
            else
            {
                if (value)
                {
                    RemoveWarning(activeLOCOWarning);
                    break;
                }
            }
        }
    }
Beispiel #6
0
    private void CheckFOOD()
    {
        Critter.dietType[] diet = critter.GetDiet();
        float value;
        float threshold = .55f;

        foreach (Critter.dietType item in diet)
        {
            value = habitat.GetFoodHealth(item);

            if (activeFOODWarning == null) {
                if (value < threshold)
                {
                    Sprite[] sprt = new Sprite[1];
                    sprt[0] = DetermineFoodSprite(item);
                    GlobalWarning.subType[] exType = new GlobalWarning.subType[1];
                    exType[0] =  WarningsController.GetDietSubtype(item);

                    CreateWarning(warningType.FOOD, sprt[0], IconController.GetFoodColor(item));
                    warnControl.AddWarning(habitat, GlobalWarning.warningType.FOOD, exType, sprt);
                }
                else { break; }
            }
            else
            {
                if (value >= threshold)
                {
                    RemoveWarning(activeFOODWarning);
                    break;
                }
            }
        }
    }