Files
blackhole-escape/Assets/Scripts/Other/MultiCollider.cs
iDunnoDev 3ab4b78a79 Added Accessors for the GameManager to get the Score, Cores and Level values
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
2022-06-30 01:09:48 +01:00

65 lines
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
/// <summary>
/// Class to deal with the other collisions for the core
/// </summary>
public class MultiCollider : ColliderManager
{
public AudioClip corePickupSFX;
public GameObject radiusToken;
public GameObject PlayerOne;
public SphereCollider Cores;
private GameObject areaAround;
public int radiusTick;
// Bool checks if the core has been collected, this is because the ships are made of multiple collision boxes and would trigger more than once.
private bool _tokenCollected = false;
public override void ProcessCollision(CollisionDirection direction, Collision collision, bool wasChild)
{
GameObject collisionGO;
if (wasChild)
{
collisionGO = collision.transform.parent.gameObject;
}
else
{
collisionGO = collision.gameObject;
}
// Check the tag of the collided object, Direction doesnt matter i assume
switch (collisionGO.tag)
{
case "Player":
PickupToken();
break;
}
}
/// <summary>
/// Process the core pick up and destroy the core object.
/// </summary>
public void PickupToken()
{
// If the core has been collected ignore it.
if (!_tokenCollected)
{
Debug.Log("Pick up radius");
_tokenCollected = true;
AudioSource.PlayClipAtPoint(corePickupSFX, transform.position);
Destroy(radiusToken);
while (radiusTick > 0)
{
Cores.radius = 10;
radiusTick -= 1;
}
Destroy(areaAround);
}
}
}