
Added a Score to the Game Added an actual blackhole material and shader to the black hole Added a new Main menu and How to Play menu system Added Beam swords to all ships (replacing the light saber things the player had) Added a pause menu Overhauled the UI for the game scene Added List to hold the amount of core energy needed for each level Added the URP package for better rendering (apparently) Added a GameState enum to set which part of the game the player is in Added Magnet powerup to game Changed the way powerups are spawned, enemies now have a loot table Changed cores to core energy which is a percentage needed to pass a level Changed all the Ints to Hidden Value ints to maybe stop cheat engine users finding the important values Changed all level loads to use sceneloadasync Updated all of the materials to use URP shaders Removed Junk Files from external sources Rearranged the folders inside the unity project to try and reduce some name length issues
95 lines
2.5 KiB
C#
95 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MagnetEmbedPowerUpEffect : PowerUpEffect
|
|
{
|
|
private GameObject _player;
|
|
private PlayerObjectShared _playerObjectShared;
|
|
|
|
public float magnetPowerForce;
|
|
public float magnetPowerRange;
|
|
|
|
public float magnetPowerCooldown;
|
|
private bool _magnetPowerCooldown;
|
|
private TimerHelper _magnetPowerCooldownTimer;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
_player = GameEngine.mainPlayer;
|
|
_playerObjectShared = _player.GetComponent<PlayerObjectShared>();
|
|
_magnetPowerCooldown = false;
|
|
_magnetPowerCooldownTimer = new TimerHelper(magnetPowerCooldown, false);
|
|
}
|
|
|
|
public override void OnPickUp()
|
|
{
|
|
}
|
|
|
|
public override void ApplyEffect()
|
|
{
|
|
}
|
|
|
|
public override bool OnUseEffect()
|
|
{
|
|
if (!_magnetPowerCooldown)
|
|
{
|
|
foreach (BlackHoleForce currentBHF in BlackHoleManager.blackHoleForceObjects)
|
|
{
|
|
GameObject currentObject = currentBHF.gameObject;
|
|
if (currentObject.tag != "Player")
|
|
{
|
|
Vector3 directionToObject = gameObject.transform.position - currentObject.transform.position;
|
|
float distanceToObject = directionToObject.magnitude;
|
|
if (distanceToObject <= magnetPowerRange)
|
|
{
|
|
Rigidbody currentRigidBody = currentObject.GetComponent<Rigidbody>();
|
|
if (currentRigidBody != null)
|
|
{
|
|
currentRigidBody.AddForce(directionToObject * magnetPowerForce, ForceMode.VelocityChange);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
_magnetPowerCooldown = true;
|
|
_magnetPowerCooldownTimer.RestartTimer();
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public override float CooldownStatus()
|
|
{
|
|
return _magnetPowerCooldownTimer.Position;
|
|
}
|
|
|
|
public override bool PowerUpReady()
|
|
{
|
|
if (_magnetPowerCooldown)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (_magnetPowerCooldown)
|
|
{
|
|
if (_magnetPowerCooldownTimer.HasTicked(Time.deltaTime))
|
|
{
|
|
_magnetPowerCooldown = false;
|
|
}
|
|
}
|
|
}
|
|
}
|