Initial commit to master of build #164 from 05/17/2020.

This commit is contained in:
Droog71 2020-07-19 21:36:57 -04:00
parent 4c508a5e4a
commit d9897c90cc
132 changed files with 39268 additions and 0 deletions

51
AirLock.cs Normal file
View File

@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AirLock : MonoBehaviour
{
public string ID = "unassigned";
public int address;
private float updateTick;
public bool open;
public GameObject openObject;
public GameObject closedObject;
public GameObject effects;
void Start()
{
if (QualitySettings.GetQualityLevel() < 3)
{
effects.SetActive(false);
}
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Physics update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
}
}
public void ToggleOpen()
{
if (open == false)
{
openObject.SetActive(true);
closedObject.SetActive(false);
GetComponent<Collider>().isTrigger = true;
open = true;
}
else
{
openObject.SetActive(false);
closedObject.SetActive(true);
GetComponent<Collider>().isTrigger = false;
open = false;
}
}
}

11
AirLock.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 15e79c6e5c1b462669baefa0416a8909
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

327
AlloySmelter.cs Normal file
View File

@ -0,0 +1,327 @@
using UnityEngine;
using System.Collections;
public class AlloySmelter : MonoBehaviour
{
public int speed = 1;
public int power;
public int heat;
public int cooling;
public bool hasHeatExchanger;
public float amount;
public float amount2;
public float outputAmount;
public string inputType1;
public string inputType2;
public string outputType;
public string ID = "unassigned";
public string inputID1;
public string inputID2;
public string outputID;
public GameObject fireObject;
public bool powerON;
public string creationMethod;
public GameObject inputObject1;
public GameObject inputObject2;
public GameObject outputObject;
public GameObject powerObject;
public GameObject conduitItem;
public Material lineMat;
LineRenderer connectionLine;
private float updateTick;
public int address;
private int machineTimer;
public int connectionAttempts;
public bool connectionFailed;
private GameObject builtObjects;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (speed > 1)
{
heat = speed - 1 - cooling;
}
else
{
heat = 0;
}
if (heat < 0)
{
heat = 0;
}
if (GetComponent<AudioSource>().isPlaying == false)
{
fireObject.SetActive(false);
}
if (inputObject1 == null || inputObject2 == null || outputObject == null)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<UniversalConduit>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (outputObject == null)
{
if (inputObject1 != null && inputObject2 != null)
{
if (obj != inputObject1 && obj != inputObject2 && obj != this.gameObject)
{
if (obj.GetComponent<UniversalConduit>().inputObject == null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<UniversalConduit>().ID + " vs " + outputID);
if (obj.GetComponent<UniversalConduit>().ID.Equals(outputID))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
else if (creationMethod.Equals("built"))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
if (inputObject1 != null && inputObject2 != null)
{
if (inputObject1.GetComponent<UniversalConduit>() != null && inputObject2.GetComponent<UniversalConduit>() != null)
{
if (amount < 1)
{
inputType1 = inputObject1.GetComponent<UniversalConduit>().type;
}
if (amount2 < 1)
{
inputType2 = inputObject2.GetComponent<UniversalConduit>().type;
}
//Debug.Log(ID + " receiving: " + inputObject1.GetComponent<UniversalConduit>().type + " and " + inputObject2.GetComponent<UniversalConduit>().type);
if (inputObject1.GetComponent<UniversalConduit>().type.Equals("Copper Ingot") && inputObject2.GetComponent<UniversalConduit>().type.Equals("Tin Ingot"))
{
outputType = "Bronze Ingot";
if (amount >= speed && amount2 >= speed)
{
if (powerON == true && connectionFailed == false && speed > 0)
{
outputAmount += speed - heat;
amount -= speed - heat;
amount2 -= speed - heat;
fireObject.SetActive(true);
GetComponent<AudioSource>().enabled = true;
}
else
{
fireObject.SetActive(false);
GetComponent<AudioSource>().enabled = false;
}
//Debug.Log(ID + " output: " + outputType);
}
}
else if (inputObject1.GetComponent<UniversalConduit>().type.Equals("Tin Ingot") && inputObject2.GetComponent<UniversalConduit>().type.Equals("Copper Ingot"))
{
outputType = "Bronze Ingot";
if (amount >= speed && amount2 >= speed)
{
if (powerON == true && connectionFailed == false && speed > 0)
{
outputAmount += speed - heat;
amount -= speed - heat;
amount2 -= speed - heat;
fireObject.SetActive(true);
GetComponent<AudioSource>().enabled = true;
}
else
{
fireObject.SetActive(false);
GetComponent<AudioSource>().enabled = false;
}
//Debug.Log(ID + " output: " + outputType);
}
}
else if (inputObject1.GetComponent<UniversalConduit>().type.Equals("Iron Ingot") && inputObject2.GetComponent<UniversalConduit>().type.Equals("Coal"))
{
outputType = "Steel Ingot";
if (amount >= speed && amount2 >= speed)
{
if (powerON == true && connectionFailed == false && speed > 0)
{
outputAmount += speed - heat;
amount -= speed - heat;
amount2 -= speed - heat;
fireObject.SetActive(true);
GetComponent<AudioSource>().enabled = true;
}
else
{
fireObject.SetActive(false);
GetComponent<AudioSource>().enabled = false;
}
//Debug.Log(ID + " output: " + outputType);
}
}
else if (inputObject1.GetComponent<UniversalConduit>().type.Equals("Coal") && inputObject2.GetComponent<UniversalConduit>().type.Equals("Iron Ingot"))
{
outputType = "Steel Ingot";
if (amount >= speed && amount2 >= speed)
{
if (powerON == true && connectionFailed == false && speed > 0)
{
outputAmount += speed - heat;
amount -= speed - heat;
amount2 -= speed - heat;
fireObject.SetActive(true);
GetComponent<AudioSource>().enabled = true;
}
else
{
fireObject.SetActive(false);
GetComponent<AudioSource>().enabled = false;
}
//Debug.Log(ID + " output: " + outputType);
}
}
if (inputObject1.GetComponent<UniversalConduit>().conduitItem.GetComponent<ConduitItem>().active == false)
{
conduitItem.GetComponent<ConduitItem>().active = false;
}
if (inputObject2.GetComponent<UniversalConduit>().conduitItem.GetComponent<ConduitItem>().active == false)
{
conduitItem.GetComponent<ConduitItem>().active = false;
}
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
}
if (outputObject != null)
{
if (outputObject.GetComponent<UniversalConduit>() != null)
{
outputObject.GetComponent<UniversalConduit>().inputID = ID;
outputObject.GetComponent<UniversalConduit>().type = outputType;
outputObject.GetComponent<UniversalConduit>().speed = speed;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
outputID = outputObject.GetComponent<UniversalConduit>().ID;
if (outputAmount >= speed)
{
if (outputType.Equals(outputObject.GetComponent<UniversalConduit>().type))
{
if (powerON == true && connectionFailed == false && inputObject1 != null && inputObject2 != null && speed > 0)
{
conduitItem.GetComponent<ConduitItem>().active = true;
if (GetComponent<AudioSource>().isPlaying == false)
{
GetComponent<AudioSource>().Play();
fireObject.SetActive(true);
}
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
outputObject.GetComponent<UniversalConduit>().amount += speed - heat;
outputAmount -= speed;
machineTimer = 0;
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
machineTimer = 0;
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
}
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
connectionLine.enabled = false;
if (connectionFailed == true)
{
if (creationMethod.Equals("spawned"))
{
creationMethod = "built";
}
}
}
if (inputObject1 != null && inputObject2 != null && outputObject != null)
{
connectionAttempts = 0;
}
}
}
}

11
AlloySmelter.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e5423291ddb109e04ae5acb0c765561f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

91
Auger.cs Normal file
View File

@ -0,0 +1,91 @@
using UnityEngine;
using System.Collections;
public class Auger : MonoBehaviour
{
public float amount;
public int speed = 1;
public int power;
public bool hasHeatExchanger;
public int heat;
public int cooling;
public GameObject outputObject;
public GameObject powerObject;
public GameObject conduitItem;
public Material lineMat;
public string ID = "unassigned";
public string creationMethod;
LineRenderer connectionLine;
private float updateTick;
public int address;
public bool powerON;
private int machineTimer;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
}
void OnDestroy()
{
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (speed > 1)
{
heat = speed - 1 - cooling;
}
else
{
heat = 0;
}
if (heat < 0)
{
heat = 0;
}
if (outputObject != null)
{
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, outputObject.transform.position);
connectionLine.enabled = true;
}
else
{
connectionLine.enabled = false;
}
if (powerON == true && speed > 0)
{
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
amount += speed - heat;
machineTimer = 0;
}
}
else
{
machineTimer = 0;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
}
}

11
Auger.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0a0bdfb4bf544033991daec8fe02302a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

23
AugerBlade.cs Normal file
View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AugerBlade : MonoBehaviour
{
public GameObject auger;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (auger.GetComponent<AudioSource>().enabled == true)
{
transform.Rotate(-Vector3.forward * 600 * Time.deltaTime);
}
}
}

11
AugerBlade.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bc977ef3030ccc9498a0c7d90af89256
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

581
AutoCrafter.cs Normal file
View File

@ -0,0 +1,581 @@
using UnityEngine;
using System.Collections;
public class AutoCrafter : MonoBehaviour
{
public int speed = 1;
public int power;
public int heat;
public int cooling;
public bool powerON;
public string type;
public string ID = "unassigned";
public string inputID;
public string creationMethod;
public GameObject inputObject;
public GameObject powerObject;
public GameObject conduitItem;
public Material lineMat;
LineRenderer connectionLine;
private float updateTick;
public int address;
public bool hasHeatExchanger;
private MachineCrafting machineCrafting;
private ComputerCrafting computerCrafting;
private int machineTimer;
public int connectionAttempts;
public bool connectionFailed;
public GameObject storageComputerConduitItemObject;
private GameObject builtObjects;
void Start()
{
machineCrafting = GetComponent<MachineCrafting>();
computerCrafting = GetComponent<ComputerCrafting>();
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (speed > 1)
{
heat = speed - 1 - cooling;
}
else
{
heat = 0;
}
if (heat < 0)
{
heat = 0;
}
GetComponent<InventoryManager>().ID = ID;
bool foundType = false;
foreach (InventorySlot slot in GetComponent<InventoryManager>().inventory)
{
if (foundType == false)
{
if (slot.amountInSlot > 0)
{
foundType = true;
type = slot.typeInSlot;
}
}
}
if (inputObject == null)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<InventoryManager>() != null && !obj.GetComponent<InventoryManager>().ID.Equals("player") && obj.GetComponent<Retriever>() == null && obj.GetComponent<Rocket>() == null && obj.GetComponent<AutoCrafter>() == null && obj != this.gameObject)
{
if (inputObject == null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<InventoryManager>().ID + " vs " + outputID);
if (obj.GetComponent<InventoryManager>().ID.Equals(inputID))
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20 || obj.GetComponent<RailCart>() != null)
{
inputObject = obj;
if (obj.GetComponent<RailCart>() != null)
{
inputID = obj.GetComponent<RailCart>().ID;
}
else
{
inputID = obj.GetComponent<InventoryManager>().ID;
}
machineCrafting.inventoryManager = obj.GetComponent<InventoryManager>();
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
inputObject = obj;
inputID = obj.GetComponent<InventoryManager>().ID;
machineCrafting.inventoryManager = obj.GetComponent<InventoryManager>();
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
if (obj.GetComponent<StorageComputer>() != null)
{
if (inputObject == null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<InventoryManager>().ID + " vs " + outputID);
if (obj.GetComponent<StorageComputer>().ID.Equals(inputID))
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
inputObject = obj;
inputID = obj.GetComponent<StorageComputer>().ID;
computerCrafting.computerManager = obj.GetComponent<StorageComputer>().computerContainers;
computerCrafting.conduitItem = inputObject.GetComponent<StorageComputer>().conduitItem.GetComponent<ConduitItem>();
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
inputObject = obj;
inputID = obj.GetComponent<StorageComputer>().ID;
computerCrafting.computerManager = obj.GetComponent<StorageComputer>().computerContainers;
computerCrafting.conduitItem = inputObject.GetComponent<StorageComputer>().conduitItem.GetComponent<ConduitItem>();
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
}
}
}
}
if (connectionFailed == false)
{
if (inputObject != null)
{
float distance = Vector3.Distance(transform.position, inputObject.transform.position);
if (distance < 20)
{
if (powerON == true && speed > 0 && type != "" && type != "nothing")
{
if (inputObject.GetComponent<InventoryManager>() != null)
{
if (inputObject.GetComponent<RailCart>() != null)
{
inputID = inputObject.GetComponent<RailCart>().ID;
}
else
{
inputID = inputObject.GetComponent<InventoryManager>().ID;
}
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
if (GetComponent<AudioSource>().isPlaying == false)
{
GetComponent<AudioSource>().Play();
}
connectionLine.enabled = true;
connectionLine.SetPosition(1, inputObject.transform.position);
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
for (int count = 0; count < speed; count++)
{
if (type.Equals("Iron Block"))
{
machineCrafting.CraftIronBlock();
}
if (type.Equals("Iron Ramp"))
{
machineCrafting.CraftIronRamp();
}
if (type.Equals("Steel Block"))
{
machineCrafting.CraftSteelBlock();
}
if (type.Equals("Steel Ramp"))
{
machineCrafting.CraftSteelRamp();
}
if (type.Equals("Circuit Board"))
{
machineCrafting.CraftCircuitBoard();
}
if (type.Equals("Electric Motor"))
{
machineCrafting.CraftMotor();
}
if (type.Equals("Quantum Hatchway"))
{
machineCrafting.CraftQuantumHatchway();
}
if (type.Equals("Electric Light"))
{
machineCrafting.CraftElectricLight();
}
if (type.Equals("Auger"))
{
machineCrafting.CraftAuger();
}
if (type.Equals("Storage Container"))
{
machineCrafting.CraftStorageContainer();
}
if (type.Equals("Storage Computer"))
{
machineCrafting.CraftStorageComputer();
}
if (type.Equals("Extruder"))
{
machineCrafting.CraftExtruder();
}
if (type.Equals("Press"))
{
machineCrafting.CraftPress();
}
if (type.Equals("Universal Extractor"))
{
machineCrafting.CraftUniversalExtractor();
}
if (type.Equals("Universal Conduit"))
{
machineCrafting.CraftUniversalConduit();
}
if (type.Equals("Retriever"))
{
machineCrafting.CraftRetriever();
}
if (type.Equals("Solar Panel"))
{
machineCrafting.CraftSolarPanel();
}
if (type.Equals("Generator"))
{
machineCrafting.CraftGenerator();
}
if (type.Equals("Power Conduit"))
{
machineCrafting.CraftPowerConduit();
}
if (type.Equals("Nuclear Reactor"))
{
machineCrafting.CraftNuclearReactor();
}
if (type.Equals("Reactor Turbine"))
{
machineCrafting.CraftReactorTurbine();
}
if (type.Equals("Heat Exchanger"))
{
machineCrafting.CraftHeatExchanger();
}
if (type.Equals("Smelter"))
{
machineCrafting.CraftSmelter();
}
if (type.Equals("Gear Cutter"))
{
machineCrafting.CraftGearCutter();
}
if (type.Equals("Alloy Smelter"))
{
machineCrafting.CraftAlloySmelter();
}
if (type.Equals("Turret"))
{
machineCrafting.CraftTurret();
}
if (type.Equals("DM Collector"))
{
machineCrafting.CraftDarkMatterCollector();
}
if (type.Equals("DM Conduit"))
{
machineCrafting.CraftDarkMatterConduit();
}
if (type.Equals("Auto Crafter"))
{
machineCrafting.CraftAutoCrafter();
}
if (type.Equals("Rail Cart Hub"))
{
machineCrafting.CraftRailCartHub();
}
if (type.Equals("Rail Cart"))
{
machineCrafting.CraftRailCart();
}
}
machineTimer = 0;
}
}
if (inputObject.GetComponent<StorageComputer>() != null)
{
inputID = inputObject.GetComponent<StorageComputer>().ID;
if (inputObject.GetComponent<StorageComputer>().initialized == true)
{
computerCrafting.computerManager = inputObject.GetComponent<StorageComputer>().computerContainers;
if (computerCrafting.conduitItem == null)
{
GameObject storageComputerItemObject = Instantiate(storageComputerConduitItemObject, inputObject.transform.position, inputObject.transform.rotation);
storageComputerItemObject.transform.parent = inputObject.transform;
computerCrafting.conduitItem = storageComputerItemObject.GetComponent<ConduitItem>();
}
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
if (GetComponent<AudioSource>().isPlaying == false)
{
GetComponent<AudioSource>().Play();
}
connectionLine.enabled = true;
connectionLine.SetPosition(1, inputObject.transform.position);
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
for (int count = 0; count < speed; count++)
{
if (type.Equals("Iron Block"))
{
computerCrafting.CraftIronBlock();
}
if (type.Equals("Iron Ramp"))
{
computerCrafting.CraftIronRamp();
}
if (type.Equals("Steel Block"))
{
computerCrafting.CraftSteelBlock();
}
if (type.Equals("Steel Ramp"))
{
computerCrafting.CraftSteelRamp();
}
if (type.Equals("Circuit Board"))
{
computerCrafting.CraftCircuitBoard();
}
if (type.Equals("Electric Motor"))
{
computerCrafting.CraftMotor();
}
if (type.Equals("Quantum Hatchway"))
{
computerCrafting.CraftQuantumHatchway();
}
if (type.Equals("Electric Light"))
{
computerCrafting.CraftElectricLight();
}
if (type.Equals("Auger"))
{
computerCrafting.CraftAuger();
}
if (type.Equals("Storage Container"))
{
computerCrafting.CraftStorageContainer();
}
if (type.Equals("Storage Computer"))
{
computerCrafting.CraftStorageComputer();
}
if (type.Equals("Extruder"))
{
computerCrafting.CraftExtruder();
}
if (type.Equals("Press"))
{
computerCrafting.CraftPress();
}
if (type.Equals("Universal Extractor"))
{
computerCrafting.CraftUniversalExtractor();
}
if (type.Equals("Universal Conduit"))
{
computerCrafting.CraftUniversalConduit();
}
if (type.Equals("Retriever"))
{
computerCrafting.CraftRetriever();
}
if (type.Equals("Solar Panel"))
{
computerCrafting.CraftSolarPanel();
}
if (type.Equals("Generator"))
{
computerCrafting.CraftGenerator();
}
if (type.Equals("Power Conduit"))
{
computerCrafting.CraftPowerConduit();
}
if (type.Equals("Nuclear Reactor"))
{
computerCrafting.CraftNuclearReactor();
}
if (type.Equals("Reactor Turbine"))
{
computerCrafting.CraftReactorTurbine();
}
if (type.Equals("Heat Exchanger"))
{
computerCrafting.CraftHeatExchanger();
}
if (type.Equals("Smelter"))
{
computerCrafting.CraftSmelter();
}
if (type.Equals("Gear Cutter"))
{
computerCrafting.CraftGearCutter();
}
if (type.Equals("Alloy Smelter"))
{
computerCrafting.CraftAlloySmelter();
}
if (type.Equals("Turret"))
{
computerCrafting.CraftTurret();
}
if (type.Equals("DM Collector"))
{
computerCrafting.CraftDarkMatterCollector();
}
if (type.Equals("DM Conduit"))
{
computerCrafting.CraftDarkMatterConduit();
}
if (type.Equals("Auto Crafter"))
{
computerCrafting.CraftAutoCrafter();
}
if (type.Equals("Rail Cart Hub"))
{
computerCrafting.CraftRailCartHub();
}
if (type.Equals("Rail Cart"))
{
computerCrafting.CraftRailCart();
}
}
machineTimer = 0;
}
}
else
{
if (computerCrafting.conduitItem != null)
{
computerCrafting.conduitItem.active = false;
}
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().Stop();
}
}
}
else
{
if (computerCrafting.conduitItem != null)
{
computerCrafting.conduitItem.active = false;
}
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().Stop();
}
}
else
{
if (computerCrafting.conduitItem != null)
{
computerCrafting.conduitItem.active = false;
}
connectionLine.enabled = false;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().Stop();
}
}
else
{
if (computerCrafting.conduitItem != null)
{
computerCrafting.conduitItem.active = false;
}
connectionLine.enabled = false;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().Stop();
}
}
else
{
if (computerCrafting.conduitItem != null)
{
computerCrafting.conduitItem.active = false;
}
connectionLine.enabled = false;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().Stop();
}
if (inputObject == null)
{
connectionLine.enabled = false;
if (connectionFailed == true)
{
if (creationMethod.Equals("spawned"))
{
creationMethod = "built";
}
}
}
}
}
}

