Merge in CGD/gather-and-defend from UpgradeIndividuel to main * commit '196740676df3a8b2b1cfa877b0b61dabdda497e0': Permettre 1 à 3 upgrades Suppression debug logs Revert UI Utilisation du UI d'Élia Ajout ScriptableObject pour UnitUpgrades Affichage bouttons interactifs + Suppression dummy gameobjects in Game scene Debuggins Change l'unité par l'upgrade choisi Début lien entre upgradeUI et Unité Rendu UpgradePlacementButton.cs indépendant des héritages de UnitPlacementButtons. Prefab UpgadeButtons, utilisation de EventSystems pour clique sur unités. Tentative d'associer le clique utilisateur à une position sur le jeu
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Ally : Entity
|
|
{
|
|
public override float DamageMultiplier => GlobalConfig.Instance.Current.allyDamageMultiplier;
|
|
public override float AttackSpeedMultiplier => GlobalConfig.Instance.Current.allyAttackSpeedMultiplier;
|
|
public override float HpMultiplier => GlobalConfig.Instance.Current.allyLifeMultiplier;
|
|
public override Vector2 RangeMultiplier => GlobalConfig.Instance.Current.allyRangeMultiplier;
|
|
public override float SpeedMultiplier => GlobalConfig.Instance.Current.allySpeedMultiplier;
|
|
public float PopulationCost => GlobalConfig.Instance.Current.populationCostPerUnit;
|
|
|
|
|
|
public override void Update()
|
|
{
|
|
base.Update();
|
|
if (IsEnemyDetected)
|
|
{
|
|
AttackEnemy();
|
|
}
|
|
|
|
}
|
|
|
|
void AttackEnemy()
|
|
{
|
|
//Attack Cooldown
|
|
if (AttackSpeedWait > AttackInterval)
|
|
{
|
|
|
|
Animation.PlayAttackAnim();
|
|
|
|
AttackSpeedWait = 0f;
|
|
}
|
|
|
|
AttackSpeedWait += Time.deltaTime;
|
|
}
|
|
|
|
public Vector3 GetPosition()
|
|
{
|
|
return transform.position;
|
|
}
|
|
|
|
public override void LevelStart()
|
|
{
|
|
base.LevelStart();
|
|
if(this is not Building) ResourceManager.Instance.CurrentPopulation += PopulationCost;
|
|
}
|
|
public override void LevelDestroy()
|
|
{
|
|
base.LevelDestroy();
|
|
if (this is not Building) ResourceManager.Instance.CurrentPopulation -= PopulationCost;
|
|
}
|
|
}
|