void VerificationAmelioration() { //var cb = this.GetComponent<Button>().colors; //foreach (GestionRoom room in Colonie.Instance.ListeGestionRooms) if (m_button != null) { m_room = Colonie.Instance.ListeGestionRooms[Convert.ToInt32(Type)]; var cb = this.GetComponent <Button>().colors; if (m_room.Amelioration > 0 && son.isPlaying == false) { cb.normalColor = C10; //this.transform.GetComponent<Button>().colors = cb; cb.highlightedColor = C11; //this.transform.GetComponent<Button>().colors = cb; cb.pressedColor = C12; this.transform.GetComponent <Button>().colors = cb; } else { cb.normalColor = C20; //this.transform.GetComponent<Button>().colors = cb; cb.highlightedColor = C20; //this.transform.GetComponent<Button>().colors = cb; cb.pressedColor = C20; this.transform.GetComponent <Button>().colors = cb; } } }
void Start() { Inst = this.gameObject.GetComponent <GestionRoom>(); aff = COLONIE.GetComponent <Colonie>(); //boxTexte.SetActive(false); /*if (paroleGaia != null) * { * textParole = paroleGaia.ToString(); * TimeAttente1 = sautLigne; * TimeAttente2 = sautCaractere; * afficheurText.text = ""; * }*/ }
void Update() { GestionRoom orgaRoom = Colonie.Instance.ListeGestionRooms[(int)GameConstants.GestionRoomType.ORGA]; bool collectMatiereOrganique = CurrentTile != null && CurrentTile.matiereOrganique > 0.0f && orgaRoom.Level > 0; if (collectMatiereOrganique) { float collectedValue = Mathf.Clamp(orgaRoom.vitesseAbsorption * Time.deltaTime, 0.0f, Mathf.Min(CurrentTile.matiereOrganique, orgaRoom.MaxCapacity - orgaRoom.GetResourcesf())); orgaRoom.AddResources(collectedValue); CurrentTile.matiereOrganique -= collectedValue; } Ups[(int)GameConstants.GestionRoomType.ORGA].SetActive(collectMatiereOrganique); GestionRoom mineralRoom = Colonie.Instance.ListeGestionRooms[(int)GameConstants.GestionRoomType.MINERAL]; bool collectMineral = CurrentTile != null && CurrentTile.mineral > 0.0f && mineralRoom.Level > 0; if (collectMineral) { float collectedValue = Mathf.Clamp(mineralRoom.vitesseAbsorption * Time.deltaTime, 0.0f, Mathf.Min(CurrentTile.mineral, mineralRoom.MaxCapacity - mineralRoom.GetResourcesf())); mineralRoom.AddResources(collectedValue); CurrentTile.mineral -= collectedValue; } Ups[(int)GameConstants.GestionRoomType.MINERAL].SetActive(collectMineral); GestionRoom metalRoom = Colonie.Instance.ListeGestionRooms[(int)GameConstants.GestionRoomType.METAL]; bool collectMetal = CurrentTile != null && CurrentTile.metal > 0.0f && metalRoom.Level > 0; if (collectMetal) { float collectedValue = Mathf.Clamp(metalRoom.vitesseAbsorption * Time.deltaTime, 0.0f, Mathf.Min(CurrentTile.metal, metalRoom.MaxCapacity - metalRoom.GetResourcesf())); metalRoom.AddResources(collectedValue); CurrentTile.metal -= collectedValue; } Ups[(int)GameConstants.GestionRoomType.METAL].SetActive(collectMetal); GestionRoom chimicRoom = Colonie.Instance.ListeGestionRooms[(int)GameConstants.GestionRoomType.CHIMIC]; bool collectChimique = CurrentTile != null && CurrentTile.chimique > 0.0f && chimicRoom.Level > 0; if (collectChimique) { float collectedValue = Mathf.Clamp(chimicRoom.vitesseAbsorption * Time.deltaTime, 0.0f, Mathf.Min(CurrentTile.chimique, chimicRoom.MaxCapacity - chimicRoom.GetResourcesf())); chimicRoom.AddResources(collectedValue); CurrentTile.chimique -= collectedValue; } Ups[(int)GameConstants.GestionRoomType.CHIMIC].SetActive(collectChimique); GestionRoom petrolRoom = Colonie.Instance.ListeGestionRooms[(int)GameConstants.GestionRoomType.PETROL]; bool collectPetrol = CurrentTile != null && CurrentTile.petrole > 0.0f && petrolRoom.Level > 0; if (collectPetrol) { float collectedValue = Mathf.Clamp(petrolRoom.vitesseAbsorption * Time.deltaTime, 0.0f, Mathf.Min(CurrentTile.petrole, petrolRoom.MaxCapacity - petrolRoom.GetResourcesf())); petrolRoom.AddResources(collectedValue); CurrentTile.petrole -= collectedValue; } Ups[(int)GameConstants.GestionRoomType.PETROL].SetActive(collectPetrol); GestionRoom nuclearRoom = Colonie.Instance.ListeGestionRooms[(int)GameConstants.GestionRoomType.NUCLEAR]; bool collectNuclear = CurrentTile != null && CurrentTile.nucleaire > 0.0f && nuclearRoom.Level > 0; if (collectNuclear) { float collectedValue = Mathf.Clamp(nuclearRoom.vitesseAbsorption * Time.deltaTime, 0.0f, Mathf.Min(CurrentTile.nucleaire, nuclearRoom.MaxCapacity - nuclearRoom.GetResourcesf())); nuclearRoom.AddResources(collectedValue); CurrentTile.nucleaire -= collectedValue; } Ups[(int)GameConstants.GestionRoomType.NUCLEAR].SetActive(collectNuclear); if (EnergyBar != null) { EnergyBar.sizeDelta = new Vector2(EnergyBar.sizeDelta.x, EnergyBarHeight * (Colonie.Instance.energie / Colonie.Instance.energieMax)); } // Attaque/Défense if (CurrentTile && Map.IsAttackable(CurrentTile) && GameOverCoroutine == null) { if (AttackTileCoroutine == null) { AttackTileCoroutine = StartCoroutine(AttackTile()); } } else if (AttackTileCoroutine != null) { StopCoroutine(AttackTileCoroutine); AttackTileCoroutine = null; } if (Colonie.Instance.energie <= 0.0f) { if (GameOverCoroutine == null) { StopAllCoroutines(); GameOverCoroutine = StartCoroutine(GameOver()); } } }