11
AutoCrafter.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2516a376e32065f11bd3ac711ba6a3ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

20
BlockDummy.cs Normal file
View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlockDummy : MonoBehaviour
{
public string type;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
BlockDummy.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8c26fa20f51e4607fb1382ceb942b769
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Brick.cs Normal file
View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Brick : MonoBehaviour
{
public string ID = "unassigned";
public string creationMethod;
public int address;
private float updateTick;
void Start()
{
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Physics update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
}
}
}

11
Brick.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee1b88215d42cc71eb886d6b29cca597
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1952
BuildController.cs Normal file

File diff suppressed because it is too large Load Diff

11
BuildController.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cb5dbc9a9fdb2d11c88f1aa2a073fb54
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

3424
ComputerCrafting.cs Normal file

File diff suppressed because it is too large Load Diff

11
ComputerCrafting.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6dcdd64b0988b776db66be8114d18d00
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

174
ConduitItem.cs Normal file
View File

@ -0,0 +1,174 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ConduitItem : MonoBehaviour
{
public Dictionary<string, Texture2D> textureDictionary;
private GameObject player;
public Vector3 startPosition;
public GameObject target;
public GameObject machine;
public GameObject billboard;
public GameObject billboard2;
public bool active;
void Start()
{
player = GameObject.Find("Player");
textureDictionary = player.GetComponent<PlayerGUI>().textureDictionary;
startPosition = transform.position;
}
void Update()
{
if (active == true)
{
if (machine != null)
{
if (machine.GetComponent<AlloySmelter>() != null)
{
if (machine.GetComponent<AlloySmelter>().outputObject != null)
{
target = machine.GetComponent<AlloySmelter>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<AlloySmelter>().outputType))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<AlloySmelter>().outputType];
}
}
}
if (machine.GetComponent<Auger>() != null)
{
if (machine.GetComponent<Auger>().outputObject != null)
{
target = machine.GetComponent<Auger>().outputObject;
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary["Regolith"];
}
}
if (machine.GetComponent<AutoCrafter>() != null)
{
if (machine.GetComponent<AutoCrafter>().inputObject != null)
{
target = machine.GetComponent<AutoCrafter>().inputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<AutoCrafter>().type))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<AutoCrafter>().type];
}
}
}
if (machine.GetComponent<DarkMatterCollector>() != null)
{
if (machine.GetComponent<DarkMatterCollector>().outputObject != null)
{
target = machine.GetComponent<DarkMatterCollector>().outputObject;
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary["Dark Matter"];
}
}
if (machine.GetComponent<DarkMatterConduit>() != null)
{
if (machine.GetComponent<DarkMatterConduit>().outputObject != null)
{
target = machine.GetComponent<DarkMatterConduit>().outputObject;
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary["Dark Matter"];
}
}
if (machine.GetComponent<Extruder>() != null)
{
if (machine.GetComponent<Extruder>().outputObject != null)
{
target = machine.GetComponent<Extruder>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<Extruder>().outputType))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<Extruder>().outputType];
}
}
}
if (machine.GetComponent<GearCutter>() != null)
{
if (machine.GetComponent<GearCutter>().outputObject != null)
{
target = machine.GetComponent<GearCutter>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<GearCutter>().outputType))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<GearCutter>().outputType];
}
}
}
if (machine.GetComponent<Press>() != null)
{
if (machine.GetComponent<Press>().outputObject != null)
{
target = machine.GetComponent<Press>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<Press>().outputType))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<Press>().outputType];
}
}
}
if (machine.GetComponent<Retriever>() != null)
{
if (machine.GetComponent<Retriever>().outputObject != null)
{
target = machine.GetComponent<Retriever>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<Retriever>().outputObject.GetComponent<UniversalConduit>().type))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<Retriever>().outputObject.GetComponent<UniversalConduit>().type];
billboard2.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<Retriever>().outputObject.GetComponent<UniversalConduit>().type];
}
}
}
if (machine.GetComponent<Smelter>() != null)
{
if (machine.GetComponent<Smelter>().outputObject != null)
{
target = machine.GetComponent<Smelter>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<Smelter>().outputType))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<Smelter>().outputType];
}
}
}
if (machine.GetComponent<UniversalConduit>() != null)
{
if (machine.GetComponent<UniversalConduit>().outputObject != null)
{
target = machine.GetComponent<UniversalConduit>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<UniversalConduit>().type))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<UniversalConduit>().type];
}
}
}
if (machine.GetComponent<UniversalExtractor>() != null)
{
if (machine.GetComponent<UniversalExtractor>().outputObject != null)
{
target = machine.GetComponent<UniversalExtractor>().outputObject;
if (textureDictionary.ContainsKey(machine.GetComponent<UniversalExtractor>().type))
{
billboard.GetComponent<Renderer>().material.mainTexture = textureDictionary[machine.GetComponent<UniversalExtractor>().type];
}
}
}
}
if (target != null)
{
billboard.GetComponent<Renderer>().enabled = true;
transform.LookAt(target.transform.position);
transform.position += transform.forward * 10 * Time.deltaTime;
if (Vector3.Distance(transform.position, target.transform.position) < 1)
{
transform.position = startPosition;
}
}
else
{
billboard.GetComponent<Renderer>().enabled = false;
}
}
else
{
billboard.GetComponent<Renderer>().enabled = false;
}
}
}

11
ConduitItem.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cffda7ec437a64623beb49076e7e5026
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
DarkMatter.cs Normal file
View File

@ -0,0 +1,31 @@
using UnityEngine;
using System.Collections;
public class DarkMatter: MonoBehaviour
{
float size;
public GameObject collector;
void Start()
{
}
void Update()
{
if (size < 10)
{
transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(10, 10, 10), Time.deltaTime * 0.5f);
size += 1;
}
else if (size >= 10 && size < 20)
{
transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(5, 5, 5), Time.deltaTime * 0.5f);
size += 1;
}
else if (size >= 20)
{
size = 0;
}
}
}

11
DarkMatter.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eebc6d51acb08eb4e91a88f955804173
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

163
DarkMatterCollector.cs Normal file
View File

@ -0,0 +1,163 @@
using UnityEngine;
using System.Collections;
public class DarkMatterCollector : MonoBehaviour
{
public float darkMatterAmount;
public int speed = 1;
public int power;
public int heat;
public bool hasHeatExchanger;
public int cooling;
public GameObject outputObject;
public GameObject powerObject;
public GameObject conduitItem;
public Material lineMat;
public string ID = "unassigned";
public string creationMethod;
LineRenderer connectionLine;
LineRenderer inputLine;
private float updateTick;
public int address;
public bool powerON;
private int machineTimer;
public int connectionAttempts;
public bool connectionFailed;
public bool foundDarkMatter;
private GameObject builtObjects;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void OnDestroy()
{
if (inputLine != null)
{
Destroy(inputLine);
}
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (speed > 1)
{
heat = speed - 1 - cooling;
}
else
{
heat = 0;
}
if (heat < 0)
{
heat = 0;
}
if (outputObject != null)
{
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, outputObject.transform.position);
connectionLine.enabled = true;
}
else
{
connectionLine.enabled = false;
}
if (foundDarkMatter == true)
{
if (powerON == true && connectionFailed == false && speed > 0)
{
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
darkMatterAmount += speed - heat;
machineTimer = 0;
}
}
else
{
machineTimer = 0;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (foundDarkMatter == false)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
DarkMatter[] allDarkMatter = FindObjectsOfType<DarkMatter>();
foreach (DarkMatter d in allDarkMatter)
{
GameObject obj = d.gameObject;
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<DarkMatter>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj.GetComponent<DarkMatter>().collector == null)
{
obj.GetComponent<DarkMatter>().collector = this.gameObject;
}
if (obj.GetComponent<DarkMatter>().collector == this.gameObject)
{
if (inputLine == null && obj.GetComponent<LineRenderer>() == null)
{
inputLine = obj.AddComponent<LineRenderer>();
inputLine.startWidth = 0.2f;
inputLine.endWidth = 0.2f;
inputLine.material = lineMat;
inputLine.SetPosition(0, transform.position);
inputLine.SetPosition(1, obj.transform.position);
}
foundDarkMatter = true;
}
}
}
}
}
}
}
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 84612a7bb2fffb638a541eb8045541ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

395
DarkMatterConduit.cs Normal file
View File

