public void PointTypeManager(Tipos.alineacion alin) { Debug.Log("Reviewing type"); switch (alin) { case alineacion.Economico: resourcesSlider.value += 1; Debug.Log("Resources increased"); break; case alineacion.Humanista: //Elige alineacion ministro canChooseMinisterType = true; Debug.Log("Can choose minister type"); break; case alineacion.Patriota: victorySlider.value += 1; canAttack = true; Debug.Log("Victory Increased"); break; default: break; } }
public bool AskVote(Tipos.alineacion alineacionProyecto) { bool descision; if (alineacionProyecto == myAlineacion) { descision = true; } else { descision = RandomBool(); } Debug.LogFormat("Minister {0} with {1} alination voted {2}", ministerName, myAlineacion, descision); if (descision) { sanity -= rateOfSanityLost; } if (descision) { myVote.color = Color.green; } else { myVote.color = Color.red; } Invoke("ResetColor", 3f); return(descision); }
private void setAlination() { int i = Random.Range(0, 3); Debug.Log("For " + ministerName + " is " + i); switch (i) { case 0: myAlineacion = alineacion.Economico; gameObject.GetComponent <Image>().color = Color.green; break; case 1: myAlineacion = alineacion.Humanista; gameObject.GetComponent <Image>().color = Color.blue; break; case 2: myAlineacion = alineacion.Patriota; gameObject.GetComponent <Image>().color = Color.red; break; default: break; } }
void results(Tipos.alineacion alin) //cuenta de votos { yes = no = 0; foreach (GameObject minister in ministerOnLevel) { if (minister.GetComponent <C_Minister>().AskVote(alin)) { yes++; } else { no++; } } }
public void InvokeVoting(GameObject proyect) { FinalVeredict.color = Color.gray; Tipos.alineacion al = proyect.GetComponent <C_Project>().projectAl; results(al); if (yes > no) { FinalVeredict.color = Color.green; canvasVote.color = Color.green; canvasText.text = "Se aprueba"; Debug.Log("Se Aprueba"); PointTypeManager(al); } //Hacer do while else if (yes < no) { FinalVeredict.color = Color.red; canvasVote.color = Color.red; canvasText.text = "Se rechaza"; Debug.Log("Se Rechaza"); } else //Si hay empate se repite la votacion { results(al); if (yes > no) { FinalVeredict.color = Color.green; canvasVote.color = Color.green; canvasText.text = "Se aprueba"; Debug.Log("Se Aprueba"); PointTypeManager(al); } else { canvasVote.color = Color.red; FinalVeredict.color = Color.red; canvasText.text = "Se rechaza"; Debug.Log("Se Rechaza"); } } yes = 0; no = 0; Invoke("ResetColor", 3f); }