Updated Unity Version
Added graphics options and rendering quality level settings Added new movement patterns to the dumb enemy AI Added chance for Coward Enemies to drop a random Added method to correctly reset the game variables on death and win screens Updated the UI to work on different resolutions without breaking Moved Sprites into a sprites folder Fixed issue where score would overflow the int because the multiplier was too high Fixed issue where new lives gained from the score breakpoints were not being calculated correctly Fixed issue where clicking off a menu element then trying to control the menu with the controller did not correctly reselect a menu item Fixed issue where enemies colliding with the outer boundary too much would break the sfx and music (i assume from a buffering issue)
This commit is contained in:
@ -1,13 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CowardEnemyHoverMovement : HoverMovement
|
||||
public class CowardEnemyHoverMovement : CommanderHoverMovement
|
||||
{
|
||||
public GameObject minePrefab;
|
||||
public float mineSpawnChance;
|
||||
public int mineSpawnChance;
|
||||
public float mineSpawnCooldown;
|
||||
private float _mineSpawnTick;
|
||||
private TimerHelper _mineSpawnTick;
|
||||
private bool _canSpawnMine;
|
||||
|
||||
public float mineDropTime;
|
||||
public float mineDropCooldown;
|
||||
private TimerHelper _mineDropTimer;
|
||||
private TimerHelper _mineDropCooldownTimer;
|
||||
private TimerHelper _canMineDropRoll;
|
||||
private bool _mineDropReady;
|
||||
private bool _mineDropping;
|
||||
|
||||
// Game object to track the player GO
|
||||
private GameObject _player;
|
||||
private GameObject _blackHole;
|
||||
@ -33,7 +42,7 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
private float _aiVert;
|
||||
private float _aiHorz;
|
||||
private bool _aiJump;
|
||||
|
||||
|
||||
public float cowerDistance;
|
||||
public float emergencyBoostSpeed;
|
||||
public float emergencyBoostCooldownSpeed;
|
||||
@ -41,11 +50,11 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
public float emergencyBoostCooldown;
|
||||
private bool _emergencyBoosting;
|
||||
private bool _emergencyBoosted;
|
||||
private float _currentEmergencyBoostingTick;
|
||||
private float _currentEmergencyBoosterCooldownTick;
|
||||
private TimerHelper _currentEmergencyBoostingTick;
|
||||
private TimerHelper _currentEmergencyBoosterCooldownTick;
|
||||
|
||||
private float _currentHoldHeight;
|
||||
private float _heightChangeTick;
|
||||
private TimerHelper _heightChangeTick;
|
||||
public float heightChangeInterval;
|
||||
|
||||
protected override void DoAwakeTasks()
|
||||
@ -72,9 +81,21 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
|
||||
_emergencyBoosting = false;
|
||||
_emergencyBoosted = false;
|
||||
_currentEmergencyBoosterCooldownTick = 0.0f;
|
||||
_currentHoldHeight = GetCurrentHeight();
|
||||
_heightChangeTick = 0.0f;
|
||||
_currentEmergencyBoostingTick = new TimerHelper(emergencyBoostTime, false);
|
||||
_currentEmergencyBoosterCooldownTick = new TimerHelper(emergencyBoostCooldown, false);
|
||||
_heightChangeTick = new TimerHelper(heightChangeInterval, false);
|
||||
_mineSpawnTick = new TimerHelper(mineSpawnCooldown, false);
|
||||
|
||||
_mineDropReady = false;
|
||||
_mineDropping = false;
|
||||
_mineDropTimer = new TimerHelper(mineDropTime, false);
|
||||
_mineDropCooldownTimer = new TimerHelper(mineDropCooldown, false);
|
||||
|
||||
_canPartyTypes = new List<EnemyTypeName>();
|
||||
_canPartyTypes.Add(EnemyTypeName.ENEMYDUMB);
|
||||
|
||||
_enemyParty = new List<HoverMovement>();
|
||||
|
||||
BaseOnStart();
|
||||
// Custom start stuff can go here
|
||||
@ -102,13 +123,13 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
|
||||
// Get the Up vector of each gameObject so we can compare its X values rather than the Y
|
||||
Vector3 playerDirection = _player.transform.position - transform.position;
|
||||
|
||||
|
||||
Vector3 playerLocation = Vector3.ProjectOnPlane(_player.transform.position, Vector3.up);
|
||||
Vector3 myLocation = Vector3.ProjectOnPlane(transform.position, Vector3.forward);
|
||||
Vector3 direction = playerLocation - myLocation;
|
||||
Vector3 direction = playerLocation - myLocation;
|
||||
|
||||
float facingPlayer = Vector3.Dot(playerDirection.normalized, transform.forward);
|
||||
|
||||
|
||||
// Added a check to see if the difference is big enough to warrant a turn otherwise they just get stuck turning forever
|
||||
float playerHeight = _player.GetComponent<PlayerHoverMovement>().GetCurrentHeight();
|
||||
|
||||
@ -122,9 +143,9 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
// Try to boost away
|
||||
_emergencyBoosting = true;
|
||||
_canSpawnMine = false;
|
||||
_mineSpawnTick = 0.0f;
|
||||
_mineSpawnTick.RestartTimer();
|
||||
// Force a height change for fun
|
||||
_heightChangeTick = heightChangeInterval;
|
||||
_heightChangeTick.HasTicked(heightChangeInterval);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +161,7 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
if (aboveCheck.rigidbody != null)
|
||||
{
|
||||
if ((GetCurrentHeight() < playerHeight))
|
||||
{
|
||||
{
|
||||
_objectRigidbody.velocity = Vector3.zero;
|
||||
_aiJump = false;
|
||||
}
|
||||
@ -163,8 +184,30 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
if (minePrefab != null)
|
||||
{
|
||||
if (_canSpawnMine && _emergencyBoosting)
|
||||
{
|
||||
DoAMineSpawn();
|
||||
{
|
||||
DoAMineSpawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_emergencyBoosted)
|
||||
{
|
||||
if (_mineDropReady)
|
||||
{
|
||||
int dropChance = Random.Range(0, 100);
|
||||
if (dropChance <= mineSpawnChance)
|
||||
{
|
||||
_mineDropping = true;
|
||||
}
|
||||
_mineDropReady = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_canSpawnMine && _mineDropping)
|
||||
{
|
||||
DoAMineSpawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -280,7 +323,7 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
// Check if the jump button
|
||||
if (_aiJump && !_isJumping)
|
||||
{
|
||||
_isJumping = true;
|
||||
_isJumping = true;
|
||||
}
|
||||
|
||||
// Run any base class stuff
|
||||
@ -315,51 +358,53 @@ public class CowardEnemyHoverMovement : HoverMovement
|
||||
{
|
||||
if (_emergencyBoosting)
|
||||
{
|
||||
if (_currentEmergencyBoostingTick >= emergencyBoostTime)
|
||||
if (_currentEmergencyBoostingTick.HasTicked(currentTimeStep))
|
||||
{
|
||||
_emergencyBoosted = true;
|
||||
_emergencyBoosting = false;
|
||||
_currentEmergencyBoostingTick = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentEmergencyBoostingTick += currentTimeStep;
|
||||
_currentEmergencyBoostingTick.RestartTimer();
|
||||
}
|
||||
}
|
||||
|
||||
if (_emergencyBoosted)
|
||||
{
|
||||
if (_currentEmergencyBoosterCooldownTick >= emergencyBoostCooldown)
|
||||
if (_currentEmergencyBoosterCooldownTick.HasTicked(currentTimeStep))
|
||||
{
|
||||
_emergencyBoosted = false;
|
||||
_currentEmergencyBoosterCooldownTick = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentEmergencyBoosterCooldownTick += currentTimeStep;
|
||||
_currentEmergencyBoosterCooldownTick.RestartTimer();
|
||||
}
|
||||
}
|
||||
|
||||
if (_heightChangeTick >= heightChangeInterval)
|
||||
if (_heightChangeTick.HasTicked(currentTimeStep))
|
||||
{
|
||||
_currentHoldHeight = Random.Range(startHeight, startHeight + 5.0f);
|
||||
_heightChangeTick = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_heightChangeTick += currentTimeStep;
|
||||
_currentHoldHeight = Random.Range(startHeight - 2.0f, startHeight + 3.0f);
|
||||
_heightChangeTick.RestartTimer();
|
||||
}
|
||||
|
||||
if (!_canSpawnMine)
|
||||
{
|
||||
if (_mineSpawnTick >= mineSpawnCooldown)
|
||||
if (_mineSpawnTick.HasTicked(currentTimeStep))
|
||||
{
|
||||
_mineSpawnTick = 0.0f;
|
||||
_mineSpawnTick.RestartTimer();
|
||||
_canSpawnMine = true;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
if (_mineDropping)
|
||||
{
|
||||
if (_mineDropTimer.HasTicked(currentTimeStep))
|
||||
{
|
||||
_mineSpawnTick += currentTimeStep;
|
||||
_mineDropTimer.RestartTimer();
|
||||
_mineDropping = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_mineDropReady && !_mineDropping)
|
||||
{
|
||||
if (_mineDropCooldownTimer.HasTicked(currentTimeStep))
|
||||
{
|
||||
_mineDropCooldownTimer.RestartTimer();
|
||||
_mineDropReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user