Implémenté mécanique d'esquive de base

Implémenté la mécanique pour que l'ennemi fantôme puisse esquiver les projectiles. Cette implémentation devra être testé.
This commit is contained in:
MaximilienBlanchardBizien1 2025-06-26 09:54:07 -04:00
parent 921449fc1d
commit db0197828c
6 changed files with 1456 additions and 5 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 07ebda7671039dc4b9a1d1b4eabb5aa9
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -56,7 +56,13 @@ public class Detection : MonoBehaviour
Entity otherEntity = other.gameObject.GetComponent<Entity>();
if (otherEntity == _entityLinked)
{
_entityLinked.Hit(_projectileDamage);
if (EntityLinked.gameObject.GetComponent<GhostOpponent>() != null)
{
System.Random random = new System.Random();
if(random.Next(0, 99) > 25) _entityLinked.Hit(_projectileDamage);
}
else _entityLinked.Hit(_projectileDamage);
// Kill if no hp
if (otherEntity.Hp <= 0)
{

View File

@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using System.Transactions;
using UnityEngine;
public class GhostOpponent : Opponent
{
//new public void Hit(int damage)
//{
// Hp -= damage;
// _lifeBar.value = _hp / (float)_maxHp;
// _shaderGUItext = Shader.Find("GUI/Text Shader");
// _shaderSpritesDefault = Shader.Find("Sprites/Default");
// foreach (SpriteRenderer renderer in _spriteRenderers)
// {
// renderer.material.shader = _shaderGUItext;
// }
// Invoke("ReturnNormalColor", 0.1f);
//}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee7ccf7939877ae47a9ed9f555ea458e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -42,10 +42,6 @@ public class Opponent : Entity
Move();
}
}
void AttackEnemy()