Felix Boucher 0aa3327433 appliquer global config aux différents endroits
PROBLÈME :

la config existait mais n'était pas appliquée nulle part

SOLUTION :

maintenant elle l'est

NOTES :

Elle n'est pas encore appliquée au flash de dégat
2023-08-05 15:55:54 -04:00

41 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Root : MonoBehaviour
{
[SerializeField]
private Entity _entity;
[SerializeField]
private GameObject _projectile;
[SerializeField]
private Transform _projectileSpawn;
void Attack() {
_entity.Enemy.Hit(_entity.AttackDamage);
if(_entity.Enemy.Hp <= 0) {
_entity.Enemy.Death();
_entity.IsEnemyDetected = false;
}
}
void ShotProjectile() {
Rigidbody2D _rigidbodyAlly;
Rigidbody2D _rigidbodyOpponent;
_rigidbodyAlly = _entity.GetComponent<Rigidbody2D>();
_rigidbodyOpponent = _entity.Enemy.GetComponent<Rigidbody2D>();
Vector3 spawnPos = (_projectileSpawn == null) ? _rigidbodyAlly.position : _projectileSpawn.position;
GameObject _newArrow = Instantiate(_projectile, spawnPos, Quaternion.identity);
//Warning : the Speed of the arrow is equal to the speed of this unit, if this unit need to move, use an other variable !
_newArrow.GetComponent<Projectile>().Damage = _entity.AttackDamage;
_newArrow.GetComponent<Projectile>().EnemySpeed = _entity.Enemy.Speed;
_newArrow.GetComponent<Projectile>().VectorStart = _rigidbodyAlly.position;
_newArrow.GetComponent<Projectile>().VectorEnd = _rigidbodyOpponent.position;
_newArrow.GetComponent<Projectile>().Target = _entity.Enemy;
}
}