Files
blackhole-escape/Assets/Scripts/Other/HiddenValueInt.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

204 lines
4.5 KiB
C#

using System;
using System.Collections.Generic;
public class HiddenValueInt
{
private int _offsetSeed;
private int _newValue;
public HiddenValueInt(int value)
{
Random newRandom = new Random(Environment.TickCount);
_offsetSeed = newRandom.Next(int.MinValue, int.MaxValue);
_newValue = value ^ _offsetSeed;
}
public void ReSeedValue()
{
int tempValue = Value;
Random newRandom = new Random(Environment.TickCount);
_offsetSeed = newRandom.Next(int.MinValue, int.MaxValue);
_newValue = tempValue ^ _offsetSeed;
}
public int Value
{
get
{
return _offsetSeed ^ _newValue;
}
set
{
_newValue = value ^ _offsetSeed;
}
}
public override bool Equals(object obj)
{
return Equals(obj as HiddenValueInt);
}
public bool Equals(HiddenValueInt rhs)
{
if (rhs is null)
{
return false;
}
if (ReferenceEquals(this, rhs))
{
return true;
}
if (GetType() != rhs.GetType())
{
return false;
}
return Equals(rhs.Value);
}
public bool Equals(int rhs)
{
bool result = false;
if (Value == rhs)
{
result = true;
}
return result;
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
public static explicit operator int(HiddenValueInt rhs)
{
return rhs.Value;
}
public static bool operator ==(HiddenValueInt lhs, HiddenValueInt rhs)
{
if (lhs is null)
{
if (rhs is null)
{
return true;
}
return false;
}
return lhs.Equals(rhs);
}
public static bool operator !=(HiddenValueInt lhs, HiddenValueInt rhs)
{
return !(lhs == rhs);
}
public static bool operator ==(HiddenValueInt lhs, int rhs)
{
if (lhs is null)
{
return false;
}
return lhs.Equals(rhs);
}
public static bool operator !=(HiddenValueInt lhs, int rhs)
{
return !(lhs.Value == rhs);
}
public static bool operator ==(int lhs, HiddenValueInt rhs)
{
if (rhs is null)
{
return false;
}
return rhs.Equals(lhs);
}
public static bool operator !=(int lhs, HiddenValueInt rhs)
{
return !(lhs == rhs.Value);
}
public static HiddenValueInt operator +(HiddenValueInt a, HiddenValueInt b)
{
int tempInt = a.Value + b.Value;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator +(HiddenValueInt a, int b)
{
int tempInt = a.Value + b;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator +(int a, HiddenValueInt b)
{
int tempInt = a + b.Value;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator -(HiddenValueInt a, HiddenValueInt b)
{
int tempInt = a.Value - b.Value;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator -(HiddenValueInt a, int b)
{
int tempInt = a.Value - b;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator -(int a, HiddenValueInt b)
{
int tempInt = a - b.Value;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator *(HiddenValueInt a, HiddenValueInt b)
{
int tempInt = a.Value * b.Value;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator *(HiddenValueInt a, int b)
{
int tempInt = a.Value * b;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator *(int a, HiddenValueInt b)
{
int tempInt = a * b.Value;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator /(HiddenValueInt a, HiddenValueInt b)
{
int tempInt = a.Value / b.Value;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator /(HiddenValueInt a, int b)
{
int tempInt = a.Value / b;
return new HiddenValueInt(tempInt);
}
public static HiddenValueInt operator /(int a, HiddenValueInt b)
{
int tempInt = a / b.Value;
return new HiddenValueInt(tempInt);
}
}