The fucking 3rd time i had to upload this project to git

This commit is contained in:
Madhav Kapa
2023-10-06 20:18:29 -04:00
commit 5658acfe16
2689 changed files with 1259400 additions and 0 deletions

View File

@ -0,0 +1,28 @@
using Player.Information;
using UnityEngine;
public class ConstructArea : ConstructBase
{
[SerializeField] private string resourceName = "";
[SerializeField] private float resourceRate;
[SerializeField] private float radiusEffect;
private GameObject player;
private PlayerStats playerStats;
// Start is called before the first frame update
private void Start()
{
player = GameObject.FindGameObjectWithTag("Player");
playerStats = player.GetComponent<PlayerStats>();
}
// Update is called once per frame
private void Update()
{
if (Vector3.Distance(player.transform.position, transform.position) <= radiusEffect)
playerStats.ConsumeResource(resourceRate * Time.deltaTime, resourceName);
}
}

View File

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

View File

@ -0,0 +1,32 @@
using UnityEngine;
public class ConstructBase : MonoBehaviour
{
[SerializeField] private int naniteCost = 1;
// Start is called before the first frame update
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
// called whenever the player collects the resources from this construct
public void Interact()
{
}
public int Disassemble()
{
Destroy(gameObject);
return naniteCost;
}
public int GetCost()
{
return naniteCost;
}
}

View File

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

View File

@ -0,0 +1,48 @@
using TMPro;
using UnityEngine;
public class ConstructMaker : ConstructBase
{
[SerializeField] private string resourceName = "";
[SerializeField] private float resourceMax;
[SerializeField] private float resourceRate;
private float resource;
private TMP_Text resourceIndicator;
private void Start()
{
resourceIndicator = transform.Find("ResourceIndicator").GetComponent<TMP_Text>();
}
private void Update()
{
if (resource != resourceMax)
{
resource = Mathf.Clamp(resource + resourceRate * Time.deltaTime, 0f, resourceMax);
resourceIndicator.SetText(resourceName + ":\n" + Mathf.FloorToInt(resource));
}
}
public void SetProperties(string name, float max, float rate)
{
resourceName = name;
resourceMax = max;
resourceRate = rate;
}
public new float Interact()
{
var amount = resource;
resource = 0f;
return amount;
}
public string GetResource()
{
return resourceName;
}
}

View File

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

View File

@ -0,0 +1,85 @@
using TMPro;
using UnityEngine;
using Player.Information;
public class ConstructManager : MonoBehaviour
{
[SerializeField] private bool isMaker = true;
[SerializeField] private string resourceName = "";
[SerializeField] private float resourceMax = 50f;
[SerializeField] private float resourceRate = 1f;
[SerializeField] private float radiusEffect = 5f;
private GameObject player;
private PlayerStats playerStats;
private float resource;
private TMP_Text resourceIndicator;
// Start is called before the first frame update
private void Start()
{
resourceIndicator = transform.Find("ResourceIndicator").GetComponent<TMP_Text>();
if (isMaker)
{
resourceIndicator = transform.Find("ResourceIndicator").GetComponent<TMP_Text>();
}
else
{
resourceIndicator.enabled = false;
player = GameObject.FindGameObjectWithTag("Player");
playerStats = player.GetComponent<PlayerStats>();
}
}
// Update is called once per frame
private void Update()
{
if (isMaker)
{
if (resource != resourceMax)
{
resource = Mathf.Clamp(resource + resourceRate * Time.deltaTime, 0f, resourceMax);
resourceIndicator.SetText(resourceName + ":\n" + Mathf.FloorToInt(resource));
}
}
else
{
if (Vector3.Distance(player.transform.position, transform.position) <= radiusEffect)
playerStats.ChangeHealth(resourceRate * Time.deltaTime);
}
}
// called whenever the player collects the resources from this construct
public float CollectAll()
{
if (isMaker)
{
var amount = resource;
resource = 0f;
return amount;
}
return 0f;
}
public void Disassemble()
{
Destroy(gameObject);
}
public bool IsMaker()
{
return isMaker;
}
public string GetResource()
{
return resourceName;
}
}

View File

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

View File

@ -0,0 +1,41 @@
using TMPro;
using UnityEngine;
public class FoodMakerController : MonoBehaviour
{
[SerializeField] private float foodMax = 50f;
[SerializeField] private float foodRate = 1f;
private float food;
private TMP_Text foodIndicator;
// Start is called before the first frame update
private void Start()
{
food = 0f;
foodIndicator = transform.Find("FoodIndicator").GetComponent<TMP_Text>();
}
// Update is called once per frame
private void Update()
{
food = Mathf.Clamp(food + foodRate * Time.deltaTime, 0f, foodMax);
foodIndicator.SetText("Food:\n" + Mathf.FloorToInt(food));
}
// called whenever the player collects the resources from this construct
public float CollectAll()
{
var amount = food;
food = 0f;
return amount;
}
public void Disassemble()
{
Destroy(gameObject);
}
}

View File

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