- added art for house and UI - put population in ResourceManager - create house prefab - added code for adding and removing pop depending on entity - refactor harvesters so they inherit from ally - modify placeholders and buttons so that only units cost population - add events for population and resources changing - add population relative configs to global config - add start resources values to Levels - add debug feature for generating resources for free
50 lines
1.4 KiB
C#
50 lines
1.4 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 override void LevelStart()
|
|
{
|
|
base.LevelStart();
|
|
ResourceManager.Instance.CurrentPopulation += PopulationCost;
|
|
}
|
|
public override void LevelDestroy()
|
|
{
|
|
base.LevelDestroy();
|
|
ResourceManager.Instance.CurrentPopulation -= PopulationCost;
|
|
}
|
|
}
|