first push 2

This commit is contained in:
2023-03-13 19:59:59 -04:00
commit bb3e31030b
744 changed files with 123827 additions and 0 deletions

View File

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Collider))]
[RequireComponent(typeof(Rigidbody))]
public abstract class CarryableItem : MonoBehaviour
{
[SerializeField]
private string itemName;
public string ItemName { get { return this.itemName; } }
[SerializeField]
private int itemSize = 1;
public int ItemSize { get { return this.itemSize; } }
}

View File

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

View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HeavyInteractableItem : InteractableItem
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void DisableAll()
{
this.GetComponent<Collider>().enabled = false;
}
public void EnableAll()
{
this.GetComponent<Collider>().enabled = true;
}
private void FixedUpdate()
{
BaseFixedUpdate();
//print("Alpha Target:"+ base.target_alpha);
}
}

View File

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

View File

@ -0,0 +1,78 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
[RequireComponent(typeof(Collider))]
[RequireComponent(typeof(Rigidbody))]
public class InteractableItem : CarryableItem
{
[SerializeField]
private Canvas interactionCanvas;
private TMP_Text[] interaction_texts;
private Image[] interaction_images;
protected float target_alpha = 0;
[SerializeField]
protected bool canPickup = false;
protected bool isEnabled = false;
public bool CanPickup { get { return canPickup; } }
public bool IsEnabled { get { return isEnabled; } }
public void Enable()
{
print("Enabled!");
interactionCanvas.transform.LookAt((GameObject.FindGameObjectWithTag("MainCamera").transform.position));
interactionCanvas.transform.Rotate(0, 180, 0);
target_alpha = 1;
isEnabled = true;
}
public void Disable()
{
print("Disabled!");
target_alpha = 0;
isEnabled = true;
}
public void Interact()
{
}
protected void BaseAwake()
{
interaction_texts = interactionCanvas.GetComponentsInChildren<TMP_Text>();
interaction_images = interactionCanvas.GetComponentsInChildren<Image>();
foreach (TMP_Text text in interaction_texts)
{
text.color = new Color(text.color.r, text.color.g, text.color.b, 0);
}
foreach (Image image in interaction_images)
{
image.color = new Color(image.color.r, image.color.g, image.color.b, 0);
}
}
protected void BaseFixedUpdate()
{
foreach (TMP_Text text in interaction_texts)
{
text.color = Color.Lerp(new Color(text.color.r, text.color.g, text.color.b, text.color.a), new Color(text.color.r, text.color.g, text.color.b, target_alpha), 10 * Time.deltaTime);
}
foreach (Image image in interaction_images)
{
image.color = Color.Lerp(new Color(image.color.r, image.color.g, image.color.b, image.color.a), new Color(image.color.r, image.color.g, image.color.b, target_alpha), 10 * Time.deltaTime);
}
}
private void Awake()
{
BaseAwake();
}
private void FixedUpdate()
{
BaseFixedUpdate();
}
}

View File

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

View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KeyItem : InteractableItem
{
[SerializeField]
private string keyName;
public string KeyName { get { return keyName; } }
private void Awake()
{
BaseAwake();
}
private void Start()
{
}
}

View File

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