public void TypeLetter(char letter) { ActiveWord.TypeLetter(letter); if (ActiveWord.IsWordTyped()) { Debug.Log("Player attack"); playerInBattle.GetComponent <PlayerInBattle>().attack(enemy); enemyHealth.text = enemy.GetComponent <EnemyInBattle>().health + "/" + maxEnemyHealth; if (enemy.GetComponent <EnemyInBattle>().health <= 0) { //Invoke the Restart function to start the next level with a delay of restartLevelDelay (default 1 second). Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!! VICTORY"); Text foodText = GameObject.FindGameObjectWithTag("FoodText").GetComponent <Text>(); headline.text = "Victory!"; Invoke("Exit", exitDelay); } else { WordLevel wordLevel = EmotionMenager.GetInstance().WordLevelDifficulty(); ActiveWord = new WordToType(WordsRepository.GetRandomWord(wordLevel), WordSpawner.SpawnWord()); } // GameManager.instance.loadMainScene(); } }
public WordDTO Get() { var identity = HttpContext.User.Identity as ClaimsIdentity; var id = identity.FindFirst(ClaimTypes.Name).Value; //dekoduje id usera z tokena if (identity == null) { Response.StatusCode = 404; return(null); } int ID = int.Parse(id); var response = WordsRepository.GetRandomWord(ID); //id usera return(response); }
// Use this for initialization when manager is enabled with "setActive" void OnEnable() { Debug.Log("OnEnabled BattleManager"); // Prevent to init on very first start of the game if (GameManager.instance != null && GameManager.instance.isBattle) { WordsRepository = XmlManager.Deserialize <WordsRepository>(); WordLevel wordLevel = EmotionMenager.GetInstance().WordLevelDifficulty(); ActiveWord = new WordToType(WordsRepository.GetRandomWord(wordLevel), WordSpawner.SpawnWord()); // get random enemy from prefabs Debug.Log("Init enemy:"); EnemyType enemyType = getEnemyType(); Debug.Log(enemyType); if (enemyType.Equals(EnemyType.Wolf)) { Debug.Log("Loading Wolf."); enemy = Instantiate(Resources.Load("Prefabs/WolfBattle", typeof(GameObject)), enemyPosition.position, Quaternion.identity) as GameObject; } else if (enemyType.Equals(EnemyType.Zombie)) { Debug.Log("Loading Zombie."); enemy = Instantiate(Resources.Load("Prefabs/Zombie1Battle", typeof(GameObject)), enemyPosition.position, Quaternion.identity) as GameObject; } Debug.Log(enemy); // enemy.transform.parent = enemyPosition; //set up player&enemy health text Debug.Log("Player health: "); Debug.Log(playerInBattle.GetComponent <PlayerInBattle>().health); Debug.Log("Enemy health: "); Debug.Log(enemy.GetComponent <EnemyInBattle>().health); maxEnemyHealth = enemy.GetComponent <EnemyInBattle>().health; playerHealth.text = playerInBattle.GetComponent <PlayerInBattle>().health + "/" + Player.maxHealth; enemyHealth.text = enemy.GetComponent <EnemyInBattle>().health + "/" + enemy.GetComponent <EnemyInBattle>().health; headline.text = "Fight!"; } }