Basic Dodging Enemy Creation (#12)
Reviewed-on: #12 Reviewed-by: Ader_Alisma <ader.alisma.1@ens.etsmtl.ca> Co-authored-by: MaximilienBlanchardBizien1 <maximilien.blanchard-bizien.1@ens.etsmtl.ca> Co-committed-by: MaximilienBlanchardBizien1 <maximilien.blanchard-bizien.1@ens.etsmtl.ca>
This commit is contained in:
parent
2538023d8d
commit
4cb859c4a5
@ -103,6 +103,8 @@ MonoBehaviour:
|
||||
_speed: 0.15
|
||||
_attack_damage: 1
|
||||
_attack_interval: 2
|
||||
_enemy: {fileID: 0}
|
||||
OpponentTraits: 00000000
|
||||
--- !u!114 &5416582167583119277
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
1407
Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab
Normal file
1407
Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab.meta
Normal file
7
Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07ebda7671039dc4b9a1d1b4eabb5aa9
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -73,7 +73,13 @@ public class Detection : MonoBehaviour
|
||||
Entity otherEntity = other.gameObject.GetComponent<Entity>();
|
||||
if (otherEntity == _entityLinked)
|
||||
{
|
||||
_entityLinked.Hit(_projectileDamage);
|
||||
GhostOpponent isGhost = EntityLinked.gameObject.GetComponent<GhostOpponent>();
|
||||
if (isGhost != null)
|
||||
{
|
||||
if(!isGhost.dodgedProjectile()) _entityLinked.Hit(_projectileDamage);
|
||||
}
|
||||
else _entityLinked.Hit(_projectileDamage);
|
||||
|
||||
// Kill if no hp
|
||||
if (otherEntity.Hp <= 0)
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = project_name + "/Global Config")]
|
||||
|
||||
18
Assets/Scripts/Opponent/GhostOpponent.cs
Normal file
18
Assets/Scripts/Opponent/GhostOpponent.cs
Normal file
@ -0,0 +1,18 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Opponent/GhostOpponent.cs.meta
Normal file
11
Assets/Scripts/Opponent/GhostOpponent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9accc3bbf43ac664d99f80d0f5302897
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
public class Opponent : Entity
|
||||
@ -42,10 +43,6 @@ public class Opponent : Entity
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AttackEnemy()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user