public void handleDeath() { if (player) { SceneManager.LoadScene("GameOver"); } else if (this is Carriage && id == 1) { SceneManager.LoadScene("GameOver"); } if (this is Wolf && ((Wolf)this).isBoss) { ((Wolf)this).GetDialogController().trueEndGameDialog(); GameObject.Find("VictorySound").GetComponent <AudioSource>().enabled = true; AudioSource[] audios = ((Wolf)this).GetComponents <AudioSource>(); foreach (AudioSource audio in audios) { audio.enabled = false; } } startCountingTime = false; lastTotalCombatTime += combatTotalTime; combatTotalTime = 0; //finishCombat(); combatStatus = CombatStatus.COMBAT_STATUS_CORPSE; setCurrentAnimation("dead"); foreach (Unit unit in unitsInCombatWith) { unit.exitCombatWith(this); } // Desactivamos el icono de target if (gameObject.transform.Find("TargetIndicator")) { gameObject.transform.Find("TargetIndicator").gameObject.SetActive(false); } // Updateamos la matriz de la AI if (this is Carriage) { return; } string enemytype = ""; if (this is Wolf) { enemytype = "wolf"; } else if (this is Bandit) { enemytype = "agressiveBandit"; } PrincessController.updateQMatrix(attackDamage, attackDamage, attackDamage, combatAttackDelay + combatAttackWindow, 0.85f, lastTotalCombatTime, damageDoneToPlayer, damageDoneToCarriage, damageRecevied, enemytype); }
public void SetUp() { mocks = new MockRepository(); repository = mocks.StrictMock <IPrincessRepository>(); controller = new PrincessController(repository); }
public void LoadSavePoint() { //Cargamos los valores de la AI PrincessController.loadAI(PlayerPrefs.GetFloat("QMatrix0"), PlayerPrefs.GetFloat("QMatrix1"), PlayerPrefs.GetInt("Iterations0"), PlayerPrefs.GetInt("Iterations1")); decisionPrincessTrigger.load(true, PlayerPrefs.GetInt("Decision")); ConfigController.phase = PlayerPrefs.GetInt("Phase"); //Character.transform.position = new Vector3(0, 0, 0); //Posicion del personaje Character.SetActive(false); Character.transform.position = new Vector3(PlayerPrefs.GetFloat("PosCharX"), PlayerPrefs.GetFloat("PosCharY"), PlayerPrefs.GetFloat("PosCharZ")); // Debug.LogError("PosCharX " + PlayerPrefs.GetFloat("PosCharX")); // Debug.LogError("PosCharY " + PlayerPrefs.GetFloat("PosCharY")); // Debug.LogError("PosCharZ " + PlayerPrefs.GetFloat("PosCharZ")); Character.SetActive(true); //Posicion de las caravanas for (int i = 0; i < Caravan.Length; i++) { Caravan[i].transform.position = new Vector3(PlayerPrefs.GetFloat("PosCar" + i + "X"), PlayerPrefs.GetFloat("PosCar" + i + "Y"), PlayerPrefs.GetFloat("PosCar" + i + "Z")); Caravan[i].transform.rotation = new Quaternion(PlayerPrefs.GetFloat("RotCar" + i + "X"), PlayerPrefs.GetFloat("RotCar" + i + "Y"), PlayerPrefs.GetFloat("RotCar" + i + "Z"), PlayerPrefs.GetFloat("RotCar" + i + "W")); int health = PlayerPrefs.GetInt("CarriageHealth" + i); Caravan[i].GetComponent <Carriage>().setHealthPoints(health); InterfaceController.dealDamageCarriage(i, 100 - health); if (health <= 0) { Caravan[i].SetActive(false); } else { Caravan[i].GetComponent <NavMeshAgent>().enabled = true; } } //Debug.LogError(PlayerPrefs.GetInt("Phase")); if (PlayerPrefs.GetInt("Phase") == 2) { savepoint2.GetComponent <BoxCollider>().enabled = true; savepoint2.GetComponent <SphereCollider>().enabled = false; } }
private void OnTriggerEnter(Collider other) { if (!other.GetComponent <Carriage>()) { return; } GameObject[] Caravan = GameObject.FindGameObjectsWithTag("carriage"); GameObject[] Player = GameObject.FindGameObjectsWithTag("Player"); Player[0].GetComponent <Player>().hardcoreFinishCombat(); for (int i = 0; i < Caravan.Length; i++) { Caravan[i].GetComponent <Carriage>().hardcoreFinishCombat(); } int decision = 0; if (!loading) { //llamamos a la prinsesa //System.Random rand = new System.Random(); Debug.Log("El total de pistas es " + ConfigController.clueTotal); decision = PrincessController.makeDecision(ConfigController.phase, ConfigController.clueTotal); ConfigController.clueTotal = 0; saveController.SavePoint(ConfigController.phase, decision, PrincessController.Q_Matrix[0], PrincessController.Q_Matrix[1], PrincessController.iterations[0], PrincessController.iterations[1]); //ConfigController.phase++; } else { decision = loadedValue; ConfigController.clueTotal = 0; } // Desactivamos el flag loading = false; ConfigController.phase++; switch (decision) { case 1: if (targetIzq.GetComponent <PhaseTarget>()) { EnemyController.SpawnEnemiesByPath(targetIzq.GetComponent <PhaseTarget>().phase, targetIzq.GetComponent <PhaseTarget>().path); } caravanController.ChangeTarget(targetIzq); princessText = LanguageController.getTextById(4) + "\nQ[0](Lobos)= " + PrincessController.Q_Matrix[0] + "\nQ[1](Bandidos)= " + PrincessController.Q_Matrix[1]; break; default: if (targetDcha.GetComponent <PhaseTarget>()) { EnemyController.SpawnEnemiesByPath(targetDcha.GetComponent <PhaseTarget>().phase, targetDcha.GetComponent <PhaseTarget>().path); } caravanController.ChangeTarget(targetDcha); princessText = LanguageController.getTextById(5) + "\nQ[0](Lobos)= " + PrincessController.Q_Matrix[0] + "\nQ[1](Bandidos)= " + PrincessController.Q_Matrix[1]; break; } dialogController.princessDialogPopUp(princessText); caravanController.StopCaravan(); this.gameObject.SetActive(false); }