61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public abstract 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 int skillID => GlobalConfig.Instance.Current.skillID;
|
|
public SkillSO[] otherSkills;
|
|
|
|
|
|
private void Start() {
|
|
// foreach (Ally ally in otherSkills)
|
|
// {
|
|
if(PlayerPrefs.GetInt("skill "+ otherSkills[0].skillID) == 1)
|
|
Debug.Log("Work bitch work!");
|
|
// }
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
base.Update();
|
|
if (IsEnemyDetected)
|
|
{
|
|
AttackEnemy();
|
|
}
|
|
|
|
}
|
|
|
|
void AttackEnemy()
|
|
{
|
|
//Attack Cooldown
|
|
if (AttackSpeedWait > AttackInterval)
|
|
{
|
|
|
|
Animation.PlayAttackAnim();
|
|
|
|
AttackSpeedWait = 0f;
|
|
}
|
|
|
|
AttackSpeedWait += Time.deltaTime;
|
|
}
|
|
|
|
public override void LevelStart()
|
|
{
|
|
base.LevelStart();
|
|
ResourceManager.Instance.CurrentPopulation += PopulationCost;
|
|
}
|
|
public override void LevelDestroy()
|
|
{
|
|
base.LevelDestroy();
|
|
ResourceManager.Instance.CurrentPopulation -= PopulationCost;
|
|
}
|
|
|
|
|
|
} |