コード例 #1
0
    //玩家行动后延迟
    IEnumerator PlayerOverDelay()
    {
        isWaitForPlayer = false;
        yield return(new WaitForSeconds(1));

        currentTurn = NowTurn.Enemy;
    }
コード例 #2
0
    //敌人回合的行动
    private void EnemyUnitAction()
    {
        enemy.animator.SetTrigger("attack");
        player.animator.SetTrigger("damage");
        int random = Random.Range(0, 9);

        player.ReceiveDamage(player.CauseDamage(random < 5 ? Unit.DamageType.Physics : Unit.DamageType.Magic));
        print("Player: " + player.hp + "\tEnemy: " + enemy.hp);
        currentTurn     = NowTurn.Player;
        isWaitForPlayer = true;
    }
コード例 #3
0
 //重新开始
 private void CallRestart(int id)
 {
     if (GUI.Button(new Rect(50, 30, 100, 20), "Restart"))
     {
         currentGameState = GameState.Game;
         currentTurn      = NowTurn.Player;
         isWaitForPlayer  = true;
         enemy.animator.SetTrigger("wait");
         player.animator.SetTrigger("wait");
     }
 }
コード例 #4
0
 private void Update()
 {
     //有单位无生命值则游戏结束
     if (player.hp <= 0)
     {
         player.animator.SetTrigger("dead");
         RoundControl.currentGameState = RoundControl.GameState.Over;
         RoundControl.currentTurn      = RoundControl.NowTurn.Player;
         player.ResetAttribute();
         enemy.ResetAttribute();
     }
     if (enemy.hp <= 0)
     {
         enemy.animator.SetTrigger("dead");
         RoundControl.currentGameState = RoundControl.GameState.Over;
         RoundControl.currentTurn      = RoundControl.NowTurn.Player;
         player.ResetAttribute();
         enemy.ResetAttribute();
     }
 }