private void NextGroupEnemy() { ICPU_ShootingGame CPU = _viewModel.CPU; var random = UnityEngine.Random.value; _cpuAttackTime = CPU.AttackTime + CPU.AttackOffset * random; }
private void NextGuardEnemy() { ICPU_ShootingGame CPU = _viewModel.CPU; var random = UnityEngine.Random.Range(0, 100); if (random < CPU.MissRateGuard) { _cpuAttackTime = 999; } else { var randomTime = UnityEngine.Random.value; _cpuAttackTime = CPU.AttackTime + CPU.AttackOffset * randomTime; _cpuAttackTime /= 2.0f; } }
public ViewModel_ShootingGame(int playerNum = 1, GameDataStore.Level cpuLevel = GameDataStore.Level.Level2) { switch (cpuLevel) { case GameDataStore.Level.Level1: CPU = new CPUEasy(); break; case GameDataStore.Level.Level2: CPU = new CPUNormal(); break; case GameDataStore.Level.Level3: CPU = new CPUHard(); break; } }
private void NextEnemy(IEnemy enemy) { _currentEnemy = enemy; turn = Turn.AppearWait; _enemyTime = enemy.Duration; if (enemy.Type == EnemyType.Group) { NextGroupEnemy(); } else if (enemy.Type == EnemyType.Guard) { NextGuardEnemy(); } else { ICPU_ShootingGame CPU = _viewModel.CPU; var random = UnityEngine.Random.Range(0, 100); int missRate; if (enemy.Type == EnemyType.Danger) { missRate = CPU.MissRateDanger; } else { missRate = CPU.MissRate; } if (random < missRate) { _cpuAttackTime = 999; } else { var randomTime = UnityEngine.Random.value; _cpuAttackTime = CPU.AttackTime + CPU.AttackOffset * randomTime; } } }