// Use this for initialization void Start() { Init(); CurrentHealth = MaxHealth; actionTick = new ActionTick(DamageTick); }
// Update is called once per frame void Update() { //New Wave starts if (waveActionTick != null && waveActionTick.IsAction()) { waveDurationActionTick = new ActionTick(WaveDuration, false); spawnEnemyActionTick = new ActionTick(1000, true); waveDurationActionTick.IsAction(); //First call starts thread waveActionTick = null; WaveDisplay.Find("Text").GetComponent <Text>().text = "Wave " + Wave + " starts ..."; WaveDisplay.gameObject.SetActive(true); } //Disable wave display after 3 seconds if (waveDurationActionTick != null && waveDurationActionTick.TimeToNextTick < WaveDuration - 3000 && WaveDisplay.gameObject.activeInHierarchy) { WaveDisplay.gameObject.SetActive(false); } //Execute enemy spawning during wave if (waveDurationActionTick != null && spawnEnemyActionTick != null && waveDurationActionTick.IsRunning() && spawnEnemyActionTick.IsAction()) { System.Random r = new System.Random(); spawnEnemyActionTick = new ActionTick(r.Next(4000, 8000), false); SpawnEnemy(r.Next(0, 5)); } //Wave ends if (waveDurationActionTick != null && !waveDurationActionTick.IsRunning()) { spawnEnemyActionTick = null; waveDurationActionTick = null; waveActionTick = new ActionTick(WaveTick, false); } //Displaying wave status if (waveActionTick != null && waveActionTick.TimeToNextTick < 30000 && waveActionTick.TimeToNextTick > 27000 && !WaveDisplay.gameObject.activeInHierarchy) { WaveDisplay.Find("Text").GetComponent <Text>().text = "Next Wave in 30 seconds"; WaveDisplay.gameObject.SetActive(true); } else if (waveActionTick != null && waveActionTick.TimeToNextTick < 27000) { WaveDisplay.gameObject.SetActive(false); } }
// Use this for initialization void Start() { maxHealth = BaseMaxHealth; shootTick = BaseShootTick; repairTick = BaseRepairTick; resourceTick = BaseResourceTick; damage = BaseDamage; currentHealth = maxHealth; Init(); resourceActionTick = new ActionTick(resourceTick); repairActionTick = new ActionTick(repairTick); shootActionTick = new ActionTick(shootTick); Resources = new Resource(StartStones, StartAmmo, transform); animator = transform.GetComponent <Animator>(); }
public void UpdateResourceSpeed() { resourceTick = BaseResourceTick - (int)(BaseResourceTick * PlayerPropertys.ResourceSpeedLevel * PlayerPropertys.ResourceSpeedPercentage); resourceActionTick = new ActionTick(resourceTick); }
public void UpdateRepairSpeed() { repairTick = BaseRepairTick - (int)(BaseRepairTick * PlayerPropertys.RepairSpeedLevel * PlayerPropertys.RepairSpeedPercentage); repairActionTick = new ActionTick(shootTick); }
public void UpdateFireRate() { shootTick = BaseShootTick - (int)(BaseShootTick * PlayerPropertys.FireRateLevel * PlayerPropertys.FireRatePercentage); shootActionTick = new ActionTick(shootTick); }
internal void on_ActionTick(Pawn ControlledPawn, float DeltaSeconds) => ActionTick?.Invoke(ControlledPawn, DeltaSeconds);
// Use this for initialization void Start() { waveActionTick = new ActionTick(WaveTick, false); }
void Awake() { Instances.Clear(); Instances.Add(this); tick = new ActionTick(1000); }