51 lines
980 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Castle : Building
{
public float PopulationGiven => GlobalConfig.Instance.Current.populationGivenPerHouse;
public override void Start()
{
base.Start();
}
public override void Update()
{
base.Update();
if (IsEnemyDetected)
{
AttackEnemy();
}
}
public override void LevelStart()
{
ResourceManager.Instance.MaximumPopulation += PopulationGiven * 2;
base.LevelStart();
}
public override void LevelDestroy()
{
ResourceManager.Instance.MaximumPopulation -= PopulationGiven * 2;
base.LevelDestroy();
}
void AttackEnemy()
{
//Attack Cooldown
if (AttackInterval < AttackSpeedWait)
{
Animation.PlayAttackAnim();
AttackSpeedWait = 0f;
}
AttackSpeedWait += Time.deltaTime;
}
}