gather-and-defend/Assets/Scripts/Opponent/MultiEyedOpponent.cs

19 lines
471 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MultiEyedOpponent : 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;
}
}