Serializé la valeur "DodgePercent" qui détermine la probabilité qu'un ennemie fantôme a d'éviter un projectile.
19 lines
467 B
C#
19 lines
467 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class GhostOpponent : Opponent
|
|
{
|
|
|
|
[SerializeField]
|
|
//Le taux de chance, en pourcantage (un chiffre entre 0 et 99) que l'ennemie a d'eviter un projectile.
|
|
private int dodgePercent;
|
|
|
|
public bool dodgedProjectile()
|
|
{
|
|
System.Random random = new System.Random();
|
|
if(random.Next(0, 99) > dodgePercent) return false;
|
|
else return true;
|
|
}
|
|
}
|