private void PickNeed() { float roll = Random.Range(0.0f, 1.0f); _timer = Data.NeedTimeout; if (roll < Data.NonePercentage) { _currentNeed = KritterNeeds.None; ResetCDTimer(); } else if (roll <= Data.NonePercentage + Data.FoodPercentage) { _currentNeed = KritterNeeds.Food; } else if (roll <= Data.NonePercentage + Data.FoodPercentage + Data.WaterPercentage) { _currentNeed = KritterNeeds.Water; } else { _currentNeed = KritterNeeds.Care; } if (_currentNeed != KritterNeeds.None) { _needIcon.gameObject.SetActive(true); _needImage.sprite = _needIcons[(int)_currentNeed]; _needProgress.fillAmount = 1; PlaySound(_newNeed); } }
private int GetNeedScore(KritterNeeds need) { float score = _timer * 100; switch (need) { case KritterNeeds.Food: score *= Data.FoodPercentage; break; case KritterNeeds.Water: score *= Data.WaterPercentage; break; case KritterNeeds.Care: score *= Data.AttentionPercentage; break; case KritterNeeds.Health: score = 250.0f; break; } return((int)score); }
public void SetNeedMode(int need) { if (!GameOver) { _currentNeedMode = (KritterNeeds)need; if (Application.platform == RuntimePlatform.WebGLPlayer) { Cursor.SetCursor(_cursorTextures[need], _cursorHotspots[need], CursorMode.ForceSoftware); } else { Cursor.SetCursor(_cursorTextures[need], _cursorHotspots[need], CursorMode.Auto); } } }
internal bool FillNeed(KritterNeeds needAction) { if (_currentNeed == needAction) { GameManager.Current.PlayerManager.IncreaseScore(GetNeedScore(needAction)); ClearNeed(); return(true); } if (needAction == KritterNeeds.Health && (_health < Data.StartingHealth)) { GameManager.Current.PlayerManager.IncreaseScore(GetNeedScore(needAction)); Heal(); return(true); } return(false); }
public void SetNeedMode(KritterNeeds need) { SetNeedMode((int)need); }
private void ClearNeed() { _needIcon.gameObject.SetActive(false); _currentNeed = KritterNeeds.None; ResetCDTimer(); }