Esempio n. 1
0
    void Awake()
    {
        Singleton = this;
        TypeToDiffuse[typeof(Height)] = new Height(GetPositions(WaterSources).ToList(), GetPositions(MountainSources).ToList());
        DebugDiffuseAble.Add(TypeToDiffuse[typeof(Height)]);
        InitializeMap(TypeToDiffuse[typeof(Height)]);

        TypeToDiffuse[typeof(SaltLevels)] = new SaltLevels(NoSaltSources, SaltSources);
        DebugDiffuseAble.Add(TypeToDiffuse[typeof(SaltLevels)]);
        InitializeMap(TypeToDiffuse[typeof(SaltLevels)], 5);

        TypeToDiffuse[typeof(Temperature)] = new Temperature(HotSources, ColdSources);
        DebugDiffuseAble.Add(TypeToDiffuse[typeof(Temperature)]);
        InitializeMap(TypeToDiffuse[typeof(Temperature)]);

        TypeToDiffuse[typeof(Hydration)] = new Hydration(HydrationSources, DrySource);
        DebugDiffuseAble.Add(TypeToDiffuse[typeof(Hydration)]);
        InitializeMap(TypeToDiffuse[typeof(Hydration)]);

        TypeToDiffuse[typeof(Nutrients)] = new Nutrients(NutrientsSources, NoNutrientsSource);
        DebugDiffuseAble.Add(TypeToDiffuse[typeof(Nutrients)]);
        InitializeMap(TypeToDiffuse[typeof(Nutrients)]);

        TypeToDiffuse[typeof(Tree)] = new Tree(TreeSources, CitySources);
        DebugDiffuseAble.Add(TypeToDiffuse[typeof(Tree)]);
    }
Esempio n. 2
0
    void UpdateThirst()
    {
        Timestamp currentTime = timeManager.GetTime();
        uint      hoursUntilDeadFromThirst = timeManager.HoursBetweenTimestamps(currentTime, timeWhenDeadToThirst);

        if (hoursUntilDeadFromThirst == 0)
        {
            Debug.Log("Character died due to hydration");
            Kill();
        }
        else if (hoursUntilDeadFromThirst < hoursBelowForVeryThirsty)
        {
            hydration = Hydration.VERY_THIRSTY;
        }
        else if (hoursUntilDeadFromThirst < hoursBelowForThirsty)
        {
            hydration = Hydration.THIRSTY;
        }
        else if (hoursUntilDeadFromThirst < hoursBelowForSlightlyThirsty)
        {
            hydration = Hydration.SLIGHTLY_THIRSTY;
        }
        else
        {
            hydration = Hydration.HYDRATED;
        }
    }
Esempio n. 3
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "HasWater" && playerManager.waterAmount <= 100)
     {
         Debug.Log("has water");
         hydration = collision.GetComponentInChildren <Hydration>();
         playerManager.waterAmount += hydration.wetnessAmount;
     }
 }
Esempio n. 4
0
    /// <summary>
    /// Sets up initial references to transform, shelter, hydration, food, hygiene and well being. As well as subscribes to events.
    /// </summary>
    private void Start()
    {
        cachedTransform = transform;
        shelter         = GetComponent <Shelter>();
        hydration       = GetComponent <Hydration>();
        food            = GetComponent <Food>();
        hygiene         = GetComponent <Hygiene>();
        wellbeing       = GetComponent <OverallWellbeing>();

        myMat = GetComponent <Renderer>().material;

        TimeManager.GetInstance().OnTick += TickHandler;
    }