void StatsUpdated(Player.StatType type, float newValue, float oldValue) { if (type == Player.StatType.Hotness) { return; } Image image = null; switch (type) { case Player.StatType.Chimney: image = Chimney; break; case Player.StatType.Plumbing: image = Plumbing; break; case Player.StatType.Kitchen: image = Kitchen; break; case Player.StatType.Boiler: image = Boiler; break; } if (image == null) { return; } SetValue(image, newValue); }
public void StatsUpdated(Player.StatType type, float hotness, float oldHotness) { // SEXYNESS OVERLOAD if (type == Player.StatType.Hotness && hotness == 1) { gameOver = true; endState = EndState.Overload; //AudioManager.PlaySingleShot(AudioManager.Sounds.KinkySound); GenerateEndCard(endState); Debug.Log("Perdu !"); } }
public void SetAllData(string n, string q, float hotness, Player.StatType type, float stat, GameObject ip, string repairIconPath) { name = n; quote = q; sexyStat = hotness; houseType = type; houseStat = stat; //chimneyStat = cs; //plumbryStat = ps; //kitchenStat = ks; //boilerStat = bs; //sprite = i; // Set image //Image cardImage = transform.Find("InCard/CharacterSprite").GetComponent<Image>(); imagePrefab = Instantiate(ip, imageParent); //Set name //Text cardName = transform.Find("Background/CharacterName").GetComponent<Text>(); nameComponent.text = name; //Set hotness points String sexyStr = ""; if (sexyStat > 0) { sexyStr += "+"; } sexyStr += ((int)(sexyStat * StatsPool.MaxSexAppeal)).ToString(); //TextMesh cardHotness = transform.Find("StatsContainer/HotnessContener/HotnesIcon/HotnessPoint").GetComponent<TextMesh>(); hotnessComponent.text = sexyStr; //Set repair points String repairStr = ""; if (houseStat > 0f) { repairStr += "+"; } repairStr += ((int)(houseStat * StatsPool.MaxRepair)).ToString(); //TextMesh cardRepair = transform.Find("StatsContainer/RepairContener/RepairIcon/RepairPoint").GetComponent<TextMesh>(); repairComponent.text = repairStr; repairIcon.sprite = Resources.Load <Sprite>(repairIconPath); }
void HotnessUpdated(Player.StatType type, float hotness, float oldHotness) { if (type != Player.StatType.Hotness) { return; } int newStep = Mathf.Clamp((int)(hotness * 4f), 0, 3); int oldStep = Mathf.Clamp((int)(oldHotness * 4f), 0, 3); if (newStep != oldStep) { SetHotnessLevel(oldStep, hotness); if (newStep > oldStep) { Hotness[oldStep].transform.DOPunchScale(Vector3.one * 0.2f, 1f, 10, 1f); } } SetHotnessLevel(newStep, hotness); }
Queue <Card> GenerateDeck(int size) { Queue <Card> ourDeck = new Queue <Card>(); //ourDeck.Enqueue(DoorCard); for (int i = 0; i < size; i++) { GameObject cardGO = Instantiate(cardPrefab, deckPlaceHolder.position, Quaternion.identity, deckPlaceHolder); Card ourCard = cardGO.GetComponent <Card>(); int randGender = Random.Range(0, Genders.Count); string gender = Genders[randGender]; int randName = Random.Range(0, Names[gender].Count); string name = Names["M"][randName]; /* * int randQuote = Random.Range(0, Quotes.Count); * string quote = Quotes[randQuote]; */ string quote = StatsPool.instance.Quote; //int randImage = (int)Random.Range(0, imagePaths.Count - 1); //string imagePath = imagePaths[randQuote]; //Sprite image = Resources.Load(imagePath) as Sprite; //Sprite image = Resources.Load<Sprite>("wink"); int randImage = Random.Range(0, ImagePrefabs.Count); GameObject imagePrefab = ImagePrefabs[randImage]; // A CHANGER QUAND LES MODIFS DANS PLAYER SERONT PUSHÉS ////////////////////////////////// //float sexyStat = Random.Range(-0.1f, 0.1f); float sexyStat = StatsPool.instance.BonusSexAppeal; /* * int chimneyStat = Random.Range(-10, 10); * int plumbryStat = Random.Range(-10, 10); * int kitchenStat = Random.Range(-10, 10); * int boilerStat = Random.Range(-10, 10); */ System.Array statValues = System.Enum.GetValues(typeof(Player.StatType)); int randHouseType = Random.Range(0, 4); Player.StatType houseType = (Player.StatType)statValues.GetValue(randHouseType); //float houseStat = Random.Range(-0.1f, 0.1f); float houseStat = StatsPool.instance.BonusRepair; string repairIconPath = ""; switch (houseType) { case Player.StatType.Boiler: repairIconPath = "RepairIcons/Spr_Heater"; break; case Player.StatType.Kitchen: repairIconPath = "RepairIcons/Spr_Electricity"; break; case Player.StatType.Plumbing: repairIconPath = "RepairIcons/Spr_Tap"; break; case Player.StatType.Chimney: repairIconPath = "RepairIcons/Spr_House"; break; } Debug.Log(houseType); /////////////////////////////////////////////////////////////////////////////////////////// ourCard.SetAllData(name, quote, sexyStat, houseType, houseStat, imagePrefab, repairIconPath); ourCard.transform.SetAsFirstSibling(); ourDeck.Enqueue(ourCard); Vector3 newScale = ourCard.transform.localScale; newScale.x = 0; //DoorCard.transform.SetAsLastSibling(); } return(ourDeck); }