forked from Wireline-Studios/JourneyProject
Merge branch 'main' of https://git.wirelinestudios.com/Wireline-Studios/JourneyProject
This commit is contained in:
@@ -1,102 +0,0 @@
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CompassPointer : MonoBehaviour
|
||||
{
|
||||
public Transform playerTransform;
|
||||
|
||||
public bool rotateCompass;
|
||||
public bool realisticCompass;
|
||||
public bool opposite;
|
||||
|
||||
public Toggle compass;
|
||||
|
||||
public bool brainController;
|
||||
public bool wasRotating;
|
||||
public GameObject cinBrain;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
rotateCompass = compass.isOn;
|
||||
if (rotateCompass)
|
||||
{
|
||||
if (realisticCompass)
|
||||
{
|
||||
Vector3 northDirection = Vector3.forward;
|
||||
Vector3 compassForward = playerTransform.forward;
|
||||
compassForward.y = 0;
|
||||
float angle = Vector3.SignedAngle(compassForward, northDirection, Vector3.up);
|
||||
transform.localRotation = Quaternion.Euler(0, angle, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 northDirection = Vector3.forward;
|
||||
Vector3 compassForward = playerTransform.forward;
|
||||
compassForward.y = 0;
|
||||
float angle = Vector3.SignedAngle(northDirection, compassForward, Vector3.up);
|
||||
transform.localRotation = Quaternion.Euler(0, angle, 0);
|
||||
}
|
||||
if (opposite)
|
||||
{
|
||||
if (!realisticCompass)
|
||||
{
|
||||
Vector3 northDirection = Vector3.forward;
|
||||
Vector3 compassForward = playerTransform.forward;
|
||||
compassForward.y = 0;
|
||||
float angle = Vector3.SignedAngle(compassForward, northDirection, Vector3.up);
|
||||
transform.localRotation = Quaternion.Euler(0, angle, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 northDirection = Vector3.forward;
|
||||
Vector3 compassForward = playerTransform.forward;
|
||||
compassForward.y = 0;
|
||||
float angle = Vector3.SignedAngle(northDirection, compassForward, Vector3.up);
|
||||
transform.localRotation = Quaternion.Euler(0, angle, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!rotateCompass)
|
||||
{
|
||||
Vector3 northDirection = Vector3.forward;
|
||||
Vector3 compassForward = playerTransform.forward;
|
||||
compassForward.y = 0;
|
||||
float angle = Vector3.SignedAngle(northDirection, northDirection, Vector3.up);
|
||||
transform.localRotation = Quaternion.Euler(0, angle, 0);
|
||||
}
|
||||
if (brainController)
|
||||
{
|
||||
if (rotateCompass)
|
||||
{
|
||||
if (wasRotating)
|
||||
{
|
||||
//cinBrain.SetActive(false);
|
||||
//cinBrain.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||
cinBrain.GetComponent<CinemachineRotateWithFollowTarget>().enabled = rotateCompass;
|
||||
//cinBrain.SetActive(true);
|
||||
wasRotating = false;
|
||||
}
|
||||
}
|
||||
else if (!rotateCompass)
|
||||
{
|
||||
if (!wasRotating)
|
||||
{
|
||||
cinBrain.SetActive(false);
|
||||
cinBrain.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||
cinBrain.GetComponent<CinemachineRotateWithFollowTarget>().enabled = rotateCompass;
|
||||
cinBrain.SetActive(true);
|
||||
wasRotating = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65ef68387275a3e46b7e5752f865b7c8
|
||||
@@ -1,15 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class CreditScreenButton : MonoBehaviour
|
||||
{
|
||||
public void Close()
|
||||
{
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
|
||||
public void Website()
|
||||
{
|
||||
Application.OpenURL("https://wiiirhung.com");
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed082983e8988a54698b8677764580e6
|
||||
@@ -1,36 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
public class FogDisabler : MonoBehaviour
|
||||
{
|
||||
private bool originalFogState;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
RenderPipelineManager.beginCameraRendering += OnBeginCameraRendering;
|
||||
RenderPipelineManager.endCameraRendering += OnEndCameraRendering;
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
RenderPipelineManager.beginCameraRendering -= OnBeginCameraRendering;
|
||||
RenderPipelineManager.endCameraRendering -= OnEndCameraRendering;
|
||||
}
|
||||
|
||||
void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera)
|
||||
{
|
||||
if (camera == this.GetComponent<Camera>())
|
||||
{
|
||||
originalFogState = RenderSettings.fog; // Store original state
|
||||
RenderSettings.fog = false; // Disable fog for this camera
|
||||
}
|
||||
}
|
||||
|
||||
void OnEndCameraRendering(ScriptableRenderContext context, Camera camera)
|
||||
{
|
||||
if (camera == this.GetComponent<Camera>())
|
||||
{
|
||||
RenderSettings.fog = originalFogState; // Revert fog to original state
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0cfce438623f6b489a70c20a15adc3d
|
||||
@@ -1,72 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GunThrown : MonoBehaviour
|
||||
{
|
||||
public Rigidbody rb;
|
||||
public GameObject player;
|
||||
public Vector3 TargetPosition;
|
||||
public float playerDistance;
|
||||
|
||||
public Vector3 currentRotation;
|
||||
public Quaternion targetRotation;
|
||||
|
||||
public bool isStuck;
|
||||
public float despawnTimer = 10;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.Find("Player");
|
||||
TargetPosition = player.transform.position;
|
||||
transform.LookAt(player.transform.position);
|
||||
currentRotation = transform.eulerAngles;
|
||||
transform.eulerAngles = new Vector3(60, currentRotation.y, currentRotation.z);
|
||||
|
||||
playerDistance = Vector3.Distance(transform.position, TargetPosition);
|
||||
if (playerDistance < 9)
|
||||
{
|
||||
playerDistance = playerDistance * 1.2f;
|
||||
}
|
||||
if (playerDistance > 17)
|
||||
{
|
||||
playerDistance = playerDistance / 1.4f;
|
||||
}
|
||||
else if (playerDistance > 13)
|
||||
{
|
||||
playerDistance = playerDistance / 1.2f;
|
||||
}
|
||||
rb.AddForce(transform.up * playerDistance, ForceMode.Impulse);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 10 * Time.deltaTime);
|
||||
if (Time.timeScale == 1)
|
||||
{
|
||||
targetRotation = Quaternion.Euler(-20f, currentRotation.y, currentRotation.z);
|
||||
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, -0.8f);
|
||||
}
|
||||
|
||||
if (transform.position == TargetPosition)
|
||||
{
|
||||
isStuck = true;
|
||||
}
|
||||
|
||||
if (isStuck)
|
||||
{
|
||||
despawnTimer -= Time.deltaTime;
|
||||
if (despawnTimer <= 0)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionStay(Collision collision)
|
||||
{
|
||||
if (collision.gameObject.tag == "Player" && !isStuck)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe870c030a2b648d89c63559e7522299
|
||||
@@ -1,61 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class InfectedEnemy : MonoBehaviour
|
||||
{
|
||||
public float hp;
|
||||
public float hurtAmount;
|
||||
public MeshRenderer MeshRenderer;
|
||||
public Material def;
|
||||
public Material hur;
|
||||
public bool isInside;
|
||||
|
||||
private NavMeshAgent agent;
|
||||
public Transform target;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
MeshRenderer = GetComponent<MeshRenderer>();
|
||||
agent = GetComponent<NavMeshAgent>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
agent.SetDestination(target.position);
|
||||
if (hp < 0)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
if (!isInside && hp != 0)
|
||||
MeshRenderer.material = def;
|
||||
|
||||
|
||||
}
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (hp == 0)
|
||||
hp -= 1;
|
||||
isInside = false;
|
||||
}
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Sword")
|
||||
{
|
||||
hp -= hurtAmount;
|
||||
MeshRenderer.material = hur;
|
||||
}
|
||||
}
|
||||
public void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Sword")
|
||||
isInside = true;
|
||||
}
|
||||
public void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Sword" && hp != 0)
|
||||
MeshRenderer.material = def;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 330739a9b5a09ed4aaec683246161b11
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc63b26a5b4ca2746b2167fce8b14a90
|
||||
@@ -1,29 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class JumpHitbox : MonoBehaviour
|
||||
{
|
||||
public PlayerMovement playerMovement;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log("Hit Player");
|
||||
playerMovement.HP -= 1;
|
||||
}
|
||||
else{
|
||||
Debug.Log("Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba495adcc9de84e148094bc4f9073dfa
|
||||
@@ -1,29 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class LungeHitbox : MonoBehaviour
|
||||
{
|
||||
public PlayerMovement playerMovement;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log("Hit Player");
|
||||
playerMovement.HP -= 1.5f;
|
||||
}
|
||||
else{
|
||||
Debug.Log("Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 982fdb439fe8344d68124ca1628747ae
|
||||
@@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class MechBoss : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f1d4c5acc0624759954b8d3abdb2f6d
|
||||
@@ -1,193 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor;
|
||||
|
||||
public class MenuControls : MonoBehaviour
|
||||
{
|
||||
|
||||
public TMP_Dropdown resSelect;
|
||||
public Toggle fsToggle;
|
||||
|
||||
public Toggle compassRealistic;
|
||||
|
||||
Resolution[] resolutions;
|
||||
bool isFullscreen;
|
||||
int selectedResolution;
|
||||
List<Resolution> selectedResolutionList = new List<Resolution>();
|
||||
|
||||
|
||||
|
||||
|
||||
public Slider frSlider;
|
||||
public TextMeshProUGUI frAmount;
|
||||
|
||||
|
||||
|
||||
public Slider Sensitivity;
|
||||
public TextMeshProUGUI SensitvityShow;
|
||||
public GameObject Sens;
|
||||
|
||||
public Canvas mainCanvas;
|
||||
public Canvas settingsCanvas;
|
||||
public Canvas creditsCanvas;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
if (Application.targetFrameRate == -1 || Application.targetFrameRate > 240)
|
||||
{
|
||||
frSlider.value = 241;
|
||||
}
|
||||
else
|
||||
{
|
||||
frSlider.value = Application.targetFrameRate;
|
||||
}
|
||||
|
||||
if (frSlider.value > 240)
|
||||
{
|
||||
frAmount.text = "FPS Limit: None";
|
||||
Application.targetFrameRate = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frAmount.text = "FPS Limit: " + frSlider.value.ToString();
|
||||
Application.targetFrameRate = (int)frSlider.value;
|
||||
}
|
||||
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length == 0)
|
||||
{
|
||||
Instantiate<GameObject>(Sens);
|
||||
Sensitivity.value = 1.75558f;//GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sensitivity.value = GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens;
|
||||
compassRealistic.isOn = GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().compass;
|
||||
}
|
||||
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length != 0)
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens = Sensitivity.value;
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().compass = compassRealistic.isOn;
|
||||
|
||||
var percent = ((Sensitivity.value - 0.5f) / (3f - 0.5f)) * 100;
|
||||
SensitvityShow.text = "Sensitivity: " + ((int)percent).ToString();
|
||||
}
|
||||
|
||||
isFullscreen = Screen.fullScreen;
|
||||
resolutions = Screen.resolutions;
|
||||
|
||||
List<string> resolutionList = new List<string>();
|
||||
string newRes;
|
||||
foreach (Resolution res in resolutions)
|
||||
{
|
||||
newRes = res.width.ToString() + " x " + res.height.ToString();
|
||||
if (!resolutionList.Contains(newRes))
|
||||
{
|
||||
resolutionList.Add(newRes);
|
||||
selectedResolutionList.Add(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resSelect.AddOptions(resolutionList);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ChangeResolution()
|
||||
{
|
||||
selectedResolution = resSelect.value;
|
||||
Screen.SetResolution(selectedResolutionList[selectedResolution].width, selectedResolutionList[selectedResolution].height, isFullscreen);
|
||||
}
|
||||
|
||||
public void ChangeFullScreen()
|
||||
{
|
||||
isFullscreen = fsToggle.isOn;
|
||||
Screen.SetResolution(selectedResolutionList[selectedResolution].width, selectedResolutionList[selectedResolution].height, isFullscreen);
|
||||
}
|
||||
|
||||
public void ChangeFramerate()
|
||||
{
|
||||
if (frSlider.value > 240)
|
||||
{
|
||||
frAmount.text = "FPS Limit: None";
|
||||
Application.targetFrameRate = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frAmount.text = "FPS Limit: " + frSlider.value.ToString();
|
||||
Application.targetFrameRate = (int)frSlider.value;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeSensitivity()
|
||||
{
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length != 0)
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens = Sensitivity.value;
|
||||
|
||||
var percent = ((Sensitivity.value - 0.5f) / (3f - 0.5f)) * 100;
|
||||
SensitvityShow.text = "Sensitivity: " + ((int)percent).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeCompass()
|
||||
{
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length != 0)
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().compass = compassRealistic.isOn;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void PlayGame()
|
||||
{
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public void OpenSettings()
|
||||
{
|
||||
mainCanvas.enabled = false;
|
||||
settingsCanvas.enabled = true;
|
||||
}
|
||||
public void CloseSettings()
|
||||
{
|
||||
settingsCanvas.enabled = false;
|
||||
mainCanvas.enabled = true;
|
||||
}
|
||||
|
||||
public void OpenCredits()
|
||||
{
|
||||
mainCanvas.enabled = false;
|
||||
creditsCanvas.enabled = true;
|
||||
}
|
||||
public void CloseCredits()
|
||||
{
|
||||
creditsCanvas.enabled = false;
|
||||
mainCanvas.enabled = true;
|
||||
}
|
||||
|
||||
public void Website()
|
||||
{
|
||||
Application.OpenURL("https://wiiirhung.com");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 744f11095ee32da46b7af4bdb345545f
|
||||
@@ -1,148 +0,0 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Interactions;
|
||||
|
||||
public class MouthOpenClose : MonoBehaviour
|
||||
{
|
||||
public bool npcAwakener;
|
||||
public GameObject awakenerHead;
|
||||
public Material openMouth;
|
||||
public Material closeMouth;
|
||||
public Material closedMouth;
|
||||
public GameObject npc;
|
||||
public GameObject player;
|
||||
public GameObject prompt;
|
||||
public GameObject text;
|
||||
public bool interacted;
|
||||
public bool entered;
|
||||
public Animator animator;
|
||||
public float timer;
|
||||
public float timerDeactivate;
|
||||
public float initialTimer;
|
||||
public float initialTimerDeactivate;
|
||||
public bool isClosed;
|
||||
public string whatToSay;
|
||||
private void Start()
|
||||
{
|
||||
player = GameObject.Find("Player");
|
||||
npc.GetComponent<SkinnedMeshRenderer>().material = closedMouth;
|
||||
isClosed = true;
|
||||
timer = initialTimer;
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (Vector3.Distance(transform.position, player.transform.position) < 5)
|
||||
{
|
||||
if (!npcAwakener)
|
||||
{
|
||||
animator.SetBool("playerNear", true);
|
||||
|
||||
Vector3 targetDirection = new Vector3(player.transform.position.x, transform.position.y, player.transform.position.z) - transform.position;
|
||||
Vector3 newDirection = Vector3.RotateTowards(transform.forward, targetDirection, 3 * Time.deltaTime, 0);
|
||||
transform.rotation = Quaternion.LookRotation(newDirection);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 targetDirection = new Vector3(player.transform.position.x, awakenerHead.transform.position.y, player.transform.position.z) - awakenerHead.transform.position;
|
||||
Vector3 newDirection = Vector3.RotateTowards(awakenerHead.transform.forward, targetDirection, 3 * Time.deltaTime, 0);
|
||||
awakenerHead.transform.rotation = Quaternion.LookRotation(newDirection);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else animator.SetBool("playerNear", false);
|
||||
|
||||
if (Vector3.Distance(transform.position, player.transform.position) < 3)
|
||||
{
|
||||
if (!interacted)
|
||||
{
|
||||
entered = true;
|
||||
prompt.SetActive(true);
|
||||
if (Input.GetKeyDown(KeyCode.E))
|
||||
{
|
||||
//interacted = true;
|
||||
//prompt.SetActive(false);
|
||||
//text.SetActive(true);
|
||||
//text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
||||
//timerDeactivate = initialTimerDeactivate;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (!text.activeSelf)
|
||||
interacted = false;
|
||||
if (entered)
|
||||
{
|
||||
entered = false;
|
||||
prompt.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
//text.SetActive(false);
|
||||
}
|
||||
|
||||
if (text.activeSelf && interacted)
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0)
|
||||
{
|
||||
timer = initialTimer;
|
||||
if (isClosed)
|
||||
{
|
||||
npc.GetComponent<SkinnedMeshRenderer>().material = openMouth;
|
||||
isClosed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.GetComponent<SkinnedMeshRenderer>().material = closeMouth;
|
||||
isClosed = true;
|
||||
}
|
||||
}
|
||||
timerDeactivate -= Time.deltaTime;
|
||||
if (timerDeactivate <= 0)
|
||||
{
|
||||
text.SetActive(false);
|
||||
interacted = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.GetComponent<SkinnedMeshRenderer>().material = closedMouth;
|
||||
isClosed = true;
|
||||
}
|
||||
if (text.GetComponent<TextMeshProUGUI>().text != whatToSay) interacted = false;
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C))
|
||||
{
|
||||
//text.SetActive(false);
|
||||
//interacted = false;
|
||||
}
|
||||
}
|
||||
public void OnInteract(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed && !interacted && Vector3.Distance(transform.position, player.transform.position) < 3 && context.interaction is TapInteraction)
|
||||
{
|
||||
interacted = true;
|
||||
prompt.SetActive(false);
|
||||
text.SetActive(true);
|
||||
text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
||||
timerDeactivate = initialTimerDeactivate;
|
||||
}
|
||||
if (context.performed && context.interaction is HoldInteraction)
|
||||
{
|
||||
text.SetActive(false);
|
||||
interacted = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f31d3ff8d72de4d4a839ab68347e5767
|
||||
@@ -1,174 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor;
|
||||
|
||||
public class PauseMenuControls : MonoBehaviour
|
||||
{
|
||||
|
||||
public TMP_Dropdown resSelect;
|
||||
public Toggle fsToggle;
|
||||
|
||||
public Toggle compassRealistic;
|
||||
|
||||
Resolution[] resolutions;
|
||||
bool isFullscreen;
|
||||
int selectedResolution;
|
||||
List<Resolution> selectedResolutionList = new List<Resolution>();
|
||||
|
||||
|
||||
|
||||
|
||||
public Slider frSlider;
|
||||
public TextMeshProUGUI frAmount;
|
||||
|
||||
|
||||
|
||||
public Slider Sensitivity;
|
||||
public TextMeshProUGUI SensitvityShow;
|
||||
public GameObject Sens;
|
||||
|
||||
public GameObject mainCanvas;
|
||||
public GameObject pauseCanvas;
|
||||
public GameObject settingsCanvas;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (Application.targetFrameRate == -1 || Application.targetFrameRate > 240)
|
||||
{
|
||||
frSlider.value = 241;
|
||||
}
|
||||
else
|
||||
{
|
||||
frSlider.value = Application.targetFrameRate;
|
||||
}
|
||||
|
||||
if (frSlider.value > 240)
|
||||
{
|
||||
frAmount.text = "FPS Limit: None";
|
||||
Application.targetFrameRate = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frAmount.text = "FPS Limit: " + frSlider.value.ToString();
|
||||
Application.targetFrameRate = (int)frSlider.value;
|
||||
}
|
||||
|
||||
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length == 0)
|
||||
{
|
||||
Instantiate<GameObject>(Sens);
|
||||
Sensitivity.value = 1.75558f;//GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sensitivity.value = GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens;
|
||||
compassRealistic.isOn = GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().compass;
|
||||
}
|
||||
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length != 0)
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens = Sensitivity.value;
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().compass = compassRealistic.isOn;
|
||||
|
||||
var percent = ((Sensitivity.value - 0.5f) / (3f - 0.5f)) * 100;
|
||||
SensitvityShow.text = "Sensitivity: " + ((int)percent).ToString();
|
||||
}
|
||||
|
||||
|
||||
isFullscreen = Screen.fullScreen;
|
||||
resolutions = Screen.resolutions;
|
||||
|
||||
List<string> resolutionList = new List<string>();
|
||||
string newRes;
|
||||
foreach (Resolution res in resolutions)
|
||||
{
|
||||
newRes = res.width.ToString() + " x " + res.height.ToString();
|
||||
if (!resolutionList.Contains(newRes))
|
||||
{
|
||||
resolutionList.Add(newRes);
|
||||
selectedResolutionList.Add(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resSelect.AddOptions(resolutionList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ChangeResolution()
|
||||
{
|
||||
selectedResolution = resSelect.value;
|
||||
Screen.SetResolution(selectedResolutionList[selectedResolution].width, selectedResolutionList[selectedResolution].height, isFullscreen);
|
||||
}
|
||||
|
||||
public void ChangeFullScreen()
|
||||
{
|
||||
isFullscreen = fsToggle.isOn;
|
||||
Screen.SetResolution(selectedResolutionList[selectedResolution].width, selectedResolutionList[selectedResolution].height, isFullscreen);
|
||||
}
|
||||
|
||||
public void ChangeFramerate()
|
||||
{
|
||||
if (frSlider.value > 240)
|
||||
{
|
||||
frAmount.text = "FPS Limit: None";
|
||||
Application.targetFrameRate = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frAmount.text = "FPS Limit: " + frSlider.value.ToString();
|
||||
Application.targetFrameRate = (int)frSlider.value;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeSensitivity()
|
||||
{
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length != 0)
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens = Sensitivity.value;
|
||||
|
||||
var percent = ((Sensitivity.value - 0.5f) / (3f - 0.5f)) * 100;
|
||||
SensitvityShow.text = "Sensitivity: " + ((int)percent).ToString();
|
||||
}
|
||||
}
|
||||
public void ChangeCompass()
|
||||
{
|
||||
if (GameObject.FindGameObjectsWithTag("Sens").Length != 0)
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().compass = compassRealistic.isOn;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void ResumeGame()
|
||||
{
|
||||
mainCanvas.SetActive(true);
|
||||
pauseCanvas.SetActive(false);
|
||||
settingsCanvas.SetActive(false);
|
||||
Time.timeScale = 1;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
}
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
|
||||
public void OpenSettings()
|
||||
{
|
||||
pauseCanvas.SetActive(false);
|
||||
settingsCanvas.SetActive(true);
|
||||
}
|
||||
public void CloseSettings()
|
||||
{
|
||||
settingsCanvas.SetActive(false);
|
||||
pauseCanvas.SetActive(true);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6cf1b200c9c7e943a6e1a518cc960b4
|
||||
@@ -1,70 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayerCam : MonoBehaviour
|
||||
{
|
||||
float sens;
|
||||
public Transform orientation;
|
||||
public Transform player;
|
||||
float xRotation;
|
||||
float yRotation;
|
||||
public Vector2 lookInput;
|
||||
public Transform wagonRot;
|
||||
private Quaternion previousSourceRotation;
|
||||
|
||||
public bool canLook;
|
||||
|
||||
public Slider Sensitivity;
|
||||
private void Awake()
|
||||
{
|
||||
//if (GameObject.FindGameObjectsWithTag("Sens").Length != 0)
|
||||
// sens = GameObject.FindGameObjectWithTag("Sens").GetComponent<SensitivityValue>().cameraSens;
|
||||
//else
|
||||
// sens = 1.75558f;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
|
||||
previousSourceRotation = wagonRot.rotation;
|
||||
|
||||
yRotation += 90;
|
||||
xRotation += 20;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Time.timeScale == 1)
|
||||
{
|
||||
if (wagonRot != null && GameObject.FindGameObjectsWithTag("WagonPoint").Length > 0)
|
||||
{
|
||||
Quaternion rotationDelta = wagonRot.rotation * Quaternion.Inverse(previousSourceRotation);
|
||||
transform.rotation *= rotationDelta;
|
||||
previousSourceRotation = wagonRot.rotation;
|
||||
Vector3 deltaEuler = rotationDelta.eulerAngles;
|
||||
yRotation += deltaEuler.y;
|
||||
}
|
||||
|
||||
|
||||
sens = Sensitivity.value;
|
||||
if (canLook)
|
||||
{
|
||||
yRotation += lookInput.x * sens * 50 * Time.deltaTime;
|
||||
xRotation -= lookInput.y * sens * 50 * Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
xRotation = Mathf.Clamp(xRotation, -87f, 87f);
|
||||
|
||||
|
||||
|
||||
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
|
||||
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
|
||||
player.rotation = Quaternion.Euler(0, yRotation, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e17a974d7d0e5443922bb32c1f9e012
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37494bcaed8719f4bad2c63c305bc58c
|
||||
@@ -1,56 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Rocket : MonoBehaviour
|
||||
{
|
||||
public PlayerMovement playerMovement;
|
||||
public GameObject player;
|
||||
public Vector3 TargetPosition;
|
||||
public float playerDistance;
|
||||
|
||||
public Vector3 direction;
|
||||
public Quaternion targetRotation;
|
||||
public float rotationSpeed = 30;
|
||||
|
||||
public bool isStuck;
|
||||
public float despawnTimer = 10;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.Find("Player");
|
||||
playerMovement = FindObjectOfType<PlayerMovement>();
|
||||
TargetPosition = player.transform.position;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (playerDistance >= 25)
|
||||
{
|
||||
rotationSpeed = 60;
|
||||
}
|
||||
else{
|
||||
rotationSpeed = 30;
|
||||
}
|
||||
direction = (player.transform.position - transform.position).normalized;
|
||||
targetRotation = Quaternion.LookRotation(direction);
|
||||
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 30 * Time.deltaTime);
|
||||
|
||||
playerDistance = Vector3.Distance(transform.position, player.transform.position);
|
||||
transform.Translate(Vector3.forward * Time.deltaTime * (playerDistance/1.5f+8));
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log("Hit Player");
|
||||
playerMovement.HP -= 2f;
|
||||
}
|
||||
else if (other.CompareTag("Boss")){
|
||||
Debug.Log("Shooting");
|
||||
}
|
||||
else if (other.CompareTag("Ground")){
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc567df950c9c44c2a3ada34152072e4
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SensitivityValue : MonoBehaviour
|
||||
{
|
||||
public float cameraSens;
|
||||
public bool compass;
|
||||
void Start()
|
||||
{
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e9e0cffbce012243a1290df70438789
|
||||
@@ -1,184 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SteampunkBoss : MonoBehaviour
|
||||
{
|
||||
public PlayerMovement playerMovement;
|
||||
public GameObject Player;
|
||||
public int randomNumber = 0;
|
||||
public float stallTimer = 0;
|
||||
public bool setTimer = false;
|
||||
public Vector3 TargetPosition;
|
||||
public bool setposition = false;
|
||||
|
||||
public GameObject JumpHitbox;
|
||||
|
||||
public GameObject LungeHitbox;
|
||||
public float lungeBackup;
|
||||
|
||||
public GameObject Rocket;
|
||||
public bool rocketShot = false;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (stallTimer <= 0)
|
||||
{
|
||||
transform.LookAt(Player.transform);
|
||||
randomNumber = Random.Range(1, 6);
|
||||
setTimer = false;
|
||||
}
|
||||
|
||||
if (randomNumber == 1)
|
||||
{
|
||||
JumpAttack();
|
||||
}
|
||||
else if (randomNumber == 2)
|
||||
{
|
||||
RocketAttack();
|
||||
}
|
||||
else if (randomNumber == 3)
|
||||
{
|
||||
LungeAttack();
|
||||
}
|
||||
else if (randomNumber == 4)
|
||||
{
|
||||
SlashAttack();
|
||||
}
|
||||
else if (randomNumber == 5)
|
||||
{
|
||||
Block();
|
||||
}
|
||||
}
|
||||
|
||||
void JumpAttack()
|
||||
{
|
||||
if (!setTimer)
|
||||
{
|
||||
stallTimer = 1;
|
||||
setTimer = true;
|
||||
}
|
||||
if (!setposition)
|
||||
{
|
||||
TargetPosition = Player.transform.position;
|
||||
setposition = true;
|
||||
}
|
||||
transform.position = Vector3.MoveTowards(transform.position, new Vector3(TargetPosition.x, 20, TargetPosition.z), 20 * Time.deltaTime);
|
||||
if ((transform.position.x == TargetPosition.x) && (transform.position.z == TargetPosition.z))
|
||||
{
|
||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 80 * Time.deltaTime);
|
||||
JumpHitbox.SetActive(true);
|
||||
}
|
||||
if (transform.position == TargetPosition)
|
||||
{
|
||||
JumpHitbox.SetActive(false);
|
||||
stallTimer -= Time.deltaTime;
|
||||
}
|
||||
if (stallTimer <= 0)
|
||||
{
|
||||
setposition = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RocketAttack()
|
||||
{
|
||||
if (!setTimer)
|
||||
{
|
||||
stallTimer = 3;
|
||||
setTimer = true;
|
||||
}
|
||||
if (!setposition)
|
||||
{
|
||||
TargetPosition = Player.transform.position;
|
||||
setposition = true;
|
||||
}
|
||||
if (stallTimer >= 2.6 && randomNumber == 2)
|
||||
{
|
||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, -30 * Time.deltaTime);
|
||||
}
|
||||
else if (!rocketShot)
|
||||
{
|
||||
Instantiate(Rocket, transform.position, transform.rotation);
|
||||
rocketShot = true;
|
||||
}
|
||||
stallTimer -= Time.deltaTime;
|
||||
if (stallTimer <= 0)
|
||||
{
|
||||
setposition = false;
|
||||
rocketShot = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LungeAttack()
|
||||
{
|
||||
if (!setTimer)
|
||||
{
|
||||
stallTimer = 0.5f;
|
||||
setTimer = true;
|
||||
}
|
||||
if (!setposition)
|
||||
{
|
||||
TargetPosition = Player.transform.position;
|
||||
setposition = true;
|
||||
}
|
||||
if (lungeBackup > 0)
|
||||
{
|
||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, -10 * Time.deltaTime);
|
||||
lungeBackup -= Time.deltaTime;
|
||||
}
|
||||
if (lungeBackup <= 0)
|
||||
{
|
||||
LungeHitbox.SetActive(true);
|
||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 30 * Time.deltaTime);
|
||||
}
|
||||
if (transform.position == TargetPosition)
|
||||
{
|
||||
LungeHitbox.SetActive(false);
|
||||
stallTimer -= Time.deltaTime;
|
||||
}
|
||||
if (stallTimer <= 0)
|
||||
{
|
||||
lungeBackup = 1;
|
||||
setposition = false;
|
||||
}
|
||||
}
|
||||
|
||||
void SlashAttack()
|
||||
{
|
||||
if (!setTimer)
|
||||
{
|
||||
stallTimer = 1;
|
||||
setTimer = true;
|
||||
}
|
||||
|
||||
stallTimer -= Time.deltaTime;
|
||||
}
|
||||
|
||||
void Block()
|
||||
{
|
||||
if (!setTimer)
|
||||
{
|
||||
stallTimer = 1;
|
||||
setTimer = true;
|
||||
}
|
||||
|
||||
stallTimer -= Time.deltaTime;
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log("Hit Player");
|
||||
playerMovement.HP -= 1;
|
||||
}
|
||||
else{
|
||||
Debug.Log("Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d8198e3ebde5469e8ad7d54300da09f
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
public class SwordSlash : MonoBehaviour
|
||||
{
|
||||
public float timer1;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
timer1 -= Time.deltaTime;
|
||||
if (timer1 <= 0)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
transform.Rotate(Vector3.right * 850 * Time.deltaTime, Space.Self);
|
||||
}
|
||||
|
||||
//public void OnTriggerEnter(Collider other)
|
||||
//{
|
||||
// Debug.Log("hit");
|
||||
//}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 789056675dc7b68439f36a72e0c451aa
|
||||
@@ -1,62 +0,0 @@
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class TerrainTreeColider : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Terrain terrain;
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
terrain = GetComponent<Terrain>();
|
||||
|
||||
Extract();
|
||||
}
|
||||
|
||||
[ContextMenu("Extract")]
|
||||
public void Extract()
|
||||
{
|
||||
Collider[] colliders = terrain.GetComponentsInChildren<Collider>();
|
||||
|
||||
//Skip the first, since its the Terrain Collider
|
||||
for (int i = 1; i < colliders.Length; i++)
|
||||
{
|
||||
//Delete all previously created colliders first
|
||||
DestroyImmediate(colliders[i].gameObject);
|
||||
}
|
||||
|
||||
for (int i = 0; i < terrain.terrainData.treePrototypes.Length; i++)
|
||||
{
|
||||
TreePrototype tree = terrain.terrainData.treePrototypes[i];
|
||||
|
||||
//Get all instances matching the prefab index
|
||||
TreeInstance[] instances = terrain.terrainData.treeInstances.Where(x => x.prototypeIndex == i).ToArray();
|
||||
|
||||
for (int j = 0; j < instances.Length; j++)
|
||||
{
|
||||
//Un-normalize positions so they're in world-space
|
||||
instances[j].position = Vector3.Scale(instances[j].position, terrain.terrainData.size);
|
||||
instances[j].position += terrain.GetPosition();
|
||||
|
||||
//Fetch the collider from the prefab object parent
|
||||
CapsuleCollider prefabCollider = tree.prefab.GetComponent<CapsuleCollider>();
|
||||
if (!prefabCollider) continue;
|
||||
|
||||
GameObject obj = new GameObject();
|
||||
obj.name = tree.prefab.name + j;
|
||||
|
||||
CapsuleCollider objCollider = obj.AddComponent<CapsuleCollider>();
|
||||
|
||||
objCollider.center = prefabCollider.center;
|
||||
objCollider.height = prefabCollider.height;
|
||||
objCollider.radius = prefabCollider.radius;
|
||||
|
||||
if (terrain.preserveTreePrototypeLayers) obj.layer = tree.prefab.layer;
|
||||
else obj.layer = terrain.gameObject.layer;
|
||||
|
||||
obj.transform.position = instances[j].position;
|
||||
obj.transform.parent = terrain.transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 132f317f0462390469d96b783cea9abe
|
||||
@@ -1,84 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class ThrowerEnemy : MonoBehaviour
|
||||
{
|
||||
public float hp;
|
||||
public float hurtAmount;
|
||||
public MeshRenderer MeshRenderer;
|
||||
public Material def;
|
||||
public Material hur;
|
||||
public bool isInside;
|
||||
|
||||
public float playerDistance;
|
||||
public GameObject GunThrow;
|
||||
public bool canThrow = false;
|
||||
public float throwTimer = 5;
|
||||
|
||||
private NavMeshAgent agent;
|
||||
public Transform target;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
MeshRenderer = GetComponent<MeshRenderer>();
|
||||
agent = GetComponent<NavMeshAgent>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
agent.SetDestination(target.position);
|
||||
if (hp < 0)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
if (!isInside && hp != 0)
|
||||
MeshRenderer.material = def;
|
||||
|
||||
if (!canThrow)
|
||||
{
|
||||
throwTimer -= Time.deltaTime;
|
||||
|
||||
if (throwTimer < 0)
|
||||
{
|
||||
canThrow = true;
|
||||
throwTimer = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
void FixedUpdate()
|
||||
{
|
||||
playerDistance = Vector3.Distance(transform.position, target.position);
|
||||
if (playerDistance < 25 && canThrow)
|
||||
{
|
||||
Instantiate(GunThrow, transform.position, Quaternion.identity);
|
||||
canThrow = false;
|
||||
}
|
||||
}
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (hp == 0)
|
||||
hp -= 1;
|
||||
isInside = false;
|
||||
}
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Sword")
|
||||
{
|
||||
hp -= hurtAmount;
|
||||
MeshRenderer.material = hur;
|
||||
}
|
||||
}
|
||||
public void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Sword")
|
||||
isInside = true;
|
||||
}
|
||||
public void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Sword" && hp != 0)
|
||||
MeshRenderer.material = def;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d43b0a839f0bf4971aa5f6099f6ea211
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class asyncLoad : MonoBehaviour
|
||||
{
|
||||
|
||||
public float timer = 3;
|
||||
public bool go;
|
||||
public bool go1;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(LoadScene());
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (go)
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0) go1 = true;
|
||||
}
|
||||
|
||||
}
|
||||
IEnumerator LoadScene()
|
||||
{
|
||||
AsyncOperation loadScene = SceneManager.LoadSceneAsync(1);
|
||||
loadScene.allowSceneActivation = false;
|
||||
|
||||
while (!loadScene.isDone)
|
||||
{
|
||||
if (loadScene.progress >= 0.9f)
|
||||
{
|
||||
go = true;
|
||||
if (go1) loadScene.allowSceneActivation=true;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae7af5ad071235e4dae4ed07b7cfee71
|
||||
@@ -1,56 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class itemBob : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
public float xFrequency;
|
||||
public float xAmplitude;
|
||||
public float yFrequency;
|
||||
public float yAmplitude;
|
||||
public float zFrequency;
|
||||
public float zAmplitude;
|
||||
|
||||
public GameObject player;
|
||||
public float vel;
|
||||
public float vel2;
|
||||
public bool swapped;
|
||||
public bool wagon;
|
||||
private Vector3 initialLocalPosition;
|
||||
|
||||
void Start()
|
||||
{
|
||||
initialLocalPosition = transform.localPosition;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
//Debug.Log(player.GetComponent<Rigidbody>().linearVelocity.magnitude);
|
||||
vel = Mathf.Clamp(player.GetComponent<Rigidbody>().linearVelocity.magnitude, 0, 10);
|
||||
|
||||
if (wagon)
|
||||
{
|
||||
float offsetX = Mathf.Sin(Time.time * xFrequency) * xAmplitude * vel2;
|
||||
float offsetY = Mathf.Sin(Time.time * yFrequency) * yAmplitude * vel2;
|
||||
float offsetZ = Mathf.Sin(Time.time * zFrequency) * zAmplitude * vel2;
|
||||
transform.localPosition = initialLocalPosition + new Vector3(offsetX, offsetY, offsetZ);
|
||||
}
|
||||
else if (swapped)
|
||||
{
|
||||
float offsetX = Mathf.Sin(Time.time * xFrequency*-1) * xAmplitude * vel;
|
||||
float offsetY = Mathf.Sin(Time.time * yFrequency*-1) * yAmplitude * vel;
|
||||
float offsetZ = Mathf.Sin(Time.time * zFrequency*-1) * zAmplitude * vel;
|
||||
transform.localPosition = initialLocalPosition + new Vector3(offsetX, offsetY, offsetZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
float offsetX = Mathf.Sin(Time.time * xFrequency) * xAmplitude * vel;
|
||||
float offsetY = Mathf.Sin(Time.time * yFrequency) * yAmplitude * vel;
|
||||
float offsetZ = Mathf.Sin(Time.time * zFrequency) * zAmplitude * vel;
|
||||
transform.localPosition = initialLocalPosition + new Vector3(offsetX, offsetY, offsetZ);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0033ea7283aaa8f4c9921e483d1271c1
|
||||
@@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class treeFadeOut : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ec0c33ae1a35054eae7d1c043a6833c
|
||||
Reference in New Issue
Block a user