@ -0,0 +1,395 @@
using UnityEngine;
using System.Collections;
public class DarkMatterConduit : MonoBehaviour
{
public float darkMatterAmount;
public int speed = 1;
public string ID = "unassigned";
public string inputID;
public string outputID;
public string creationMethod;
public GameObject inputObject;
public GameObject outputObject;
public GameObject conduitItem;
public Material darkMatterMat;
public Material lineMat;
LineRenderer connectionLine;
private float updateTick;
public int address;
public int range = 6;
public int connectionAttempts;
public bool connectionFailed;
public GameObject storageComputerConduitItemObject;
public ConduitItem storageComputerConduitItem;
private GameObject builtObjects;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void OnDestroy()
{
if (storageComputerConduitItem != null)
{
storageComputerConduitItem.active = false;
}
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (inputObject == null || outputObject == null)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<DarkMatterCollector>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < range)
{
if (inputObject == null && obj.GetComponent<DarkMatterCollector>().outputObject == null)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<DarkMatterCollector>().ID.Equals(inputID))
{
inputObject = obj;
obj.GetComponent<DarkMatterCollector>().outputObject = this.gameObject;
}
creationMethod = "built";
}
else if (creationMethod.Equals("built"))
{
inputObject = obj;
obj.GetComponent<DarkMatterCollector>().outputObject = this.gameObject;
}
}
}
}
if (obj.GetComponent<InventoryManager>() != null && obj.GetComponent<Retriever>() == null && obj.GetComponent<AutoCrafter>() == null && !obj.GetComponent<InventoryManager>().ID.Equals("player"))
{
if (outputObject == null)
{
if (inputObject != null)
{
if (obj != inputObject && obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<InventoryManager>().ID + " vs " + outputID);
if (obj.GetComponent<InventoryManager>().ID.Equals(outputID))
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < range || obj.GetComponent<RailCart>() != null)
{
outputObject = obj;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < range)
{
outputObject = obj;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
if (obj.GetComponent<StorageComputer>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < range)
{
if (outputObject == null)
{
if (inputObject != null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<InventoryManager>().ID + " vs " + outputID);
if (obj.GetComponent<StorageComputer>().ID.Equals(outputID))
{
outputObject = obj;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
else if (creationMethod.Equals("built"))
{
outputObject = obj;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<DarkMatterConduit>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < range)
{
if (outputObject == null)
{
if (inputObject != null)
{
if (obj != inputObject && obj != this.gameObject)
{
if (obj.GetComponent<DarkMatterConduit>().inputObject == null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<DarkMatterConduit>().ID + " vs " + outputID);
if (obj.GetComponent<DarkMatterConduit>().ID.Equals(outputID))
{
outputObject = obj;
obj.GetComponent<DarkMatterConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
else if (creationMethod.Equals("built"))
{
outputObject = obj;
obj.GetComponent<DarkMatterConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
if (inputObject != null)
{
if (inputObject.GetComponent<DarkMatterCollector>() != null)
{
inputID = inputObject.GetComponent<DarkMatterCollector>().ID;
speed = inputObject.GetComponent<DarkMatterCollector>().speed;
if (inputObject.GetComponent<DarkMatterCollector>().powerON == true && inputObject.GetComponent<DarkMatterCollector>().foundDarkMatter == true && inputObject.GetComponent<DarkMatterCollector>().speed > 0)
{
if (inputObject.GetComponent<DarkMatterCollector>().darkMatterAmount >= speed && connectionFailed == false)
{
inputObject.GetComponent<DarkMatterCollector>().darkMatterAmount -= speed;
darkMatterAmount += speed;
}
}
else
{
if (storageComputerConduitItem != null)
{
storageComputerConduitItem.active = false;
}
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (inputObject.GetComponent<DarkMatterConduit>() != null)
{
if (inputObject.GetComponent<DarkMatterConduit>().conduitItem.GetComponent<ConduitItem>().active == false)
{
if (storageComputerConduitItem != null)
{
storageComputerConduitItem.active = false;
}
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
if (outputObject != null)
{
if (outputObject.GetComponent<DarkMatterConduit>() != null)
{
outputObject.GetComponent<DarkMatterConduit>().inputID = ID;
outputID = outputObject.GetComponent<DarkMatterConduit>().ID;
outputObject.GetComponent<DarkMatterConduit>().speed = speed;
if (darkMatterAmount >= speed && connectionFailed == false && speed > 0)
{
outputObject.GetComponent<DarkMatterConduit>().darkMatterAmount += speed;
darkMatterAmount -= speed;
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else if (outputObject.GetComponent<StorageComputer>() != null)
{
outputID = outputObject.GetComponent<StorageComputer>().ID;
if (outputObject.GetComponent<StorageComputer>().initialized == true)
{
if (storageComputerConduitItem == null)
{
GameObject storageComputerItemObject = Instantiate(storageComputerConduitItemObject, outputObject.transform.position, outputObject.transform.rotation);
storageComputerItemObject.transform.parent = outputObject.transform;
storageComputerConduitItem = storageComputerItemObject.GetComponent<ConduitItem>();
}
if (darkMatterAmount >= speed && connectionFailed == false && speed > 0)
{
connectionLine.enabled = true;
connectionLine.SetPosition(1, outputObject.transform.position);
bool itemAdded = false;
foreach (InventoryManager manager in outputObject.GetComponent<StorageComputer>().computerContainers)
{
if (itemAdded == false)
{
manager.AddItem("Dark Matter", speed);
if (manager.itemAdded == true)
{
itemAdded = true;
darkMatterAmount -= speed;
if (storageComputerConduitItem != null)
{
if (storageComputerConduitItem.textureDictionary != null)
{
storageComputerConduitItem.billboard.GetComponent<Renderer>().material.mainTexture = storageComputerConduitItem.textureDictionary["Dark Matter"];
}
storageComputerConduitItem.target = manager.gameObject;
}
}
}
}
if (storageComputerConduitItem != null)
{
storageComputerConduitItem.active = true;
}
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
connectionLine.enabled = true;
}
}
else
{
if (storageComputerConduitItem != null)
{
storageComputerConduitItem.active = false;
}
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
else if (outputObject.GetComponent<InventoryManager>() != null)
{
if (outputObject.GetComponent<RailCart>() != null)
{
outputID = outputObject.GetComponent<RailCart>().ID;
}
else
{
outputID = outputObject.GetComponent<InventoryManager>().ID;
}
if (Vector3.Distance(transform.position, outputObject.transform.position) <= range)
{
if (darkMatterAmount >= speed && connectionFailed == false && speed > 0)
{
connectionLine.enabled = true;
connectionLine.SetPosition(1, outputObject.transform.position);
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
connectionLine.enabled = true;
outputObject.GetComponent<InventoryManager>().AddItem("Dark Matter", speed);
if (outputObject.GetComponent<InventoryManager>().itemAdded == true)
{
darkMatterAmount -= speed;
}
}
}
else
{
connectionLine.enabled = false;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
}
else
{
connectionLine.enabled = false;
if (connectionFailed == true)
{
if (creationMethod.Equals("spawned"))
{
creationMethod = "built";
}
}
}
if (inputObject != null && outputObject != null)
{
connectionAttempts = 0;
}
}
}
}

11
DarkMatterConduit.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2ec3e3494f3c38f9b870fd545c9fe12d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

41
ElectricLight.cs Normal file
View File

@ -0,0 +1,41 @@
using UnityEngine;
using System.Collections;
public class ElectricLight : MonoBehaviour
{
public string ID = "unassigned";
public string creationMethod;
private float updateTick;
public int address;
public bool powerON;
public GameObject powerObject;
void Start()
{
}
void OnDestroy()
{
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 1 + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (powerON == true)
{
GetComponent<Light>().enabled = true;
}
else
{
GetComponent<Light>().enabled = false;
}
}
}
}

11
ElectricLight.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91be3da9ef999901f8ede45bfe2f0c28
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

23
Explosion.cs Normal file
View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Explosion : MonoBehaviour
{
private float timer;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
timer += 1 * Time.deltaTime;
if (timer > 5)
{
Destroy(gameObject);
}
}
}

11
Explosion.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d9378fa7f888555db262c6a3fef0f0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

229
Extruder.cs Normal file
View File

@ -0,0 +1,229 @@
using UnityEngine;
using System.Collections;
public class Extruder : MonoBehaviour
{
public float amount;
public int speed = 1;
public int power;
public int heat;
public bool hasHeatExchanger;
public int cooling;
public string inputType;
public string outputType;
public string ID = "unassigned";
public string inputID;
public string outputID;
public bool powerON;
public string creationMethod;
public GameObject inputObject;
public GameObject outputObject;
public GameObject powerObject;
public GameObject conduitItem;
public Material lineMat;
LineRenderer connectionLine;
private float updateTick;
public int address;
private int machineTimer;
public int connectionAttempts;
public bool connectionFailed;
private GameObject builtObjects;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (speed > 1)
{
heat = speed - 1 - cooling;
}
else
{
heat = 0;
}
if (heat < 0)
{
heat = 0;
}
if (inputObject == null || outputObject == null)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<UniversalConduit>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (outputObject == null)
{
if (inputObject != null)
{
if (obj != inputObject && obj != this.gameObject)
{
if (obj.GetComponent<UniversalConduit>().inputObject == null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<UniversalConduit>().ID + " vs " + outputID);
if (obj.GetComponent<UniversalConduit>().ID.Equals(outputID))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
else if (creationMethod.Equals("built"))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
if (inputObject != null)
{
if (inputObject.GetComponent<UniversalConduit>() != null)
{
if (amount < 1)
{
inputType = inputObject.GetComponent<UniversalConduit>().type;
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Copper Ingot"))
{
outputType = "Copper Wire";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Aluminum Ingot"))
{
outputType = "Aluminum Wire";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Steel Ingot"))
{
outputType = "Steel Pipe";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Iron Ingot"))
{
outputType = "Iron Pipe";
}
}
if (inputObject.GetComponent<UniversalConduit>().conduitItem.GetComponent<ConduitItem>().active == false)
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
}
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
}
if (outputObject != null)
{
if (outputObject.GetComponent<UniversalConduit>() != null)
{
outputObject.GetComponent<UniversalConduit>().inputID = ID;
outputObject.GetComponent<UniversalConduit>().type = outputType;
outputObject.GetComponent<UniversalConduit>().speed = speed;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
outputID = outputObject.GetComponent<UniversalConduit>().ID;
if (amount >= speed)
{
if (outputType.Equals(outputObject.GetComponent<UniversalConduit>().type))
{
if (powerON == true && connectionFailed == false && inputObject != null && speed > 0)
{
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
outputObject.GetComponent<UniversalConduit>().amount += speed - heat;
amount -= speed - heat;
machineTimer = 0;
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
}
}
}
}
}
else
{
connectionLine.enabled = false;
if (connectionFailed == true)
{
if (creationMethod.Equals("spawned"))
{
creationMethod = "built";
}
}
}
if (inputObject != null && outputObject != null)
{
connectionAttempts = 0;
}
}
}
}

11
Extruder.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bf8d32dcbbccbfe59ab85f8b45ac5d51
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

64
ExtruderPiston.cs Normal file
View File

@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExtruderPiston : MonoBehaviour
{
public GameObject extruder;
private Vector3 originalPosition;
private Vector3 endPosition;
private bool setEndPosition;
private bool movingForward = true;
private bool movingBack;
private bool soundPlayed;
// Start is called before the first frame update
void Start()
{
originalPosition = transform.position;
}
// Update is called once per frame
void Update()
{
if (extruder.GetComponent<Light>().enabled == true)
{
float startDistance = Vector3.Distance(transform.position, originalPosition);
if (startDistance < 1.2f && movingForward == true)
{
if (soundPlayed == false)
{
extruder.GetComponent<AudioSource>().Play();
soundPlayed = true;
}
transform.position += transform.right * 1.1f * Time.deltaTime;
}
else
{
if (setEndPosition == false)
{
endPosition = transform.position;
setEndPosition = true;
}
movingBack = true;
movingForward = false;
}
float endDistance = Vector3.Distance(transform.position, endPosition);
if (endDistance < 1.2f && movingBack == true)
{
if (soundPlayed == true)
{
soundPlayed = false;
}
transform.position -= transform.right * 1.1f * Time.deltaTime;
}
else
{
setEndPosition = false;
movingBack = false;
movingForward = true;
}
}
}
}

11
ExtruderPiston.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: feb9724ed0232b13e93388751daa9df1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1281
GameManager.cs Normal file

File diff suppressed because it is too large Load Diff

11
GameManager.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 616803765feaf324189c6d8327bdf018
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

247
GearCutter.cs Normal file
View File

@ -0,0 +1,247 @@
using UnityEngine;
using System.Collections;
public class GearCutter : MonoBehaviour
{
public float amount;
public int speed = 1;
public int power;
public int heat;
public int cooling;
public bool hasHeatExchanger;
public string inputType;
public string outputType;
public string ID = "unassigned";
public string inputID;
public string outputID;
public bool powerON;
public string creationMethod;
public GameObject inputObject;
public GameObject outputObject;
public GameObject powerObject;
public GameObject conduitItem;
public Material lineMat;
LineRenderer connectionLine;
private float updateTick;
public int address;
private int machineTimer;
public GameObject laserCutter;
public int connectionAttempts;
public bool connectionFailed;
private GameObject builtObjects;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (speed > 1)
{
heat = speed - 1 - cooling;
}
else
{
heat = 0;
}
if (heat < 0)
{
heat = 0;
}
if (inputObject == null || outputObject == null)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<UniversalConduit>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (outputObject == null)
{
if (inputObject != null)
{
if (obj != inputObject && obj != this.gameObject)
{
if (obj.GetComponent<UniversalConduit>().inputObject == null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<UniversalConduit>().ID + " vs " + outputID);
if (obj.GetComponent<UniversalConduit>().ID.Equals(outputID))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
else if (creationMethod.Equals("built"))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
if (inputObject != null)
{
if (inputObject.GetComponent<UniversalConduit>() != null)
{
if (amount < 1)
{
inputType = inputObject.GetComponent<UniversalConduit>().type;
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Copper Plate"))
{
outputType = "Copper Gear";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Iron Plate"))
{
outputType = "Iron Gear";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Tin Plate"))
{
outputType = "Tin Gear";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Bronze Plate"))
{
outputType = "Bronze Gear";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Steel Plate"))
{
outputType = "Steel Gear";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Aluminum Plate"))
{
outputType = "Aluminum Gear";
}
}
if (inputObject.GetComponent<UniversalConduit>().conduitItem.GetComponent<ConduitItem>().active == false)
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
laserCutter.SetActive(false);
}
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
laserCutter.SetActive(false);
}
if (outputObject != null)
{
if (outputObject.GetComponent<UniversalConduit>() != null)
{
outputObject.GetComponent<UniversalConduit>().inputID = ID;
outputObject.GetComponent<UniversalConduit>().type = outputType;
outputObject.GetComponent<UniversalConduit>().speed = speed;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
outputID = outputObject.GetComponent<UniversalConduit>().ID;
if (amount >= speed)
{
if (outputType.Equals(outputObject.GetComponent<UniversalConduit>().type))
{
if (powerON == true && connectionFailed == false && inputObject != null && speed > 0)
{
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
laserCutter.SetActive(true);
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
outputObject.GetComponent<UniversalConduit>().amount += speed - heat;
amount -= speed - heat;
machineTimer = 0;
}
}
else
{
machineTimer = 0;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
laserCutter.SetActive(false);
}
}
}
}
}
else
{
connectionLine.enabled = false;
if (connectionFailed == true)
{
if (creationMethod.Equals("spawned"))
{
creationMethod = "built";
}
}
}
if (inputObject != null && outputObject != null)
{
connectionAttempts = 0;
}
}
}
}

11
GearCutter.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41b74965734fef2389e4e378487cd5c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Glass.cs Normal file
View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Glass : MonoBehaviour
{
public string ID = "unassigned";
public string creationMethod;
public int address;
private float updateTick;
void Start()
{
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Physics update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
}
}
}

11
Glass.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a8d88559b646f514bb3a5d4edcf4d8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

48
HeadBob.cs Normal file
View File

@ -0,0 +1,48 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HeadBob : MonoBehaviour
{
float timer;
public bool active;
Quaternion originalRotation;
public GameObject player;
// Start is called before the first frame update
void Start()
{
originalRotation = transform.localRotation;
}
public void Reset()
{
transform.localRotation = originalRotation;
timer = 0;
}
// Update is called once per frame
void Update()
{
if (active == true)
{
timer += 1 * Time.deltaTime;
if (timer < 0.25f)
{
transform.RotateAround(transform.position, transform.forward, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed / 4);
}
else if (timer >= 0.25f && timer < 0.5f)
{
transform.RotateAround(transform.position, -transform.forward, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed / 4);
}
else if (timer >= 0.5f)
{
timer = 0;
}
}
else
{
timer = 0;
}
}
}

11
HeadBob.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: affa527ab2f425b46a907c1ca8e5bc44
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

913
HeatExchanger.cs Normal file
View File

@ -0,0 +1,913 @@
using UnityEngine;
using System.Collections;
public class HeatExchanger : MonoBehaviour
{
public string ID = "unassigned";
public string inputID;
public string inputType;
public int speed = 1;
public float amount;
public bool providingCooling;
public GameObject inputObject;
public Material lineMat;
public string creationMethod;
public GameObject outputObject;
public string outputID;
LineRenderer connectionLine;
private float updateTick;
public int address;
public string type;
private int machineTimer;
public int connectionAttempts;
public bool connectionFailed;
private GameObject builtObjects;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void OnDestroy()
{
if (outputObject != null)
{
if (outputObject.GetComponent<UniversalExtractor>() != null)
{
outputObject.GetComponent<UniversalExtractor>().cooling = 0;
outputObject.GetComponent<UniversalExtractor>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<Retriever>() != null)
{
outputObject.GetComponent<Retriever>().cooling = 0;
outputObject.GetComponent<Retriever>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<AutoCrafter>() != null)
{
outputObject.GetComponent<AutoCrafter>().cooling = 0;
outputObject.GetComponent<AutoCrafter>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<DarkMatterCollector>() != null)
{
outputObject.GetComponent<DarkMatterCollector>().cooling = 0;
outputObject.GetComponent<DarkMatterCollector>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<Auger>() != null)
{
outputObject.GetComponent<Auger>().cooling = 0;
outputObject.GetComponent<Auger>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<NuclearReactor>() != null)
{
outputObject.GetComponent<NuclearReactor>().cooling = 0;
outputObject.GetComponent<NuclearReactor>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<Smelter>() != null)
{
outputObject.GetComponent<Smelter>().cooling = 0;
outputObject.GetComponent<Smelter>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<Extruder>() != null)
{
outputObject.GetComponent<Extruder>().cooling = 0;
outputObject.GetComponent<Extruder>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<Press>() != null)
{
outputObject.GetComponent<Press>().cooling = 0;
outputObject.GetComponent<Press>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<AlloySmelter>() != null)
{
outputObject.GetComponent<AlloySmelter>().cooling = 0;
outputObject.GetComponent<AlloySmelter>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<GearCutter>() != null)
{
outputObject.GetComponent<GearCutter>().cooling = 0;
outputObject.GetComponent<GearCutter>().hasHeatExchanger = false;
}
if (outputObject.GetComponent<Turret>() != null)
{
outputObject.GetComponent<Turret>().cooling = 0;
outputObject.GetComponent<Turret>().hasHeatExchanger = false;
}
}
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (outputObject == null)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<UniversalExtractor>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<UniversalExtractor>().ID.Equals(outputID))
{
if (obj.GetComponent<UniversalExtractor>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<UniversalExtractor>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<UniversalExtractor>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<UniversalExtractor>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<DarkMatterCollector>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<DarkMatterCollector>().ID.Equals(outputID))
{
if (obj.GetComponent<DarkMatterCollector>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<DarkMatterCollector>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<DarkMatterCollector>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<DarkMatterCollector>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<Retriever>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<Retriever>().ID.Equals(outputID))
{
if (obj.GetComponent<Retriever>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Retriever>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<Retriever>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Retriever>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<AutoCrafter>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<AutoCrafter>().ID.Equals(outputID))
{
if (obj.GetComponent<AutoCrafter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<AutoCrafter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<AutoCrafter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<AutoCrafter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<Auger>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<Auger>().ID.Equals(outputID))
{
if (obj.GetComponent<Auger>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Auger>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<Auger>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Auger>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<NuclearReactor>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<NuclearReactor>().ID.Equals(outputID))
{
if (obj.GetComponent<NuclearReactor>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<NuclearReactor>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<NuclearReactor>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<NuclearReactor>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<Smelter>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<Smelter>().ID.Equals(outputID))
{
if (obj.GetComponent<Smelter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Smelter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<Smelter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Smelter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<Extruder>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<Extruder>().ID.Equals(outputID))
{
if (obj.GetComponent<Extruder>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Extruder>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<Extruder>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Extruder>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<Press>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<Press>().ID.Equals(outputID))
{
if (obj.GetComponent<Press>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Press>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<Press>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Press>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<AlloySmelter>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<AlloySmelter>().ID.Equals(outputID))
{
if (obj.GetComponent<AlloySmelter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<AlloySmelter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<AlloySmelter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<AlloySmelter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<GearCutter>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<GearCutter>().ID.Equals(outputID))
{
if (obj.GetComponent<GearCutter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<GearCutter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<GearCutter>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<GearCutter>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
if (obj.GetComponent<Turret>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (obj != this.gameObject)
{
if (creationMethod.Equals("spawned"))
{
if (obj.GetComponent<Turret>().ID.Equals(outputID))
{
if (obj.GetComponent<Turret>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Turret>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
}
else if (creationMethod.Equals("built"))
{
if (obj.GetComponent<Turret>().hasHeatExchanger == false)
{
outputObject = obj;
outputObject.GetComponent<Turret>().hasHeatExchanger = true;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
}
}
}
}
}
if (inputObject != null)
{
if (inputObject.GetComponent<UniversalConduit>() != null)
{
inputType = inputObject.GetComponent<UniversalConduit>().type;
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Ice"))
{
if (speed > inputObject.GetComponent<UniversalConduit>().speed)
{
speed = inputObject.GetComponent<UniversalConduit>().speed;
}
if (amount >= speed && speed > 0)
{
providingCooling = true;
}
else
{
//Debug.Log("Heat exchanger does not have enough ice.");
providingCooling = false;
}
}
}
}
if (outputObject != null)
{
if (outputObject.GetComponent<NuclearReactor>() != null)
{
outputID = outputObject.GetComponent<NuclearReactor>().ID;
}
if (outputObject.GetComponent<UniversalExtractor>() != null)
{
outputID = outputObject.GetComponent<UniversalExtractor>().ID;
}
if (outputObject.GetComponent<Retriever>() != null)
{
outputID = outputObject.GetComponent<Retriever>().ID;
}
if (outputObject.GetComponent<AutoCrafter>() != null)
{
outputID = outputObject.GetComponent<AutoCrafter>().ID;
}
if (outputObject.GetComponent<DarkMatterCollector>() != null)
{
outputID = outputObject.GetComponent<DarkMatterCollector>().ID;
}
if (outputObject.GetComponent<Auger>() != null)
{
outputID = outputObject.GetComponent<Auger>().ID;
}
if (outputObject.GetComponent<NuclearReactor>() != null)
{
outputID = outputObject.GetComponent<NuclearReactor>().ID;
}
if (outputObject.GetComponent<Smelter>() != null)
{
outputID = outputObject.GetComponent<Smelter>().ID;
}
if (outputObject.GetComponent<Extruder>() != null)
{
outputID = outputObject.GetComponent<Extruder>().ID;
}
if (outputObject.GetComponent<Press>() != null)
{
outputID = outputObject.GetComponent<Press>().ID;
}
if (outputObject.GetComponent<AlloySmelter>() != null)
{
outputID = outputObject.GetComponent<AlloySmelter>().ID;
}
if (outputObject.GetComponent<GearCutter>() != null)
{
outputID = outputObject.GetComponent<GearCutter>().ID;
}
if (outputObject.GetComponent<Turret>() != null)
{
outputID = outputObject.GetComponent<Turret>().ID;
}
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
if (outputObject.GetComponent<UniversalExtractor>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<UniversalExtractor>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<UniversalExtractor>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<Retriever>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<Retriever>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<Retriever>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<AutoCrafter>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<AutoCrafter>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<AutoCrafter>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<DarkMatterCollector>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<DarkMatterCollector>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<DarkMatterCollector>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<Auger>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<Auger>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<Auger>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<NuclearReactor>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<NuclearReactor>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<NuclearReactor>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<Smelter>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<Smelter>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<Smelter>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<Extruder>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<Extruder>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<Extruder>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<Press>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<Press>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<Press>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<AlloySmelter>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<AlloySmelter>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<AlloySmelter>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<GearCutter>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
if (amount >= speed)
{
outputObject.GetComponent<GearCutter>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<GearCutter>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
if (outputObject.GetComponent<Turret>() != null)
{
if (providingCooling == true && connectionFailed == false && inputObject != null)
{
outputObject.GetComponent<Turret>().cooling = speed;
amount -= speed;
GetComponent<Light>().enabled = true;
GetComponent<AudioSource>().enabled = true;
}
else
{
//Debug.Log("Heat exchanger ran out of ice.");
outputObject.GetComponent<Turret>().cooling = 0;
GetComponent<Light>().enabled = false;
GetComponent<AudioSource>().enabled = false;
}
}
machineTimer = 0;
}
}
else
{
connectionLine.enabled = false;
if (connectionFailed == true)
{
if (creationMethod.Equals("spawned"))
{
creationMethod = "built";
}
}
}
}
}
}

11
HeatExchanger.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e4bd89e7af1dfded9bdf915bdc404eb2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

73
HeldItemSway.cs Normal file
View File

@ -0,0 +1,73 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HeldItemSway : MonoBehaviour
{
float timer;
public bool active;
public string type;
Quaternion originalRotation;
public GameObject player;
// Start is called before the first frame update
void Start()
{
originalRotation = transform.localRotation;
}
public void Reset()
{
transform.localRotation = originalRotation;
timer = 0;
}
// Update is called once per frame
void Update()
{
if (active == true)
{
timer += 1 * Time.deltaTime;
if (timer < 0.25f)
{
if (type.Equals("gun"))
{
transform.RotateAround(transform.position, -transform.right, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed/4);
}
else if (type.Equals("scanner"))
{
transform.RotateAround(transform.position, -transform.forward, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed/2);
}
else
{
transform.RotateAround(transform.position, transform.forward, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed/2);
}
}
else if (timer >= 0.25f && timer < 0.5f)
{
if (type.Equals("gun"))
{
transform.RotateAround(transform.position, transform.right, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed/4);
}
else if (type.Equals("scanner"))
{
transform.RotateAround(transform.position, transform.forward, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed/2);
}
else
{
transform.RotateAround(transform.position, -transform.forward, Time.deltaTime * player.GetComponent<PlayerController>().playerMoveSpeed/2);
}
}
else if (timer >= 0.5f)
{
transform.localRotation = originalRotation;
timer = 0;
}
}
else
{
transform.localRotation = originalRotation;
timer = 0;
}
}
}

11
HeldItemSway.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7eddb260c4d75a467b5de16c3db6d847
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

18
HolderDummy.cs Normal file
View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HolderDummy : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
HolderDummy.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aa03684b0576b6ee6af986b0d07dac5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2038
InteractionController.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4aeafd5e019030e658df1bf70921e620
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

124
InventoryManager.cs Normal file
View File

@ -0,0 +1,124 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InventoryManager : MonoBehaviour
{
public InventorySlot[] inventory;
StateManager game;
public string ID = "unassigned";
public int address;
string originalID;
public bool initialized;
private float updateTick;
public int maxStackSize = 1000;
public bool itemAdded;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (ID != "unassigned" && initialized == false)
{
game = GameObject.Find("GameManager").GetComponent<StateManager>();
if (game.worldLoaded == true)
{
inventory = new InventorySlot[16];
int count = 0;
while (count <= 15)
{
inventory[count] = gameObject.AddComponent<InventorySlot>();
string countType = PlayerPrefs.GetString(game.WorldName + "inventory" + ID + "slot" + count + "type");
if (!countType.Equals(""))
{
inventory[count].typeInSlot = PlayerPrefs.GetString(game.WorldName + "inventory" + ID + "slot" + count + "type");
inventory[count].amountInSlot = PlayerPrefs.GetInt(game.WorldName + "inventory" + ID + "slot" + count + "amount");
}
count++;
}
originalID = ID;
initialized = true;
if (ID.Equals("Rocket"))
{
maxStackSize = 100000;
}
else
{
maxStackSize = 1000;
}
//Debug.Log("Loaded inventory for : " + ID);
}
}
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
if (GetComponent<RailCart>() == null && GetComponent<Retriever>() == null && GetComponent<AutoCrafter>() == null && GetComponent<PlayerController>() == null && GetComponent<Rocket>() == null && ID != "Lander")
{
GetComponent<PhysicsHandler>().UpdatePhysics();
}
if (ID == "player" || ID == "Lander")
{
SaveData();
}
updateTick = 0;
}
}
public void SaveData()
{
if (initialized == true)
{
if (ID != originalID)
{
int originalCount = 0;
while (originalCount <= 15)
{
PlayerPrefs.SetString(game.WorldName + "inventory" + originalID + "slot" + originalCount + "type", "nothing");
PlayerPrefs.SetInt(game.WorldName + "inventory" + originalID + "slot" + originalCount + "amount", 0);
originalCount++;
}
originalID = ID;
}
int count = 0;
while (count <= 15)
{
PlayerPrefs.SetString(game.WorldName + "inventory" + ID + "slot" + count + "type", inventory[count].typeInSlot);
PlayerPrefs.SetInt(game.WorldName + "inventory" + ID + "slot" + count + "amount", inventory[count].amountInSlot);
count++;
}
}
}
public void AddItem(string type, int amount)
{
itemAdded = false;
foreach (InventorySlot slot in inventory)
{
if (slot != null && itemAdded == false)
{
if (slot.typeInSlot == "nothing" || slot.typeInSlot == type || slot.typeInSlot == "")
{
if (slot.amountInSlot <= maxStackSize - amount)
{
slot.typeInSlot = type;
slot.amountInSlot += amount;
itemAdded = true;
}
}
}
}
}
public void AddItemToSlot(string type, int amount, int slot)
{
inventory[slot].typeInSlot = type;
inventory[slot].amountInSlot += amount;
}
}

11
InventoryManager.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b72e4d071a26d242e820b0ee6f41e44f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
InventorySlot.cs Normal file
View File

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InventorySlot : MonoBehaviour
{
public string typeInSlot = "nothing";
public int amountInSlot = 0;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
InventorySlot.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 77d5c1b1d0960dbe6863bd9d6a3b3929
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

18
Iron.cs Normal file
View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Iron : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
Iron.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ada134f5985e29644a011e212037d1fe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
IronBlock.cs Normal file
View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IronBlock : MonoBehaviour
{
public string ID = "unassigned";
public string creationMethod;
public int address;
private float updateTick;
void Start()
{
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Physics update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
}
}
}

11
IronBlock.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 389166f490c90c4c68c5c54e36629b26
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

125
LaserController.cs Normal file
View File

@ -0,0 +1,125 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class LaserController : MonoBehaviour
{
GameManager game;
void Start()
{
game = GameObject.Find("GameManager").GetComponent<GameManager>();
}
public void HitTarget(GameObject target,RaycastHit hit)
{
if (target.GetComponent<Meteor>() != null)
{
target.GetComponent<Meteor>().Explode();
}
if (target.GetComponent<Pirate>() != null)
{
target.GetComponent<Pirate>().TakeDamage();
}
if (target.tag.Equals("Built"))
{
if (target.GetComponent<PhysicsHandler>() != null)
{
target.GetComponent<PhysicsHandler>().Explode();
}
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: " + hit.collider.gameObject.name.Split('(')[0] + " destroyed by your laser cannon!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
if (target.tag.Equals("CombinedMesh"))
{
if (target.name.Equals("glassHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 25)
{
game.SeparateBlocks(hit.point, "glass",false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some glass blocks were hit by your laser cannon!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
}
}
else if (target.name.Equals("brickHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 50)
{
game.SeparateBlocks(hit.point, "brick",false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some bricks were hit by your laser cannon!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
}
}
if (target.name.Equals("ironHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 75)
{
game.SeparateBlocks(hit.point, "iron",false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some iron blocks were hit by your laser cannon!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
}
}
else if (target.name.Equals("steelHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 99)
{
game.SeparateBlocks(hit.point, "steel",false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some steel blocks were hit by your laser cannon!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
}
}
}
}
}

11
LaserController.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7f63cda1537f1ec69b47a4c92bf02cee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

23
LaserCutter.cs Normal file
View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LaserCutter : MonoBehaviour
{
public GameObject gearCutter;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (gearCutter.GetComponent<AudioSource>().enabled == true)
{
transform.Rotate(-Vector3.up * 600 * Time.deltaTime);
}
}
}

11
LaserCutter.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aecc5f93b6bcc77f98e09b98e1e20fd4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2384
MachineCrafting.cs Normal file

File diff suppressed because it is too large Load Diff

11
MachineCrafting.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5d4beba4e480655e0a08133a519137e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

378
Main_Menu.cs Normal file
View File

@ -0,0 +1,378 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Linq;
public class Main_Menu : MonoBehaviour
{
public GUISkin thisGUIskin;
List<string> worldList;
string worldName = "Enter World Name";
public Texture2D titleTexture;
public Texture2D title2Texture;
public Texture2D worlListBackground;
public GameObject videoPlayer;
public GameObject menuSoundObject;
public GameObject ambientSoundObject;
public bool worldSelected;
bool playingVideo;
bool deletePrompt;
bool escapePrompt;
bool worldSelectPrompt;
public bool finishedLoading;
AudioSource buttonSounds;
AudioSource ambient;
float waitForVideoTimer;
// Start is called before the first frame update
void Start()
{
worldList = new List<string>();
videoPlayer.GetComponent<VP>().PlayVideo("QE_Title.webm",true,0);
buttonSounds = menuSoundObject.GetComponent<AudioSource>();
ambient = ambientSoundObject.GetComponent<AudioSource>();
ambient.Play();
if (PlayerPrefsX.GetBool("changingWorld") == true)
{
PlayerPrefsX.SetBool("changingWorld", false);
GameObject.Find("GameManager").GetComponent<StateManager>().WorldName = PlayerPrefs.GetString("worldName");
worldSelected = true;
ambient.enabled = false;
}
}
// Update is called once per frame
void Update()
{
}
void OnGUI()
{
//STYLE
GUI.skin = thisGUIskin;
//ASPECT RATIO
int ScreenHeight = Screen.height;
int ScreenWidth = Screen.width;
Rect backgroundRect = new Rect(0, 0, ScreenWidth, ScreenHeight);
Rect worldListBackgroundRect = new Rect((ScreenWidth * 0.40f), (ScreenHeight * 0.45f), (ScreenWidth * 0.17f), (ScreenHeight * 0.40f));
Rect worldListRect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.47f), (ScreenWidth * 0.15f), (ScreenHeight * 0.55f));
Rect worldListTitleRect = new Rect((ScreenWidth * 0.45f), (ScreenHeight * 0.46f), (ScreenWidth * 0.15f), (ScreenHeight * 0.55f));
Rect escapePromptLabelRect = new Rect((ScreenWidth * 0.46f), (ScreenHeight * 0.18f), (ScreenWidth * 0.20f), (ScreenHeight * 0.05f));
Rect deletePromptBackgroundRect = new Rect((ScreenWidth * 0.35f), (ScreenHeight * 0.14f),(ScreenWidth * 0.30f), (ScreenHeight * 0.20f));
Rect deletePromptLabelRect = new Rect((ScreenWidth * 0.435f), (ScreenHeight * 0.18f), (ScreenWidth * 0.20f), (ScreenHeight * 0.05f));
Rect deletePromptButton1Rect = new Rect((ScreenWidth * 0.39f), (ScreenHeight * 0.22f), (ScreenWidth * 0.10f), (ScreenHeight * 0.05f));
Rect deletePromptButton2Rect = new Rect((ScreenWidth * 0.51f), (ScreenHeight * 0.22f), (ScreenWidth * 0.10f), (ScreenHeight * 0.05f));
Rect loadingMessageRect = new Rect((ScreenWidth * 0.48f), (ScreenHeight * 0.30f), (ScreenWidth * 0.5f), (ScreenHeight * 0.5f));
Rect buttonRect1 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.50f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect2 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.532f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect3 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.564f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect4 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.596f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect5 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.628f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect6 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.660f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect7 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.692f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect8 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.724f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect9 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.756f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect buttonRect10 = new Rect((ScreenWidth * 0.405f), (ScreenHeight * 0.788f), (ScreenWidth * 0.020f), (ScreenHeight * 0.025f));
Rect world1Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.50f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world2Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.532f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world3Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.564f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world4Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.596f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world5Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.628f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world6Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.660f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world7Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.692f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world8Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.724f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world9Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.756f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
Rect world10Rect = new Rect((ScreenWidth * 0.43f), (ScreenHeight * 0.788f), (ScreenWidth * 0.12f), (ScreenHeight * 0.05f));
if (worldSelected == false)
{
if (waitForVideoTimer > 1 && playingVideo == false)
{
playingVideo = true;
}
if (playingVideo == false)
{
GUI.DrawTexture(backgroundRect, titleTexture);
waitForVideoTimer += 1 * Time.deltaTime;
}
else
{
GUI.DrawTexture(backgroundRect, title2Texture);
}
if (GUI.Button(new Rect(ScreenWidth * 0.58f, ScreenHeight * 0.4f, ScreenWidth * 0.15f, ScreenHeight * 0.03f), "START GAME") || Event.current.keyCode.Equals(KeyCode.Return))
{
if (worldSelected == false && worldName != "Enter World Name")
{
if (PlayerPrefsX.GetStringArray("Worlds") != null)
{
worldList = PlayerPrefsX.GetStringArray("Worlds").ToList<string>();
if (PlayerPrefsX.GetStringArray("Worlds").Length < 10)
{
if (!worldList.Contains(worldName))
{
worldList.Add(worldName);
worldSelectPrompt = true;
}
else
{
if (PlayerPrefsX.GetBool(worldName+"sceneChangeRequired") == true)
{
PlayerPrefsX.SetStringArray("Worlds", worldList.ToArray());
PlayerPrefsX.SetBool("changingWorld", true);
PlayerPrefs.SetString("worldName", worldName);
PlayerPrefsX.SetBool(worldName + "sceneChangeRequired", true);
SceneManager.LoadScene(1);
}
else
{
PlayerPrefsX.SetStringArray("Worlds", worldList.ToArray());
GameObject.Find("GameManager").GetComponent<StateManager>().WorldName = worldName;
worldSelected = true;
ambient.enabled = false;
}
}
}
else if (worldList.Contains(worldName))
{
if (PlayerPrefsX.GetBool(worldName + "sceneChangeRequired") == true)
{
PlayerPrefsX.SetStringArray("Worlds", worldList.ToArray());
PlayerPrefsX.SetBool("changingWorld", true);
PlayerPrefs.SetString("worldName", worldName);
PlayerPrefsX.SetBool(worldName + "sceneChangeRequired", true);
SceneManager.LoadScene(1);
}
else
{
PlayerPrefsX.SetStringArray("Worlds", worldList.ToArray());
GameObject.Find("GameManager").GetComponent<StateManager>().WorldName = worldName;
worldSelected = true;
ambient.enabled = false;
}
}
}
}
buttonSounds.Play();
}
worldName = GUI.TextField(new Rect(ScreenWidth * 0.41f, ScreenHeight * 0.4f, ScreenWidth * 0.15f, ScreenHeight * 0.03f), worldName, 16);
GUI.DrawTexture(worldListBackgroundRect, worlListBackground);
GUI.Label(worldListTitleRect, "SAVED WORLDS");
if (PlayerPrefsX.GetStringArray("Worlds").Length > 0)
{
GUI.Label(world1Rect, "1. " + PlayerPrefsX.GetStringArray("Worlds")[0]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 1)
{
GUI.Label(world2Rect, "2. " + PlayerPrefsX.GetStringArray("Worlds")[1]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 2)
{
GUI.Label(world3Rect, "3. " + PlayerPrefsX.GetStringArray("Worlds")[2]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 3)
{
GUI.Label(world4Rect, "4. " + PlayerPrefsX.GetStringArray("Worlds")[3]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 4)
{
GUI.Label(world5Rect, "5. " + PlayerPrefsX.GetStringArray("Worlds")[4]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 5)
{
GUI.Label(world6Rect, "6. " + PlayerPrefsX.GetStringArray("Worlds")[5]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 6)
{
GUI.Label(world7Rect, "7. " + PlayerPrefsX.GetStringArray("Worlds")[6]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 7)
{
GUI.Label(world8Rect, "8. " + PlayerPrefsX.GetStringArray("Worlds")[7]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 8)
{
GUI.Label(world9Rect, "9. " + PlayerPrefsX.GetStringArray("Worlds")[8]);
}
if (PlayerPrefsX.GetStringArray("Worlds").Length > 9)
{
GUI.Label(world10Rect, "10. " + PlayerPrefsX.GetStringArray("Worlds")[9]);
}
if (GUI.Button(buttonRect1, "1"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 0)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[0];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect2, "2"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 1)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[1];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect3, "3"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 2)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[2];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect4, "4"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 3)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[3];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect5, "5"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 4)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[4];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect6, "6"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 5)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[5];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect7, "7"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 6)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[6];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect8, "8"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 7)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[7];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect9, "9"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 8)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[8];
}
buttonSounds.Play();
}
if (GUI.Button(buttonRect10, "10"))
{
if (PlayerPrefsX.GetStringArray("Worlds").Length > 9)
{
worldName = PlayerPrefsX.GetStringArray("Worlds")[9];
}
buttonSounds.Play();
}
if (Input.GetKeyDown(KeyCode.F12))
{
if (deletePrompt == false && escapePrompt == false)
{
deletePrompt = true;
}
buttonSounds.Play();
}
if (worldSelectPrompt == true)
{
GUI.DrawTexture(deletePromptBackgroundRect, worlListBackground);
GUI.Label(escapePromptLabelRect, "Choose location");
if (GUI.Button(deletePromptButton1Rect, "Kepler-1625"))
{
PlayerPrefsX.SetStringArray("Worlds", worldList.ToArray());
GameObject.Find("GameManager").GetComponent<StateManager>().WorldName = worldName;
worldSelected = true;
ambient.enabled = false;
buttonSounds.Play();
}
if (GUI.Button(deletePromptButton2Rect, "Gliese 876"))
{
buttonSounds.Play();
PlayerPrefsX.SetStringArray("Worlds", worldList.ToArray());
PlayerPrefsX.SetBool("changingWorld", true);
PlayerPrefs.SetString("worldName", worldName);
PlayerPrefsX.SetBool(worldName+"sceneChangeRequired", true);
SceneManager.LoadScene(1);
}
}
if (deletePrompt == true)
{
GUI.DrawTexture(deletePromptBackgroundRect, worlListBackground);
GUI.Label(deletePromptLabelRect, "Delete all world data?");
if (GUI.Button(deletePromptButton1Rect, "Yes"))
{
PlayerPrefs.DeleteAll();
deletePrompt = false;
buttonSounds.Play();
}
if (GUI.Button(deletePromptButton2Rect, "No"))
{
deletePrompt = false;
buttonSounds.Play();
}
}
if (Input.GetKeyDown(KeyCode.Escape))
{
if (escapePrompt == false && deletePrompt == false)
{
escapePrompt = true;
}
buttonSounds.Play();
}
if (escapePrompt == true)
{
GUI.DrawTexture(deletePromptBackgroundRect, worlListBackground);
GUI.Label(escapePromptLabelRect, "Exit the game?");
if (GUI.Button(deletePromptButton1Rect, "Yes"))
{
buttonSounds.Play();
if (!Application.isEditor)
{
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}
if (GUI.Button(deletePromptButton2Rect, "No"))
{
escapePrompt = false;
buttonSounds.Play();
}
}
}
else if (GameObject.Find("GameManager").GetComponent<StateManager>().Loaded == false && finishedLoading == false)
{
GUI.Label(loadingMessageRect, "Loading...");
}
else if (GameObject.Find("GameManager").GetComponent<GameManager>().working == true && finishedLoading == false)
{
GUI.Label(loadingMessageRect, "Loading...");
}
else if (finishedLoading == false)
{
videoPlayer.GetComponent<VP>().StopVideo();
finishedLoading = true;
}
}
}

11
Main_Menu.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 281bba6a9d01e689191afe51410896f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

164
MeshPainter.cs Normal file
View File

@ -0,0 +1,164 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshPainter : MonoBehaviour
{
public int ID;
private float saveTimer;
private Coroutine saveDataCoRoutine;
// Start is called before the first frame update
void Start()
{
string worldName = GameObject.Find("GameManager").GetComponent<StateManager>().WorldName;
if (gameObject.name.Equals("ironHolder(Clone)"))
{
if (PlayerPrefsX.GetBool(worldName + "ironHolder" + ID + "painted") == true)
{
GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Blue"));
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
foreach (Transform T in blocks)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Blue"));
}
}
}
if (gameObject.name.Equals("steelHolder(Clone)"))
{
if (PlayerPrefsX.GetBool(worldName + "steelHolder" + ID + "painted") == true)
{
GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Blue"));
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
foreach (Transform T in blocks)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Blue"));
}
}
}
if (gameObject.name.Equals("brickHolder(Clone)"))
{
if (PlayerPrefsX.GetBool(worldName + "brickHolder" + ID + "painted") == true)
{
GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Blue"));
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
foreach (Transform T in blocks)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Blue"));
}
}
}
if (gameObject.name.Equals("glassHolder(Clone)"))
{
if (PlayerPrefsX.GetBool(worldName + "glassHolder" + ID + "painted") == true)
{
GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Blue"));
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
foreach (Transform T in blocks)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Blue"));
}
}
}
}
// Update is called once per frame
void Update()
{
saveTimer += 1 * Time.deltaTime;
if (saveTimer >= 1)
{
saveDataCoRoutine = StartCoroutine(SaveDataCoRoutine());
saveTimer = 0;
}
}
IEnumerator SaveDataCoRoutine()
{
string worldName = GameObject.Find("GameManager").GetComponent<StateManager>().WorldName;
if (gameObject.name.Equals("ironHolder(Clone)") && PlayerPrefsX.GetBool(worldName + "ironHolder" + ID + "painted") == true)
{
PlayerPrefs.SetFloat(worldName + "ironHolder" + ID + "Red", GetComponent<Renderer>().material.color.r);
PlayerPrefs.SetFloat(worldName + "ironHolder" + ID + "Green", GetComponent<Renderer>().material.color.g);
PlayerPrefs.SetFloat(worldName + "ironHolder" + ID + "Blue", GetComponent<Renderer>().material.color.b);
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
int paintInterval = 0;
foreach (Transform T in blocks)
{
if (T != null)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "ironHolder" + ID + "Blue"));
}
paintInterval++;
if (paintInterval >= 10)
{
yield return null;
paintInterval = 0;
}
}
}
if (gameObject.name.Equals("steelHolder(Clone)") && PlayerPrefsX.GetBool(worldName + "steelHolder" + ID + "painted") == true)
{
PlayerPrefs.SetFloat(worldName + "steelHolder" + ID + "Red", GetComponent<Renderer>().material.color.r);
PlayerPrefs.SetFloat(worldName + "steelHolder" + ID + "Green", GetComponent<Renderer>().material.color.g);
PlayerPrefs.SetFloat(worldName + "steelHolder" + ID + "Blue", GetComponent<Renderer>().material.color.b);
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
int paintInterval = 0;
foreach (Transform T in blocks)
{
if (T != null)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "steelHolder" + ID + "Blue"));
}
paintInterval++;
if (paintInterval >= 10)
{
yield return null;
paintInterval = 0;
}
}
}
if (gameObject.name.Equals("brickHolder(Clone)") && PlayerPrefsX.GetBool(worldName + "brickHolder" + ID + "painted") == true)
{
PlayerPrefs.SetFloat(worldName + "brickHolder" + ID + "Red", GetComponent<Renderer>().material.color.r);
PlayerPrefs.SetFloat(worldName + "brickHolder" + ID + "Green", GetComponent<Renderer>().material.color.g);
PlayerPrefs.SetFloat(worldName + "brickHolder" + ID + "Blue", GetComponent<Renderer>().material.color.b);
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
int paintInterval = 0;
foreach (Transform T in blocks)
{
if (T != null)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "brickHolder" + ID + "Blue"));
}
paintInterval++;
if (paintInterval >= 10)
{
yield return null;
paintInterval = 0;
}
}
}
if (gameObject.name.Equals("glassHolder(Clone)") && PlayerPrefsX.GetBool(worldName + "glassHolder" + ID + "painted") == true)
{
PlayerPrefs.SetFloat(worldName + "glassHolder" + ID + "Red", GetComponent<Renderer>().material.color.r);
PlayerPrefs.SetFloat(worldName + "glassHolder" + ID + "Green", GetComponent<Renderer>().material.color.g);
PlayerPrefs.SetFloat(worldName + "glassHolder" + ID + "Blue", GetComponent<Renderer>().material.color.b);
Transform[] blocks = gameObject.GetComponentsInChildren<Transform>(true);
int paintInterval = 0;
foreach (Transform T in blocks)
{
if (T != null)
{
T.gameObject.GetComponent<Renderer>().material.color = new Color(PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Red"), PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Green"), PlayerPrefs.GetFloat(worldName + "glassHolder" + ID + "Blue"));
}
paintInterval++;
if (paintInterval >= 10)
{
yield return null;
paintInterval = 0;
}
}
}
}
}

11
MeshPainter.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ddf49216b0d2e2c5e9dff8c65df6e24b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

159
Meteor.cs Normal file
View File

@ -0,0 +1,159 @@
using UnityEngine;
using System.Collections;
public class Meteor : MonoBehaviour
{
public GameObject explosion;
public GameObject fire;
GameManager game;
public bool destroying;
float destroyTimer;
public float altitude;
void Start()
{
game = GameObject.Find("GameManager").GetComponent<GameManager>();
}
void Update()
{
if (destroying == false)
{
transform.position -= transform.up * 50 * Time.deltaTime;
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit altitudeHit, 5000))
{
altitude = Vector3.Distance(transform.position, altitudeHit.point);
}
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit hit, 5))
{
if (hit.collider.gameObject.tag.Equals("Built"))
{
if (hit.collider.gameObject.GetComponent<PhysicsHandler>() != null)
{
hit.collider.gameObject.GetComponent<PhysicsHandler>().Explode();
}
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: " + hit.collider.gameObject.name.Split('(')[0] + " destroyed by a meteor!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
Explode();
}
else if (hit.collider.gameObject.tag.Equals("CombinedMesh"))
{
if (hit.collider.gameObject.name.Equals("glassHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 25)
{
game.SeparateBlocks(transform.position, "glass", false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some glass blocks were hit by a meteor!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
}
Explode();
}
else if (hit.collider.gameObject.name.Equals("brickHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 50)
{
game.SeparateBlocks(transform.position, "brick", false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some bricks were hit by a meteor!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
Explode();
}
}
else if (hit.collider.gameObject.name.Equals("ironHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 75)
{
game.SeparateBlocks(transform.position, "iron", false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some iron blocks were hit by a meteor!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
Explode();
}
}
else if (hit.collider.gameObject.name.Equals("steelHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 99)
{
game.SeparateBlocks(transform.position, "steel", false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some steel blocks were hit by a meteor!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
Explode();
}
}
}
else
{
Explode();
}
}
}
else
{
destroyTimer += 1 * Time.deltaTime;
if (destroyTimer >= 30)
{
Destroy(gameObject);
}
}
}
public void Explode()
{
Instantiate(explosion, new Vector3(transform.position.x,transform.position.y+10,transform.position.z), transform.rotation);
GetComponent<MeshRenderer>().enabled = false;
GetComponent<Collider>().enabled = false;
fire.SetActive(false);
destroying = true;
}
}

11
Meteor.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: deff82cb18ee5bd0aaab0a0d64d0eeb0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

105
NuclearReactor.cs Normal file
View File

@ -0,0 +1,105 @@
using UnityEngine;
using System.Collections;
public class NuclearReactor : MonoBehaviour
{
public bool hasHeatExchanger;
public int cooling;
public string ID = "unassigned";
public string creationMethod;
private float updateTick;
public int address;
public int turbineCount;
public bool sufficientCooling;
void Start()
{
}
void OnDestroy()
{
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
int currentTurbineCount = 0;
if (Physics.Raycast(transform.position, transform.up, out RaycastHit reactorUpHit, 3))
{
if (reactorUpHit.collider.gameObject.GetComponent<PowerSource>() != null)
{
if (reactorUpHit.collider.gameObject.GetComponent<PowerSource>().type.Equals("Reactor Turbine"))
{
currentTurbineCount++;
}
}
}
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit reactorDownHit, 3))
{
if (reactorDownHit.collider.gameObject.GetComponent<PowerSource>() != null)
{
if (reactorDownHit.collider.gameObject.GetComponent<PowerSource>().type.Equals("Reactor Turbine"))
{
currentTurbineCount++;
}
}
}
if (Physics.Raycast(transform.position, transform.right, out RaycastHit reactorRightHit, 3))
{
if (reactorRightHit.collider.gameObject.GetComponent<PowerSource>() != null)
{
if (reactorRightHit.collider.gameObject.GetComponent<PowerSource>().type.Equals("Reactor Turbine"))
{
currentTurbineCount++;
}
}
}
if (Physics.Raycast(transform.position, -transform.right, out RaycastHit reactorLeftHit, 3))
{
if (reactorLeftHit.collider.gameObject.GetComponent<PowerSource>() != null)
{
if (reactorLeftHit.collider.gameObject.GetComponent<PowerSource>().type.Equals("Reactor Turbine"))
{
currentTurbineCount++;
}
}
}
if (Physics.Raycast(transform.position, transform.forward, out RaycastHit reactorFrontHit, 3))
{
if (reactorFrontHit.collider.gameObject.GetComponent<PowerSource>() != null)
{
if (reactorFrontHit.collider.gameObject.GetComponent<PowerSource>().type.Equals("Reactor Turbine"))
{
currentTurbineCount++;
}
}
}
if (Physics.Raycast(transform.position, -transform.forward, out RaycastHit reactorBackHit, 3))
{
if (reactorBackHit.collider.gameObject.GetComponent<PowerSource>() != null)
{
if (reactorBackHit.collider.gameObject.GetComponent<PowerSource>().type.Equals("Reactor Turbine"))
{
currentTurbineCount++;
}
}
}
turbineCount = currentTurbineCount;
if (cooling >= turbineCount * 5)
{
sufficientCooling = true;
}
else
{
sufficientCooling = false;
}
}
}
}

11
NuclearReactor.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 16d1a7efbf178adb88545996bdffcc4e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

36
PaintGunOffset.cs Normal file
View File

@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PaintGunOffset : MonoBehaviour
{
public GameObject standardPaintGun;
public GameObject adjustedPaintGun;
public GameObject adjustedPaintGun2;
void Start()
{
}
void Update()
{
if (Camera.main.fieldOfView > 66.6667 && Camera.main.fieldOfView < 73.3334)
{
standardPaintGun.SetActive(false);
adjustedPaintGun.SetActive(true);
adjustedPaintGun2.SetActive(false);
}
else if (Camera.main.fieldOfView > 73.3334)
{
standardPaintGun.SetActive(false);
adjustedPaintGun.SetActive(false);
adjustedPaintGun2.SetActive(true);
}
else if (Camera.main.fieldOfView < 66.6667)
{
standardPaintGun.SetActive(true);
adjustedPaintGun.SetActive(false);
adjustedPaintGun2.SetActive(false);
}
}
}

11
PaintGunOffset.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a484e7f6c780bf2f3b098c8b9a83bb5e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

530
PhysicsHandler.cs Normal file
View File

@ -0,0 +1,530 @@
using UnityEngine;
public class PhysicsHandler : MonoBehaviour
{
private Rigidbody rb;
private Vector3 dropPosition;
public bool falling;
public GameObject explosion;
public string type;
private float fallDistance;
public bool fallingStack;
private bool separatedBlocks;
public bool buried;
private bool supported;
private bool missingBlockZpositive;
private bool missingBlockZnegative;
private bool missingBlockXpositive;
private bool missingBlockXnegative;
private int supportedZpositive;
private int supportedZnegative;
private int supportedXpositive;
private int supportedXnegative;
private int supportCount;
public float lifetime;
private float duplicateClearingTimer;
private float missingBlockTimer;
private float supportCheckTimer;
private float worldLoadTimer;
private bool worldLoadComplete;
private StateManager stateManager;
public string creationMethod = "built";
public bool needsSupportCheck;
void Start()
{
stateManager = GameObject.Find("GameManager").GetComponent<StateManager>();
rb = gameObject.AddComponent<Rigidbody>();
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePosition;
rb.isKinematic = true;
if (GetComponent<AirLock>() != null)
{
if (GetComponent<AirLock>().open == false)
{
GetComponent<Collider>().isTrigger = false;
}
}
else
{
GetComponent<Collider>().isTrigger = false;
}
}
void Update()
{
}
public void UpdatePhysics()
{
if (stateManager.worldLoaded == true)
{
if (!creationMethod.Equals("spawned"))
{
worldLoadComplete = true;
}
if (worldLoadComplete == false)
{
worldLoadTimer++;
if (worldLoadTimer >= 30)
{
worldLoadComplete = true;
worldLoadTimer = 0;
}
}
else
{
lifetime += 0.01f * Time.deltaTime;
duplicateClearingTimer++;
if (duplicateClearingTimer > 8 && duplicateClearingTimer < 10)
{
if (Physics.Raycast(transform.position, transform.up, out RaycastHit playerHit, 5))
{
if (playerHit.collider.gameObject.GetComponent<PlayerController>() == null)
{
GetComponent<Collider>().isTrigger = true;
}
else
{
//Debug.Log("Block skipped duplicate check due to presence of player.");
}
}
else
{
GetComponent<Collider>().isTrigger = true;
}
}
else if (duplicateClearingTimer >= 10)
{
if (GetComponent<AirLock>() != null)
{
if (GetComponent<AirLock>().open == false)
{
GetComponent<Collider>().isTrigger = false;
}
}
else
{
GetComponent<Collider>().isTrigger = false;
}
duplicateClearingTimer = 0;
}
if (GameObject.Find("GameManager").GetComponent<GameManager>().blockPhysics == true)
{
if (transform.position.y > 500 || transform.position.y < -5000)
{
Destroy(gameObject);
}
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit onGroundHit, 3))
{
if (onGroundHit.collider.tag.Equals("Landscape"))
{
buried = true;
needsSupportCheck = false;
//Debug.Log("block found buried via raycast");
}
}
if (Physics.Raycast(transform.position, transform.up, out RaycastHit inGroundHit, 3))
{
if (inGroundHit.collider.tag.Equals("Landscape"))
{
buried = true;
needsSupportCheck = false;
//Debug.Log("block found buried via raycast");
}
}
Vector3 buriedVector = new Vector3(transform.position.x, transform.position.y + 2.4f, transform.position.z);
if (Physics.Raycast(buriedVector, -transform.up, out RaycastHit onGroundHit2, 6))
{
if (onGroundHit2.collider.tag.Equals("Landscape"))
{
buried = true;
needsSupportCheck = false;
//Debug.Log("block found buried via raycast");
}
}
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit stackHit, 5))
{
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit fallingStackhit, Mathf.Infinity))
{
if (fallingStackhit.collider.gameObject.GetComponent<PhysicsHandler>() != null)
{
if (fallingStackhit.collider.gameObject.GetComponent<PhysicsHandler>().falling == true)
{
if (supported == false)
{
fallingStack = true;
//GetComponent<Renderer>().material.color = Color.cyan;
}
}
}
}
}
if (fallingStack == true || buried == false && !Physics.Raycast(transform.position, -transform.up, out RaycastHit downHit, 3))
{
if (fallingStack == true || !Physics.Raycast(transform.position, transform.right, out RaycastHit rightHit, 3) && !Physics.Raycast(transform.position, -transform.right, out RaycastHit leftHit, 3) && !Physics.Raycast(transform.position, transform.forward, out RaycastHit frontHit, 3) && !Physics.Raycast(transform.position, -transform.forward, out RaycastHit backHit, 3))
{
if (separatedBlocks == false)
{
GameObject.Find("GameManager").GetComponent<GameManager>().SeparateBlocks(transform.position, "all", false);
separatedBlocks = true;
}
falling = true;
rb.constraints = RigidbodyConstraints.FreezeRotation | ~RigidbodyConstraints.FreezePosition;
rb.isKinematic = false;
//GetComponent<Renderer>().material.color = Color.blue;
}
else
{
needsSupportCheck = true;
supportCheckTimer++;
if (supportCheckTimer >= 10)
{
CheckForSupport();
}
}
}
if (falling == true)
{
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit landHit, 3))
{
if (type == "machine")
{
if (fallDistance >= 3)
{
Explode();
}
}
if (landHit.collider.gameObject.GetComponent<PhysicsHandler>() != null)
{
if (landHit.collider.gameObject.GetComponent<PhysicsHandler>().falling == false && landHit.collider.gameObject.GetComponent<PhysicsHandler>().fallingStack == false)
{
fallDistance = 0;
falling = false;
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePosition;
rb.isKinematic = true;
separatedBlocks = false;
}
}
else
{
fallDistance = 0;
falling = false;
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePosition;
rb.isKinematic = true;
separatedBlocks = false;
}
}
else
{
fallDistance++;
}
}
}
else
{
falling = false;
fallingStack = false;
needsSupportCheck = false;
}
}
}
}
void CheckForSupport()
{
supported = false;
supportedZpositive = 0;
supportedZnegative = 0;
supportedXpositive = 0;
supportedXnegative = 0;
missingBlockZpositive = false;
missingBlockZnegative = false;
missingBlockXpositive = false;
missingBlockXnegative = false;
RaycastHit[] hits = Physics.RaycastAll(transform.position, transform.forward, 200.0F);
for (int dir = 0; dir < 5; dir++)
{
if (dir == 1)
{
//Debug.Log("dir 1");
float supportZ = 0;
hits = Physics.RaycastAll(transform.position, transform.forward, 200.0F);
foreach (RaycastHit supportHit in hits)
{
if (supportHit.collider.gameObject.GetComponent<PhysicsHandler>() != null)
{
if (Physics.Raycast(supportHit.point, -transform.up, 3))
{
supported = true;
supportZ = supportHit.point.z;
supportedZpositive = 1;
}
}
if (supportHit.collider.gameObject.tag.Equals("CombinedMesh"))
{
supported = true;
supportZ = supportHit.point.z;
supportedZpositive = 1;
}
}
if (supportedZpositive > 0)
{
for (float z = transform.position.z; z < supportZ; z+=5)
{
Vector3 missingBlockVector = new Vector3(transform.position.x, transform.position.y + 5, z);
//GameObject lineObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
//lineObject.transform.position = missingBlockVector;
//lineObject.GetComponent<Renderer>().enabled = false;
//lineObject.GetComponent<Collider>().enabled = false;
//LineRenderer debugLine = lineObject.AddComponent<LineRenderer>();
//debugLine.startWidth = 0.2f;
//debugLine.endWidth = 0.2f;
//debugLine.loop = true;
//debugLine.enabled = false;
//debugLine.SetPosition(0, missingBlockVector);
//debugLine.SetPosition(1, missingBlockVector - transform.up * 3);
//debugLine.enabled = true;
if (!Physics.Raycast(missingBlockVector, -transform.up,3))
{
missingBlockZpositive = true;
}
}
}
}
if (dir == 2)
{
//Debug.Log("dir 2");
float supportZ = 0;
hits = Physics.RaycastAll(transform.position, -transform.forward, 200.0F);
foreach (RaycastHit supportHit in hits)
{
if (supportHit.collider.gameObject.GetComponent<PhysicsHandler>() != null)
{
if (Physics.Raycast(supportHit.point, -transform.up, 3))
{
supported = true;
supportZ = supportHit.point.z;
supportedZnegative = 1;
}
}
if (supportHit.collider.gameObject.tag.Equals("CombinedMesh"))
{
supported = true;
supportZ = supportHit.point.z;
supportedZnegative = 1;
}
}
if (supportedZnegative > 0)
{
for (float z = transform.position.z; z > supportZ; z-=5)
{
Vector3 missingBlockVector = new Vector3(transform.position.x, transform.position.y + 5, z);
//GameObject lineObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
//lineObject.transform.position = missingBlockVector;
//lineObject.GetComponent<Renderer>().enabled = false;
//lineObject.GetComponent<Collider>().enabled = false;
//LineRenderer debugLine = lineObject.AddComponent<LineRenderer>();
//debugLine.startWidth = 0.2f;
//debugLine.endWidth = 0.2f;
//debugLine.loop = true;
//debugLine.enabled = false;
//debugLine.SetPosition(0, missingBlockVector);
//debugLine.SetPosition(1, missingBlockVector - transform.up * 3);
//debugLine.enabled = true;
if (!Physics.Raycast(missingBlockVector, -transform.up, 3))
{
missingBlockZnegative = true;
}
}
}
}
if (dir == 3)
{
//Debug.Log("dir 3");
float supportX = 0;
hits = Physics.RaycastAll(transform.position, transform.right, 200.0F);
foreach (RaycastHit supportHit in hits)
{
if (supportHit.collider.gameObject.GetComponent<PhysicsHandler>() != null)
{
if (Physics.Raycast(supportHit.point, -transform.up, 3))
{
supported = true;
supportX = supportHit.point.x;
supportedXpositive = 1;
}
}
if (supportHit.collider.gameObject.tag.Equals("CombinedMesh"))
{
supported = true;
supportX = supportHit.point.x;
supportedXpositive = 1;
}
}
if (supportedXpositive > 0)
{
for (float x = transform.position.x; x < supportX; x+=5)
{
Vector3 missingBlockVector = new Vector3(x, transform.position.y + 5, transform.position.z);
//GameObject lineObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
//lineObject.transform.position = missingBlockVector;
//lineObject.GetComponent<Renderer>().enabled = false;
//lineObject.GetComponent<Collider>().enabled = false;
//LineRenderer debugLine = lineObject.AddComponent<LineRenderer>();
//debugLine.startWidth = 0.2f;
//debugLine.endWidth = 0.2f;
//debugLine.loop = true;
//debugLine.enabled = false;
//debugLine.SetPosition(0, missingBlockVector);
//debugLine.SetPosition(1, missingBlockVector - transform.up * 3);
//debugLine.enabled = true;
if (!Physics.Raycast(missingBlockVector, -transform.up, 3))
{
missingBlockXpositive = true;
}
}
}
}
if (dir == 4)
{
//Debug.Log("dir 4");
float supportX = 0;
hits = Physics.RaycastAll(transform.position, -transform.right, 200.0F);
foreach (RaycastHit supportHit in hits)
{
if (supportHit.collider.gameObject.GetComponent<PhysicsHandler>() != null)
{
if (Physics.Raycast(supportHit.point, -transform.up, 3))
{
supported = true;
supportX = supportHit.point.x;
supportedXnegative = 1;
}
}
if (supportHit.collider.gameObject.tag.Equals("CombinedMesh"))
{
supported = true;
supportX = supportHit.point.x;
supportedXnegative = 1;
}
}
if (supportedXnegative > 0)
{
for (float x = transform.position.x; x > supportX; x-=5)
{
Vector3 missingBlockVector = new Vector3(x, transform.position.y + 5, transform.position.z);
//GameObject lineObject = GameObject.CreatePrimitive(PrimitiveType.Sphere);
//lineObject.transform.position = missingBlockVector;
//lineObject.GetComponent<Renderer>().enabled = false;
//lineObject.GetComponent<Collider>().enabled = false;
//LineRenderer debugLine = //lineObject.AddComponent<LineRenderer>();
//debugLine.startWidth = 0.2f;
//debugLine.endWidth = 0.2f;
//debugLine.loop = true;
//debugLine.enabled = false;
//debugLine.SetPosition(0, missingBlockVector);
//debugLine.SetPosition(1, missingBlockVector - transform.up * 3);
//debugLine.enabled = true;
if (!Physics.Raycast(missingBlockVector, -transform.up, 3))
{
missingBlockXnegative = true;
}
}
}
}
}
supportCount = supportedZpositive + supportedZnegative + supportedXpositive + supportedXnegative;
if (supportCount < 2)
{
if (missingBlockZpositive == true || missingBlockZnegative == true || missingBlockXpositive == true || missingBlockXnegative == true)
{
missingBlockTimer++;
if (missingBlockTimer >= 10)
{
supported = false;
missingBlockTimer = 0;
//GetComponent<Renderer>().material.color = Color.yellow;
}
}
else
{
missingBlockTimer = 0;
}
}
else
{
if (missingBlockZpositive == true && missingBlockZnegative == true || missingBlockXpositive == true && missingBlockXnegative == true)
{
missingBlockTimer++;
if (missingBlockTimer >= 10)
{
supported = false;
missingBlockTimer = 0;
//Debug.Log("Partial structure collapse occuring!");
//GetComponent<Renderer>().material.color = Color.yellow;
}
}
else if (missingBlockTimer > 0)
{
missingBlockTimer = 0;
//Debug.Log("Structure collapse false alarm, timer reset.");
}
}
if (supported == true)
{
//GetComponent<Renderer>().material.color = Color.green;
}
else
{
if (GetComponent<Renderer>().material.color != Color.yellow)
{
//GetComponent<Renderer>().material.color = Color.red;
}
if (separatedBlocks == false)
{
GameObject.Find("GameManager").GetComponent<GameManager>().SeparateBlocks(transform.position, "all",false);
separatedBlocks = true;
}
falling = true;
rb.constraints = RigidbodyConstraints.FreezeRotation | ~RigidbodyConstraints.FreezePosition;
rb.isKinematic = false;
}
needsSupportCheck = false;
}
void OnTriggerStay(Collider other)
{
if (other.gameObject.tag.Equals("Landscape"))
{
buried = true;
needsSupportCheck = false;
//Debug.Log("block found buried via trigger");
}
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.GetComponent<PhysicsHandler>() != null)
{
if (rb.constraints == (RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePosition))
{
if (other.bounds.Contains(transform.position))
{
if (lifetime < other.gameObject.GetComponent<PhysicsHandler>().lifetime)
{
Destroy(gameObject);
}
}
}
}
}
public void Explode()
{
Instantiate(explosion, transform.position, transform.rotation);
Destroy(gameObject);
}
}

11
PhysicsHandler.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3059e341835e4973199b7f5382615d97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

64
Ping.cs Normal file
View File

@ -0,0 +1,64 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
public class Ping : MonoBehaviour
{
float timer;
public string type;
public GameObject billboard;
public GameObject attachedLight;
public Material ironMat;
public Material aluminumMat;
public Material tinMat;
public Material copperMat;
public Material darkMatterMat;
public Material iceMat;
public Material coalMat;
void Start()
{
if (SceneManager.GetActiveScene().name.Equals("QE_World_Atmo"))
{
attachedLight.GetComponent<Light>().color = Color.white;
}
if (type.Equals("iron"))
{
billboard.GetComponent<MeshRenderer>().material = ironMat;
}
if (type.Equals("tin"))
{
billboard.GetComponent<MeshRenderer>().material = tinMat;
}
if (type.Equals("copper"))
{
billboard.GetComponent<MeshRenderer>().material = copperMat;
}
if (type.Equals("aluminum"))
{
billboard.GetComponent<MeshRenderer>().material = aluminumMat;
}
if (type.Equals("darkMatter"))
{
billboard.GetComponent<MeshRenderer>().material = darkMatterMat;
}
if(type.Equals("ice"))
{
billboard.GetComponent<MeshRenderer>().material = iceMat;
}
if(type.Equals("coal"))
{
billboard.GetComponent<MeshRenderer>().material = coalMat;
}
}
void Update()
{
transform.LookAt(GameObject.Find("Player").transform);
timer += 1 * Time.deltaTime;
if (timer > 1)
{
Destroy(gameObject);
}
}
}

11
Ping.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aad3108be4568c581910aaf60d207036
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

304
Pirate.cs Normal file
View File

@ -0,0 +1,304 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pirate : MonoBehaviour
{
GameManager game;
GameObject target;
List<Vector3> targetLocationList;
Vector3 targetLocation;
float fireTimer;
LineRenderer laser;
public Material laserMat;
public GameObject cannon;
public GameObject explosion;
public GameObject targetExplosion;
public GameObject damageExplosion;
public bool destroying;
public GameObject model;
Quaternion originalRotation;
float lifeSpan = 300;
public float integrity = 100;
public void TakeDamage()
{
integrity -= 20;
Instantiate(damageExplosion, transform.position, transform.rotation);
}
public void Explode()
{
Instantiate(explosion, transform.position, transform.rotation);
fireTimer = 0;
laser.enabled = false;
GetComponent<AudioSource>().enabled = false;
GetComponent<Light>().enabled = false;
model.GetComponent<MeshRenderer>().enabled = false;
destroying = true;
}
void Start()
{
game = GameObject.Find("GameManager").GetComponent<GameManager>();
originalRotation = transform.rotation;
targetLocationList = new List<Vector3>();
laser = gameObject.AddComponent<LineRenderer>();
laser.startWidth = 0.2f;
laser.endWidth = 0.2f;
laser.material = laserMat;
laser.loop = true;
laser.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
laser.enabled = false;
}
void Update()
{
//Despawning
lifeSpan -= 1 * Time.deltaTime;
if (lifeSpan <= 0)
{
Destroy(gameObject);
}
if (integrity <= 0 && destroying == false)
{
Explode();
}
if (target == null && destroying == false)
{
//Turn off any active weapon effects when there are no targets found.
fireTimer = 0;
laser.enabled = false;
GetComponent<Light>().enabled = false;
//Movement
if (Physics.Raycast(transform.position, transform.forward, out RaycastHit forwardHit, 1000))
{
transform.position += transform.up * 25 * Time.deltaTime;
}
else
{
transform.position += transform.forward * 200 * Time.deltaTime;
}
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit altitudeHit, 10000))
{
if (Vector3.Distance(transform.position, altitudeHit.point) > 500)
{
transform.position -= transform.up * 25 * Time.deltaTime;
}
if (Vector3.Distance(transform.position, altitudeHit.point) < 100)
{
transform.position += transform.up * 25 * Time.deltaTime;
}
}
//Targeting
bool targetFound = false;
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (targetFound == false)
{
if (!targetLocationList.Contains(obj.transform.position))
{
target = obj;
targetLocation = target.transform.position;
targetLocationList.Add(targetLocation);
targetFound = true;
}
}
}
if (targetFound == false && targetLocationList.Count > 0)
{
targetLocationList.Clear();
}
}
else if (destroying == false)
{
//Movement
Vector3 destination = targetLocation;
destination.y = transform.position.y;
if (Vector3.Distance(transform.position, targetLocation) > 2000)
{
transform.LookAt(destination);
}
if (Physics.Raycast(transform.position, transform.forward, out RaycastHit forwardHit, 1000))
{
transform.position += transform.up * 25 * Time.deltaTime;
}
else
{
transform.position += transform.forward * 200 * Time.deltaTime;
}
if (Physics.Raycast(transform.position, -transform.up, out RaycastHit altitudeHit, 10000))
{
if (Vector3.Distance(transform.position, altitudeHit.point) > 500)
{
transform.position -= transform.up * 25 * Time.deltaTime;
}
if (Vector3.Distance(transform.position, altitudeHit.point) < 100)
{
transform.position += transform.up * 25 * Time.deltaTime;
}
}
//Firing
if (Vector3.Distance(transform.position, target.transform.position) < 1000)
{
fireTimer += 1 * Time.deltaTime;
if (fireTimer >= 1 && fireTimer < 1.1f)
{
if (!cannon.GetComponent<AudioSource>().isPlaying)
{
cannon.GetComponent<AudioSource>().Play();
laser.enabled = true;
GetComponent<Light>().enabled = true;
laser.SetPosition(0, transform.position);
laser.SetPosition(1, target.transform.position);
}
}
if (fireTimer >= 1.1f)
{
if (Physics.Linecast(transform.position, target.transform.position, out RaycastHit hit))
{
//Debug.Log("Pirate shot: " + hit.collider.gameObject.name);
if (hit.collider.gameObject.tag.Equals("Built"))
{
int RandomDamage = Random.Range(1, 101);
if (RandomDamage > 75)
{
Instantiate(targetExplosion, hit.point, transform.rotation);
Destroy(hit.collider.gameObject);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: " + hit.collider.gameObject.name.Split('(')[0] + " destroyed by hostile spacecraft!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
else
{
Instantiate(damageExplosion, hit.point, transform.rotation);
}
}
else if (hit.collider.gameObject.tag.Equals("CombinedMesh"))
{
if (hit.collider.gameObject.name.Equals("glassHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 25)
{
Instantiate(targetExplosion, hit.point, transform.rotation);
game.SeparateBlocks(hit.point, "glass",false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some glass blocks were attacked by hostile spacecraft!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
}
}
else if (hit.collider.gameObject.name.Equals("brickHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 50)
{
Instantiate(targetExplosion, hit.point, transform.rotation);
game.SeparateBlocks(hit.point, "brick",false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some bricks were attacked by hostile spacecraft!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
else
{
Instantiate(damageExplosion, hit.point, transform.rotation);
}
}
}
else if (hit.collider.gameObject.name.Equals("ironHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 75)
{
Instantiate(targetExplosion, hit.point, transform.rotation);
game.SeparateBlocks(hit.point, "iron", false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some iron blocks were attacked by hostile spacecraft!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
else
{
Instantiate(damageExplosion, hit.point, transform.rotation);
}
}
}
else if (hit.collider.gameObject.name.Equals("steelHolder(Clone)"))
{
int chanceOfDestruction = Random.Range(1, 101);
{
if (chanceOfDestruction > 99)
{
Instantiate(targetExplosion, hit.point, transform.rotation);
game.SeparateBlocks(hit.point, "steel", false);
if (GameObject.Find("Player").GetComponent<PlayerController>().timeToDeliver == false && GameObject.Find("Player").GetComponent<PlayerController>().meteorShowerWarningActive == false && GameObject.Find("Player").GetComponent<PlayerController>().pirateAttackWarningActive == false)
{
if (GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive == false)
{
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageActive = true;
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage = "";
}
GameObject.Find("Player").GetComponent<PlayerController>().currentTabletMessage += "ALERT: Some steel blocks were attacked by hostile spacecraft!\n";
GameObject.Find("Player").GetComponent<PlayerController>().destructionMessageCount += 1;
}
}
else
{
Instantiate(damageExplosion, hit.point, transform.rotation);
}
}
}
}
}
fireTimer = 0;
laser.enabled = false;
GetComponent<Light>().enabled = false;
}
}
else
{
fireTimer = 0;
laser.enabled = false;
GetComponent<Light>().enabled = false;
}
}
}
}

11
Pirate.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b04674d4cc9f4cf91a02215a61f35294
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1799
PlayerController.cs Normal file

File diff suppressed because it is too large Load Diff

11
PlayerController.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9006fb5f83e5c0d649da722bdc9b8a19
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

3259
PlayerCrafting.cs Normal file

File diff suppressed because it is too large Load Diff

11
PlayerCrafting.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0d3e15d7d1a4e2e4787c029a257ffc11
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

5833
PlayerGUI.cs Normal file

File diff suppressed because it is too large Load Diff

11
PlayerGUI.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 17b2dceb0266c7350a3501c2b969a329
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

667
PlayerPrefsX.cs Normal file
View File

@ -0,0 +1,667 @@
// ArrayPrefs2 v 1.4
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class PlayerPrefsX
{
static private int endianDiff1;
static private int endianDiff2;
static private int idx;
static private byte[] byteBlock;
enum ArrayType { Float, Int32, Bool, String, Vector2, Vector3, Quaternion, Color }
public static bool SetBool(String name, bool value)
{
try
{
PlayerPrefs.SetInt(name, value ? 1 : 0);
}
catch
{
return false;
}
return true;
}
public static bool GetBool(String name)
{
return PlayerPrefs.GetInt(name) == 1;
}
public static bool GetBool(String name, bool defaultValue)
{
return (1 == PlayerPrefs.GetInt(name, defaultValue ? 1 : 0));
}
public static long GetLong(string key, long defaultValue)
{
int lowBits, highBits;
SplitLong(defaultValue, out lowBits, out highBits);
lowBits = PlayerPrefs.GetInt(key + "_lowBits", lowBits);
highBits = PlayerPrefs.GetInt(key + "_highBits", highBits);
// unsigned, to prevent loss of sign bit.
ulong ret = (uint)highBits;
ret = (ret << 32);
return (long)(ret | (ulong)(uint)lowBits);
}
public static long GetLong(string key)
{
int lowBits = PlayerPrefs.GetInt(key + "_lowBits");
int highBits = PlayerPrefs.GetInt(key + "_highBits");
// unsigned, to prevent loss of sign bit.
ulong ret = (uint)highBits;
ret = (ret << 32);
return (long)(ret | (ulong)(uint)lowBits);
}
private static void SplitLong(long input, out int lowBits, out int highBits)
{
// unsigned everything, to prevent loss of sign bit.
lowBits = (int)(uint)(ulong)input;
highBits = (int)(uint)(input >> 32);
}
public static void SetLong(string key, long value)
{
int lowBits, highBits;
SplitLong(value, out lowBits, out highBits);
PlayerPrefs.SetInt(key + "_lowBits", lowBits);
PlayerPrefs.SetInt(key + "_highBits", highBits);
}
public static bool SetVector2(String key, Vector2 vector)
{
return SetFloatArray(key, new float[] { vector.x, vector.y });
}
static Vector2 GetVector2(String key)
{
var floatArray = GetFloatArray(key);
if (floatArray.Length < 2)
{
return Vector2.zero;
}
return new Vector2(floatArray[0], floatArray[1]);
}
public static Vector2 GetVector2(String key, Vector2 defaultValue)
{
if (PlayerPrefs.HasKey(key))
{
return GetVector2(key);
}
return defaultValue;
}
public static bool SetVector3(String key, Vector3 vector)
{
return SetFloatArray(key, new float[] { vector.x, vector.y, vector.z });
}
public static Vector3 GetVector3(String key)
{
var floatArray = GetFloatArray(key);
if (floatArray.Length < 3)
{
return Vector3.zero;
}
return new Vector3(floatArray[0], floatArray[1], floatArray[2]);
}
public static Vector3 GetVector3(String key, Vector3 defaultValue)
{
if (PlayerPrefs.HasKey(key))
{
return GetVector3(key);
}
return defaultValue;
}
public static bool SetQuaternion(String key, Quaternion vector)
{
return SetFloatArray(key, new float[] { vector.x, vector.y, vector.z, vector.w });
}
public static Quaternion GetQuaternion(String key)
{
var floatArray = GetFloatArray(key);
if (floatArray.Length < 4)
{
return Quaternion.identity;
}
return new Quaternion(floatArray[0], floatArray[1], floatArray[2], floatArray[3]);
}
public static Quaternion GetQuaternion(String key, Quaternion defaultValue)
{
if (PlayerPrefs.HasKey(key))
{
return GetQuaternion(key);
}
return defaultValue;
}
public static bool SetColor(String key, Color color)
{
return SetFloatArray(key, new float[] { color.r, color.g, color.b, color.a });
}
public static Color GetColor(String key)
{
var floatArray = GetFloatArray(key);
if (floatArray.Length < 4)
{
return new Color(0.0f, 0.0f, 0.0f, 0.0f);
}
return new Color(floatArray[0], floatArray[1], floatArray[2], floatArray[3]);
}
public static Color GetColor(String key, Color defaultValue)
{
if (PlayerPrefs.HasKey(key))
{
return GetColor(key);
}
return defaultValue;
}
public static bool SetBoolArray(String key, bool[] boolArray)
{
// Make a byte array that's a multiple of 8 in length, plus 5 bytes to store the number of entries as an int32 (+ identifier)
// We have to store the number of entries, since the boolArray length might not be a multiple of 8, so there could be some padded zeroes
var bytes = new byte[(boolArray.Length + 7) / 8 + 5];
bytes[0] = System.Convert.ToByte(ArrayType.Bool); // Identifier
var bits = new BitArray(boolArray);
bits.CopyTo(bytes, 5);
Initialize();
ConvertInt32ToBytes(boolArray.Length, bytes); // The number of entries in the boolArray goes in the first 4 bytes
return SaveBytes(key, bytes);
}
public static bool[] GetBoolArray(String key)
{
if (PlayerPrefs.HasKey(key))
{
var bytes = System.Convert.FromBase64String(PlayerPrefs.GetString(key));
if (bytes.Length < 5)
{
Debug.LogError("Corrupt preference file for " + key);
return new bool[0];
}
if ((ArrayType)bytes[0] != ArrayType.Bool)
{
Debug.LogError(key + " is not a boolean array");
return new bool[0];
}
Initialize();
// Make a new bytes array that doesn't include the number of entries + identifier (first 5 bytes) and turn that into a BitArray
var bytes2 = new byte[bytes.Length - 5];
System.Array.Copy(bytes, 5, bytes2, 0, bytes2.Length);
var bits = new BitArray(bytes2);
// Get the number of entries from the first 4 bytes after the identifier and resize the BitArray to that length, then convert it to a boolean array
bits.Length = ConvertBytesToInt32(bytes);
var boolArray = new bool[bits.Count];
bits.CopyTo(boolArray, 0);
return boolArray;
}
return new bool[0];
}
public static bool[] GetBoolArray(String key, bool defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetBoolArray(key);
}
var boolArray = new bool[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
boolArray[i] = defaultValue;
}
return boolArray;
}
public static bool SetStringArray(String key, String[] stringArray)
{
var bytes = new byte[stringArray.Length + 1];
bytes[0] = System.Convert.ToByte(ArrayType.String); // Identifier
Initialize();
// Store the length of each string that's in stringArray, so we can extract the correct strings in GetStringArray
for (var i = 0; i < stringArray.Length; i++)
{
if (stringArray[i] == null)
{
Debug.LogError("Can't save null entries in the string array when setting " + key);
return false;
}
if (stringArray[i].Length > 255)
{
Debug.LogError("Strings cannot be longer than 255 characters when setting " + key);
return false;
}
bytes[idx++] = (byte)stringArray[i].Length;
}
try
{
PlayerPrefs.SetString(key, System.Convert.ToBase64String(bytes) + "|" + String.Join("", stringArray));
}
catch
{
return false;
}
return true;
}
public static String[] GetStringArray(String key)
{
if (PlayerPrefs.HasKey(key))
{
var completeString = PlayerPrefs.GetString(key);
var separatorIndex = completeString.IndexOf("|"[0]);
if (separatorIndex < 4)
{
Debug.LogError("Corrupt preference file for " + key);
return new String[0];
}
var bytes = System.Convert.FromBase64String(completeString.Substring(0, separatorIndex));
if ((ArrayType)bytes[0] != ArrayType.String)
{
Debug.LogError(key + " is not a string array");
return new String[0];
}
Initialize();
var numberOfEntries = bytes.Length - 1;
var stringArray = new String[numberOfEntries];
var stringIndex = separatorIndex + 1;
for (var i = 0; i < numberOfEntries; i++)
{
int stringLength = bytes[idx++];
if (stringIndex + stringLength > completeString.Length)
{
Debug.LogError("Corrupt preference file for " + key);
return new String[0];
}
stringArray[i] = completeString.Substring(stringIndex, stringLength);
stringIndex += stringLength;
}
return stringArray;
}
return new String[0];
}
public static String[] GetStringArray(String key, String defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetStringArray(key);
}
var stringArray = new String[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
stringArray[i] = defaultValue;
}
return stringArray;
}
public static bool SetIntArray(String key, int[] intArray)
{
return SetValue(key, intArray, ArrayType.Int32, 1, ConvertFromInt);
}
public static bool SetFloatArray(String key, float[] floatArray)
{
return SetValue(key, floatArray, ArrayType.Float, 1, ConvertFromFloat);
}
public static bool SetVector2Array(String key, Vector2[] vector2Array)
{
return SetValue(key, vector2Array, ArrayType.Vector2, 2, ConvertFromVector2);
}
public static bool SetVector3Array(String key, Vector3[] vector3Array)
{
return SetValue(key, vector3Array, ArrayType.Vector3, 3, ConvertFromVector3);
}
public static bool SetQuaternionArray(String key, Quaternion[] quaternionArray)
{
return SetValue(key, quaternionArray, ArrayType.Quaternion, 4, ConvertFromQuaternion);
}
public static bool SetColorArray(String key, Color[] colorArray)
{
return SetValue(key, colorArray, ArrayType.Color, 4, ConvertFromColor);
}
private static bool SetValue<T>(String key, T array, ArrayType arrayType, int vectorNumber, Action<T, byte[], int> convert) where T : IList
{
var bytes = new byte[(4 * array.Count) * vectorNumber + 1];
bytes[0] = System.Convert.ToByte(arrayType); // Identifier
Initialize();
for (var i = 0; i < array.Count; i++)
{
convert(array, bytes, i);
}
return SaveBytes(key, bytes);
}
private static void ConvertFromInt(int[] array, byte[] bytes, int i)
{
ConvertInt32ToBytes(array[i], bytes);
}
private static void ConvertFromFloat(float[] array, byte[] bytes, int i)
{
ConvertFloatToBytes(array[i], bytes);
}
private static void ConvertFromVector2(Vector2[] array, byte[] bytes, int i)
{
ConvertFloatToBytes(array[i].x, bytes);
ConvertFloatToBytes(array[i].y, bytes);
}
private static void ConvertFromVector3(Vector3[] array, byte[] bytes, int i)
{
ConvertFloatToBytes(array[i].x, bytes);
ConvertFloatToBytes(array[i].y, bytes);
ConvertFloatToBytes(array[i].z, bytes);
}
private static void ConvertFromQuaternion(Quaternion[] array, byte[] bytes, int i)
{
ConvertFloatToBytes(array[i].x, bytes);
ConvertFloatToBytes(array[i].y, bytes);
ConvertFloatToBytes(array[i].z, bytes);
ConvertFloatToBytes(array[i].w, bytes);
}
private static void ConvertFromColor(Color[] array, byte[] bytes, int i)
{
ConvertFloatToBytes(array[i].r, bytes);
ConvertFloatToBytes(array[i].g, bytes);
ConvertFloatToBytes(array[i].b, bytes);
ConvertFloatToBytes(array[i].a, bytes);
}
public static int[] GetIntArray(String key)
{
var intList = new List<int>();
GetValue(key, intList, ArrayType.Int32, 1, ConvertToInt);
return intList.ToArray();
}
public static int[] GetIntArray(String key, int defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetIntArray(key);
}
var intArray = new int[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
intArray[i] = defaultValue;
}
return intArray;
}
public static float[] GetFloatArray(String key)
{
var floatList = new List<float>();
GetValue(key, floatList, ArrayType.Float, 1, ConvertToFloat);
return floatList.ToArray();
}
public static float[] GetFloatArray(String key, float defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetFloatArray(key);
}
var floatArray = new float[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
floatArray[i] = defaultValue;
}
return floatArray;
}
public static Vector2[] GetVector2Array(String key)
{
var vector2List = new List<Vector2>();
GetValue(key, vector2List, ArrayType.Vector2, 2, ConvertToVector2);
return vector2List.ToArray();
}
public static Vector2[] GetVector2Array(String key, Vector2 defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetVector2Array(key);
}
var vector2Array = new Vector2[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
vector2Array[i] = defaultValue;
}
return vector2Array;
}
public static Vector3[] GetVector3Array(String key)
{
var vector3List = new List<Vector3>();
GetValue(key, vector3List, ArrayType.Vector3, 3, ConvertToVector3);
return vector3List.ToArray();
}
public static Vector3[] GetVector3Array(String key, Vector3 defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetVector3Array(key);
}
var vector3Array = new Vector3[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
vector3Array[i] = defaultValue;
}
return vector3Array;
}
public static Quaternion[] GetQuaternionArray(String key)
{
var quaternionList = new List<Quaternion>();
GetValue(key, quaternionList, ArrayType.Quaternion, 4, ConvertToQuaternion);
return quaternionList.ToArray();
}
public static Quaternion[] GetQuaternionArray(String key, Quaternion defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetQuaternionArray(key);
}
var quaternionArray = new Quaternion[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
quaternionArray[i] = defaultValue;
}
return quaternionArray;
}
public static Color[] GetColorArray(String key)
{
var colorList = new List<Color>();
GetValue(key, colorList, ArrayType.Color, 4, ConvertToColor);
return colorList.ToArray();
}
public static Color[] GetColorArray(String key, Color defaultValue, int defaultSize)
{
if (PlayerPrefs.HasKey(key))
{
return GetColorArray(key);
}
var colorArray = new Color[defaultSize];
for (int i = 0; i < defaultSize; i++)
{
colorArray[i] = defaultValue;
}
return colorArray;
}
private static void GetValue<T>(String key, T list, ArrayType arrayType, int vectorNumber, Action<T, byte[]> convert) where T : IList
{
if (PlayerPrefs.HasKey(key))
{
var bytes = System.Convert.FromBase64String(PlayerPrefs.GetString(key));
if ((bytes.Length - 1) % (vectorNumber * 4) != 0)
{
Debug.LogError("Corrupt preference file for " + key);
return;
}
if ((ArrayType)bytes[0] != arrayType)
{
Debug.LogError(key + " is not a " + arrayType.ToString() + " array");
return;
}
Initialize();
var end = (bytes.Length - 1) / (vectorNumber * 4);
for (var i = 0; i < end; i++)
{
convert(list, bytes);
}
}
}
private static void ConvertToInt(List<int> list, byte[] bytes)
{
list.Add(ConvertBytesToInt32(bytes));
}
private static void ConvertToFloat(List<float> list, byte[] bytes)
{
list.Add(ConvertBytesToFloat(bytes));
}
private static void ConvertToVector2(List<Vector2> list, byte[] bytes)
{
list.Add(new Vector2(ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes)));
}
private static void ConvertToVector3(List<Vector3> list, byte[] bytes)
{
list.Add(new Vector3(ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes)));
}
private static void ConvertToQuaternion(List<Quaternion> list, byte[] bytes)
{
list.Add(new Quaternion(ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes)));
}
private static void ConvertToColor(List<Color> list, byte[] bytes)
{
list.Add(new Color(ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes), ConvertBytesToFloat(bytes)));
}
public static void ShowArrayType(String key)
{
var bytes = System.Convert.FromBase64String(PlayerPrefs.GetString(key));
if (bytes.Length > 0)
{
ArrayType arrayType = (ArrayType)bytes[0];
Debug.Log(key + " is a " + arrayType.ToString() + " array");
}
}
private static void Initialize()
{
if (System.BitConverter.IsLittleEndian)
{
endianDiff1 = 0;
endianDiff2 = 0;
}
else
{
endianDiff1 = 3;
endianDiff2 = 1;
}
if (byteBlock == null)
{
byteBlock = new byte[4];
}
idx = 1;
}
private static bool SaveBytes(String key, byte[] bytes)
{
try
{
PlayerPrefs.SetString(key, System.Convert.ToBase64String(bytes));
}
catch
{
return false;
}
return true;
}
private static void ConvertFloatToBytes(float f, byte[] bytes)
{
byteBlock = System.BitConverter.GetBytes(f);
ConvertTo4Bytes(bytes);
}
private static float ConvertBytesToFloat(byte[] bytes)
{
ConvertFrom4Bytes(bytes);
return System.BitConverter.ToSingle(byteBlock, 0);
}
private static void ConvertInt32ToBytes(int i, byte[] bytes)
{
byteBlock = System.BitConverter.GetBytes(i);
ConvertTo4Bytes(bytes);
}
private static int ConvertBytesToInt32(byte[] bytes)
{
ConvertFrom4Bytes(bytes);
return System.BitConverter.ToInt32(byteBlock, 0);
}
private static void ConvertTo4Bytes(byte[] bytes)
{
bytes[idx] = byteBlock[endianDiff1];
bytes[idx + 1] = byteBlock[1 + endianDiff2];
bytes[idx + 2] = byteBlock[2 - endianDiff2];
bytes[idx + 3] = byteBlock[3 - endianDiff1];
idx += 4;
}
private static void ConvertFrom4Bytes(byte[] bytes)
{
byteBlock[endianDiff1] = bytes[idx];
byteBlock[1 + endianDiff2] = bytes[idx + 1];
byteBlock[2 - endianDiff2] = bytes[idx + 2];
byteBlock[3 - endianDiff1] = bytes[idx + 3];
idx += 4;
}
}

11
PlayerPrefsX.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 46220af8826180d93bd531d882c3a1be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2444
PowerConduit.cs Normal file

File diff suppressed because it is too large Load Diff

11
PowerConduit.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d0f8bbcc6e930c0788bd3ba54ffa259a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

3243
PowerSource.cs Normal file

File diff suppressed because it is too large Load Diff

11
PowerSource.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5cae92705410363818afe2ad9c7f7873
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

242
Press.cs Normal file
View File

@ -0,0 +1,242 @@
using UnityEngine;
using System.Collections;
public class Press : MonoBehaviour
{
public float amount;
public int speed = 1;
public int power;
public int heat;
public bool hasHeatExchanger;
public int cooling;
public string inputType;
public string outputType;
public string ID = "unassigned";
public string inputID;
public string outputID;
public bool powerON;
public string creationMethod;
public GameObject inputObject;
public GameObject outputObject;
public GameObject powerObject;
public GameObject conduitItem;
public Material lineMat;
LineRenderer connectionLine;
private float updateTick;
public int address;
private int machineTimer;
public int connectionAttempts;
public bool connectionFailed;
private GameObject builtObjects;
void Start()
{
connectionLine = gameObject.AddComponent<LineRenderer>();
connectionLine.startWidth = 0.2f;
connectionLine.endWidth = 0.2f;
connectionLine.material = lineMat;
connectionLine.loop = true;
connectionLine.enabled = false;
builtObjects = GameObject.Find("Built_Objects");
}
void Update()
{
updateTick += 1 * Time.deltaTime;
if (updateTick > 0.5f + (address * 0.001f))
{
//Debug.Log(ID + " Machine update tick: " + address * 0.1f);
GetComponent<PhysicsHandler>().UpdatePhysics();
updateTick = 0;
if (speed > 1)
{
heat = speed - 1 - cooling;
}
else
{
heat = 0;
}
if (heat < 0)
{
heat = 0;
}
if (inputObject == null || outputObject == null)
{
connectionAttempts += 1;
if (creationMethod.Equals("spawned"))
{
if (connectionAttempts >= 30)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
else
{
if (connectionAttempts >= 120)
{
connectionAttempts = 0;
connectionFailed = true;
}
}
if (connectionFailed == false)
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<UniversalConduit>() != null)
{
float distance = Vector3.Distance(transform.position, obj.transform.position);
if (distance < 20)
{
if (outputObject == null)
{
if (inputObject != null)
{
if (obj != inputObject && obj != this.gameObject)
{
if (obj.GetComponent<UniversalConduit>().inputObject == null)
{
if (creationMethod.Equals("spawned"))
{
//Debug.Log("trying to connect " + ID + " to " + obj.GetComponent<UniversalConduit>().ID + " vs " + outputID);
if (obj.GetComponent<UniversalConduit>().ID.Equals(outputID))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
creationMethod = "built";
}
}
else if (creationMethod.Equals("built"))
{
outputObject = obj;
obj.GetComponent<UniversalConduit>().type = outputType;
obj.GetComponent<UniversalConduit>().inputObject = this.gameObject;
connectionLine.SetPosition(0, transform.position);
connectionLine.SetPosition(1, obj.transform.position);
connectionLine.enabled = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
if (inputObject != null)
{
if (inputObject.GetComponent<UniversalConduit>() != null)
{
if (amount < 1)
{
inputType = inputObject.GetComponent<UniversalConduit>().type;
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Copper Ingot"))
{
outputType = "Copper Plate";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Iron Ingot"))
{
outputType = "Iron Plate";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Tin Ingot"))
{
outputType = "Tin Plate";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Bronze Ingot"))
{
outputType = "Bronze Plate";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Steel Ingot"))
{
outputType = "Steel Plate";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Aluminum Ingot"))
{
outputType = "Aluminum Plate";
}
if (inputObject.GetComponent<UniversalConduit>().type.Equals("Regolith"))
{
outputType = "Brick";
}
}
if (inputObject.GetComponent<UniversalConduit>().conduitItem.GetComponent<ConduitItem>().active == false)
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
}
}
}
else
{
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
}
if (outputObject != null)
{
if (outputObject.GetComponent<UniversalConduit>() != null)
{
outputObject.GetComponent<UniversalConduit>().inputID = ID;
outputObject.GetComponent<UniversalConduit>().type = outputType;
outputObject.GetComponent<UniversalConduit>().speed = speed;
//Debug.Log("Setting " + ID + " output conduit type to: " + outputType);
outputID = outputObject.GetComponent<UniversalConduit>().ID;
if (amount >= speed)
{
if (outputType.Equals(outputObject.GetComponent<UniversalConduit>().type))
{
if (powerON == true && connectionFailed == false && inputObject != null && speed > 0)
{
conduitItem.GetComponent<ConduitItem>().active = true;
GetComponent<Light>().enabled = true;
machineTimer += 1;
if (machineTimer > 5 - (address * 0.01f))
{
outputObject.GetComponent<UniversalConduit>().amount += speed - heat;
amount -= speed - heat;
machineTimer = 0;
}
}
else
{
machineTimer = 0;
conduitItem.GetComponent<ConduitItem>().active = false;
GetComponent<Light>().enabled = false;
}
}
}
}
}
else
{
connectionLine.enabled = false;
if (connectionFailed == true)
{
if (creationMethod.Equals("spawned"))
{
creationMethod = "built";
}
}
}
if (inputObject != null && outputObject != null)
{
connectionAttempts = 0;
}
}
}
}

11
Press.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 428a92e9cb89993fe95fdfc66a6606aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

53
PressHammer.cs Normal file
View File

@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PressHammer : MonoBehaviour
{
public GameObject press;
public float originalYposition;
bool movingDown = true;
bool movingUp;
bool soundPlayed;
// Start is called before the first frame update
void Start()
{
originalYposition = transform.position.y;
}
// Update is called once per frame
void Update()
{
if (press.GetComponent<Light>().enabled == true)
{
if (transform.position.y > originalYposition - 0.4f && movingDown == true)
{
if (soundPlayed == false)
{
press.GetComponent<AudioSource>().Play();
soundPlayed = true;
}
transform.position -= transform.up * 0.3f * Time.deltaTime;
}
else
{
movingUp = true;
movingDown = false;
}
if (transform.position.y <= originalYposition && movingUp == true)
{
if (soundPlayed == true)
{
soundPlayed = false;
}
transform.position += transform.up * 0.3f * Time.deltaTime;
}
else
{
movingUp = false;
movingDown = true;
}
}
}
}

11
PressHammer.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b10586530d023941c9e4107805173d19
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

124
PrintingArm.cs Normal file
View File

@ -0,0 +1,124 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PrintingArm : MonoBehaviour
{
public GameObject autoCrafter;
public GameObject laser;
public GameObject horizontalArm;
public GameObject verticalArm;
private Vector3 horizontalArmStartPosition;
private Vector3 verticalArmStartPosition;
bool started;
bool soundPlayed;
float timer;
// Start is called before the first frame update
void Start()
{
horizontalArmStartPosition = horizontalArm.transform.position;
verticalArmStartPosition = verticalArm.transform.position;
}
// Update is called once per frame
void Update()
{
if (autoCrafter.GetComponent<AutoCrafter>().inputObject != null)
{
started = true;
}
else
{
started = false;
}
if (autoCrafter.GetComponent<Light>().enabled == true && started == true)
{
laser.SetActive(true);
timer += 1 * Time.deltaTime;
if (timer < 1)
{
if (soundPlayed == false)
{
//retriever.GetComponent<AudioSource>().Play();
soundPlayed = true;
}
horizontalArm.transform.position += horizontalArm.transform.right * 1 * Time.deltaTime;
}
else if (timer >= 1 && timer < 2)
{
if (soundPlayed == true)
{
GetComponent<AudioSource>().Play();
soundPlayed = false;
}
verticalArm.transform.position -= verticalArm.transform.forward * 1 * Time.deltaTime;
}
else if (timer >= 2 && timer < 3)
{
if (soundPlayed == false)
{
GetComponent<AudioSource>().Play();
soundPlayed = true;
}
horizontalArm.transform.position -= horizontalArm.transform.right * 1 * Time.deltaTime;
}
else if (timer >= 3 && timer < 4)
{
if (soundPlayed == true)
{
GetComponent<AudioSource>().Play();
soundPlayed = false;
}
verticalArm.transform.position += verticalArm.transform.forward * 1 * Time.deltaTime;
}
if (timer >= 4 && timer < 5)
{
if (soundPlayed == false)
{
//retriever.GetComponent<AudioSource>().Play();
soundPlayed = true;
}
horizontalArm.transform.position -= horizontalArm.transform.right * 1 * Time.deltaTime;
}
else if (timer >= 5 && timer < 6)
{
if (soundPlayed == true)
{
GetComponent<AudioSource>().Play();
soundPlayed = false;
}
verticalArm.transform.position += verticalArm.transform.forward * 1 * Time.deltaTime;
}
else if (timer >= 6 && timer < 7)
{
if (soundPlayed == false)
{
GetComponent<AudioSource>().Play();
soundPlayed = true;
}
horizontalArm.transform.position += horizontalArm.transform.right * 1 * Time.deltaTime;
}
else if (timer >= 7 && timer < 8)
{
if (soundPlayed == true)
{
GetComponent<AudioSource>().Play();
soundPlayed = false;
}
verticalArm.transform.position -= verticalArm.transform.forward * 1 * Time.deltaTime;
}
else if (timer >= 8)
{
timer = 0;
soundPlayed = false;
horizontalArm.transform.position = horizontalArmStartPosition;
verticalArm.transform.position = verticalArmStartPosition;
}
}
else
{
laser.SetActive(false);
}
}
}

11
PrintingArm.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eae528ae505de882e981b4da53e534e3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

118
RailCart.cs Normal file
View File

@ -0,0 +1,118 @@
using UnityEngine;
using System.Collections;
public class RailCart : MonoBehaviour
{
public string ID = "unassigned";
public string creationMethod;
public GameObject target;
private Vector3 targetPosition;
public int address;
public string targetID;
private bool loadedTarget;
private float stopTimer;
private GameObject builtObjects;
void Start()
{
builtObjects = GameObject.Find("Built_Objects");
}
void OnDestroy()
{
}
void Update()
{
GetComponent<InventoryManager>().ID = ID;
if (creationMethod.Equals("spawned"))
{
if (target == null && loadedTarget == false && !targetID.Equals(""))
{
GameObject[] allObjects = GameObject.FindGameObjectsWithTag("Built");
foreach (GameObject obj in allObjects)
{
if (obj != null)
{
if (obj.transform.parent != builtObjects.transform)
{
if (obj.activeInHierarchy)
{
if (obj.GetComponent<RailCartHub>() != null)
{
if (obj.GetComponent<RailCartHub>().ID.Equals(targetID))
{
target = obj;
loadedTarget = true;
}
}
}
}
}
}
}
}
if (target != null)
{
targetPosition = target.transform.position;
transform.LookAt(targetPosition);
if (Vector3.Distance(transform.position, targetPosition) < 1)
{
if (target.GetComponent<RailCartHub>() != null)
{
targetID = target.GetComponent<RailCartHub>().ID;
//Debug.Log(ID + " target is a hub");
if (target.GetComponent<RailCartHub>().stop == true)
{
//Debug.Log(ID + " target is a stopping point");
if (GetComponent<AudioSource>().enabled == true)
{
GetComponent<AudioSource>().enabled = false;
}
if (stopTimer <= target.GetComponent<RailCartHub>().stopTime)
{
stopTimer += 1 * Time.deltaTime;
}
else if (target.GetComponent<RailCartHub>().outputObject != null)
{
//Debug.Log(ID + " finding next hub");
stopTimer = 0;
target = target.GetComponent<RailCartHub>().outputObject;
}
}
else if (target.GetComponent<RailCartHub>().outputObject != null)
{
//Debug.Log(ID + " finding next hub");
stopTimer = 0;
target = target.GetComponent<RailCartHub>().outputObject;
}
}
}
else
{
if (Physics.Raycast(transform.position,transform.forward,out RaycastHit crashHit, 5))
{
if (crashHit.collider != null)
{
if (crashHit.collider.gameObject != null)
{
if (crashHit.collider.gameObject.GetComponent<RailCartHub>() != null || crashHit.collider.gameObject.tag.Equals("Landscape"))
{
transform.position += 8 * transform.forward * Time.deltaTime;
}
}
}
}
else
{
transform.position += 8 * transform.forward * Time.deltaTime;
}
if (GetComponent<AudioSource>().enabled == false)
{
GetComponent<AudioSource>().enabled = true;
}
}
}
}
}

11
RailCart.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c81696daa61c74f3918f2b991150aad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More