Basic Dodging Enemy Creation #12
@ -104,6 +104,7 @@ MonoBehaviour:
|
|||||||
_attack_damage: 2
|
_attack_damage: 2
|
||||||
_attack_interval: 2
|
_attack_interval: 2
|
||||||
_enemy: {fileID: 0}
|
_enemy: {fileID: 0}
|
||||||
|
dodgePercent: 25
|
||||||
--- !u!114 &5416582167583119277
|
--- !u!114 &5416582167583119277
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -5,10 +5,14 @@ using UnityEngine;
|
|||||||
public class GhostOpponent : Opponent
|
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()
|
public bool dodgedProjectile()
|
||||||
{
|
{
|
||||||
System.Random random = new System.Random();
|
System.Random random = new System.Random();
|
||||||
if(random.Next(0, 99) > 25) return false;
|
if(random.Next(0, 99) > dodgePercent) return false;
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user