mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
did a minor tweak
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AnimationControllerTester : MonoBehaviour {
|
||||
public Animator animator;
|
||||
public int numberOfAnimations = 1;
|
||||
public string animationPropertyName = "Animation";
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
// Get current time
|
||||
int second = (int) (Time.time / 1.5f);
|
||||
int animationIndex = second % numberOfAnimations;
|
||||
animator.SetInteger(animationPropertyName, animationIndex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94816f70614b7460bb8fda6a86257bdd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
|
||||
public AudioMixer theMixer;
|
||||
public Sound[] sounds;
|
||||
public AudioMixerGroup SFX;
|
||||
public AudioMixerGroup Music;
|
||||
public AudioMixerGroup Master;
|
||||
//public AudioSource.AudioMixerGroup outputAudioMixerGroup;
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
foreach (Sound s in sounds)
|
||||
{
|
||||
s.source = gameObject.AddComponent<AudioSource>();
|
||||
s.source.clip = s.clip;
|
||||
s.source.volume = s.volume;
|
||||
s.source.pitch = s.pitch;
|
||||
if (s.output == "SFX")
|
||||
{
|
||||
s.source.outputAudioMixerGroup = SFX;
|
||||
}
|
||||
if (s.output == "Music")
|
||||
{
|
||||
s.source.outputAudioMixerGroup = Music;
|
||||
}
|
||||
if (s.output == "Master")
|
||||
{
|
||||
s.source.outputAudioMixerGroup = Master;
|
||||
}
|
||||
//s.source.outputAudioMixerGroup = s.output;
|
||||
}
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
if (PlayerPrefs.HasKey("MasterVol"))
|
||||
{
|
||||
theMixer.SetFloat("MasterVol", PlayerPrefs.GetFloat("MasterVol"));
|
||||
}
|
||||
if (PlayerPrefs.HasKey("MusicVol"))
|
||||
{
|
||||
theMixer.SetFloat("MusicVol", PlayerPrefs.GetFloat("MusicVol"));
|
||||
}
|
||||
if (PlayerPrefs.HasKey("SFXVol"))
|
||||
{
|
||||
theMixer.SetFloat("SFXVol", PlayerPrefs.GetFloat("SFXVol"));
|
||||
}
|
||||
}
|
||||
|
||||
public void Play(string name)
|
||||
{
|
||||
Sound s = Array.Find(sounds, sounds => sounds.name == name);
|
||||
s.source.Play();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff8c6d62e5fc0f6478840a18add47f3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class BeatBirds : MonoBehaviour
|
||||
{
|
||||
public int currentLevel;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
/*void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
BeatLevel();
|
||||
}
|
||||
}*/
|
||||
|
||||
void BeatLevel()
|
||||
{
|
||||
|
||||
if (currentLevel == 5)
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", 6);
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7fc069efc8f4224aaa8c2d3777e1f8d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class BeatCrowds : MonoBehaviour
|
||||
{
|
||||
public int currentLevel;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
/*void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
BeatLevel();
|
||||
}
|
||||
}*/
|
||||
|
||||
void BeatLevel()
|
||||
{
|
||||
|
||||
if (currentLevel == 6)
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", 7);
|
||||
SceneManager.LoadScene("Real World");
|
||||
}else
|
||||
{
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7bf3298a6b40104a881d9cd954affb4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class BeatDark : MonoBehaviour
|
||||
{
|
||||
public int currentLevel;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
/*void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
BeatLevel();
|
||||
}
|
||||
}*/
|
||||
|
||||
void BeatLevel()
|
||||
{
|
||||
|
||||
if (currentLevel == 3)
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", 4);
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f3324bdaa895394db1ed827a820ab8c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class BeatHeights : MonoBehaviour
|
||||
{
|
||||
public int currentLevel;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
/*void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
BeatLevel();
|
||||
}
|
||||
}*/
|
||||
|
||||
void BeatLevel()
|
||||
{
|
||||
|
||||
if (currentLevel == 1)
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", 2);
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13ce7dadc96f7ff43a1d8b51afb8322e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class BeatSpeed : MonoBehaviour
|
||||
{
|
||||
public int currentLevel;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
/*void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
BeatLevel();
|
||||
}
|
||||
}*/
|
||||
|
||||
void BeatLevel()
|
||||
{
|
||||
|
||||
if (currentLevel == 2)
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", 3);
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21c5cca605a46f745bb09ab491d4a986
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class BeatWater : MonoBehaviour
|
||||
{
|
||||
public int currentLevel;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
/*void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
BeatLevel();
|
||||
}
|
||||
}*/
|
||||
|
||||
void BeatLevel()
|
||||
{
|
||||
|
||||
if (currentLevel == 4)
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", 5);
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1bd6789c74094048813e24b1c43ed5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Bird : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
|
||||
// public Movement controller;
|
||||
public int birdType;
|
||||
public Animator animator;
|
||||
public float horizontalMove = -1f;
|
||||
[SerializeField] float runSpeed = 40f;
|
||||
private Rigidbody2D m_Rigidbody2D;
|
||||
[SerializeField] float deltaY;
|
||||
[SerializeField] float frequency;
|
||||
private float elapsed = 0;
|
||||
[Range(0, .3f)][SerializeField] private float m_MovementSmoothing = .05f;
|
||||
Vector3 m_Velocity = Vector3.zero;
|
||||
|
||||
//constructs an NPC using parameters
|
||||
|
||||
void Start()
|
||||
{
|
||||
m_Rigidbody2D = GetComponent<Rigidbody2D>();
|
||||
horizontalMove *= runSpeed;
|
||||
animator.SetInteger("Animation", birdType);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
// if(Movement.pause) {
|
||||
// animator.SetFloat("Horizontal", 0);
|
||||
// }
|
||||
// if (animator != null && !Movement.pause) {
|
||||
// animator.SetFloat("Horizontal", (horizontalMove/Mathf.Abs(horizontalMove)));
|
||||
// animator.SetBool("Airborne", !controller.m_Grounded);
|
||||
// }
|
||||
if(!Movement.pause){
|
||||
elapsed += Time.deltaTime;
|
||||
Vector3 targetVelocity = new Vector2(horizontalMove, Mathf.Sin(elapsed * frequency) * deltaY);
|
||||
// And then smoothing it out and applying it to the character
|
||||
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
|
||||
|
||||
}
|
||||
else {
|
||||
m_Rigidbody2D.velocity = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
//NPC movement determined by script in subclasses
|
||||
// void FixedUpdate()
|
||||
// {
|
||||
// controller.Move(horizontalMove *Time.fixedDeltaTime, false, false);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33ae55f3d792d2043a282a498c7203e1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BookTrigger : Trigger
|
||||
{
|
||||
public GameObject bookFinder;
|
||||
|
||||
|
||||
public override void Action()
|
||||
{
|
||||
bookFinder.GetComponent<WorldScreenController>().OpenBook();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10dee861b1d1e2549b75d0690524e587
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CarScript : MonoBehaviour {
|
||||
public float speed = 3f;
|
||||
|
||||
private Rigidbody2D rb;
|
||||
public Vector2 startPositionRelativeToTransform;
|
||||
public Vector2 endPositionRelativeToTransform;
|
||||
|
||||
private Vector2 absStartPosition, absEndPosition;
|
||||
|
||||
void Start() {
|
||||
rb = this.GetComponent<Rigidbody2D>();
|
||||
absStartPosition = startPositionRelativeToTransform + rb.position;
|
||||
absEndPosition = endPositionRelativeToTransform + rb.position;
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
if (Movement.pause) return;
|
||||
// Calculate distance to end
|
||||
Vector2 distanceToFinish = absEndPosition - rb.position;
|
||||
|
||||
if (distanceToFinish.magnitude < 1) {
|
||||
// If we're close enough to the end, reverse direction
|
||||
Vector2 temp = absStartPosition;
|
||||
absStartPosition = absEndPosition;
|
||||
absEndPosition = temp;
|
||||
transform.localScale = new Vector3(-transform.localScale.x, 1, 1);
|
||||
}
|
||||
|
||||
Vector2 direction = absEndPosition - rb.position;
|
||||
|
||||
moveMe(direction.normalized);
|
||||
}
|
||||
void moveMe(Vector2 direction) {
|
||||
rb.MovePosition(rb.position + direction * speed * Time.fixedDeltaTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3468d2cd767147b1be034bbad8afcb5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Ceiling_Trigger : MonoBehaviour
|
||||
{
|
||||
public GameObject cam;
|
||||
public GameObject cat;
|
||||
public BoxCollider2D box;
|
||||
private int counter = 0;
|
||||
[Range (1f,25f)]public float camOffset = 10f;
|
||||
[Range (1f,15f)] public float catOffset = 5f;
|
||||
[Range(5, 180)] public int countOffset = 10;
|
||||
private LayerMask layerMask;
|
||||
private Vector3 moveCam;
|
||||
private Vector3 moveCat;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
moveCam = new Vector3(0, camOffset, 0);
|
||||
moveCat = new Vector3(0, catOffset, 0);
|
||||
layerMask = LayerMask.GetMask("Player");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
void OnTriggerEnter2D(Collider2D col)
|
||||
{
|
||||
float ye = cat.transform.position.y;
|
||||
float goaly = box.transform.position.y;
|
||||
if ((ye < goaly && counter >= countOffset))
|
||||
{
|
||||
cam.transform.position += moveCam;
|
||||
cat.transform.position += moveCat;
|
||||
counter = 0;
|
||||
}
|
||||
else if ((ye >= goaly && counter > countOffset))
|
||||
{
|
||||
cam.transform.position -= moveCam;
|
||||
cat.transform.position -= moveCat;
|
||||
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5cf4f43ae0936c443a05276d3fd59404
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DestroyTrigger : Trigger
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
public override void Action() {
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63df55f0b85b8794da1ed45e67db5bd2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,151 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class Dialogue : MonoBehaviour
|
||||
{
|
||||
public Animator animator;
|
||||
public RuntimeAnimatorController controller;
|
||||
public TMP_Text textbox;
|
||||
public TMP_Text arrow;
|
||||
public AudioManager audioManager;
|
||||
public List<string> pages = new List<string>();
|
||||
public List<int> emotes = new List<int>();
|
||||
int curPage = 0;
|
||||
public bool isOpen = false;
|
||||
public bool isDream = false;
|
||||
//used to activate/deactivate test object
|
||||
//activate through outside means probably
|
||||
public GameObject textTest;
|
||||
//used to print the first x letters of the text
|
||||
int cCount = 0;
|
||||
//changes the pace at which chars appear
|
||||
//in seconds
|
||||
float pace = 0.05f;
|
||||
float elapsed = 0f;
|
||||
//turns off and on sound
|
||||
public bool isTalking;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
if (pages.Count > 0)
|
||||
{
|
||||
arrow.text = "";
|
||||
}
|
||||
animator.runtimeAnimatorController = controller;
|
||||
}
|
||||
|
||||
//Adds a page of text
|
||||
void AddPage(string text)
|
||||
{
|
||||
pages.Add(text);
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//only pauses if opened
|
||||
if(isOpen)
|
||||
{
|
||||
//pause
|
||||
Movement.pause = true;
|
||||
//checks if all of the characters are on the page
|
||||
if(cCount >= pages[curPage].Length)
|
||||
{
|
||||
//stops the animation
|
||||
if(animator != null && emotes.Count == pages.Count) {
|
||||
animator.SetInteger("Animation",emotes[curPage] - 1);
|
||||
}
|
||||
//prints the "next" arrow when at end of page except last page
|
||||
if(curPage < pages.Count - 1)
|
||||
{
|
||||
arrow.text = ">";
|
||||
}
|
||||
else
|
||||
{
|
||||
arrow.text = "x";
|
||||
}
|
||||
elapsed = 0;
|
||||
if(Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.DownArrow) ||
|
||||
Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
//scroll through textbox using any movement key
|
||||
if(curPage >= pages.Count - 1)
|
||||
{
|
||||
//exits the textbox
|
||||
isOpen = false;
|
||||
Movement.pause = false;
|
||||
Destroy(textTest);
|
||||
cCount = 0;
|
||||
curPage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//resets pace of chars
|
||||
arrow.text = "";
|
||||
++curPage;
|
||||
cCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//starts the animation
|
||||
if(animator != null && emotes.Count == pages.Count) {
|
||||
animator.SetInteger("Animation",emotes[curPage]);
|
||||
}
|
||||
//writes chars at specified pace
|
||||
elapsed += Time.deltaTime;
|
||||
if(elapsed > pace)
|
||||
{
|
||||
++cCount;
|
||||
textbox.text = pages[curPage].Substring(0, cCount);
|
||||
elapsed = 0;
|
||||
if (isTalking)
|
||||
{
|
||||
int RNGSound = Random.Range(0, 2);
|
||||
if (isDream == true)
|
||||
{
|
||||
if (RNGSound == 0)
|
||||
{
|
||||
audioManager.Play("dreamblip");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
audioManager.Play("dreamblop");
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RNGSound == 0)
|
||||
{
|
||||
audioManager.Play("blip");
|
||||
Debug.Log("blip");
|
||||
}
|
||||
else
|
||||
{
|
||||
audioManager.Play("blop");
|
||||
Debug.Log("blop");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//skip ahead
|
||||
if(Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.DownArrow) ||
|
||||
Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
cCount = pages[curPage].Length;
|
||||
textbox.text = pages[curPage];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//unpause
|
||||
else
|
||||
{
|
||||
Movement.pause = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4098cb6d8f351b44ca98b3bb6311f330
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections;
|
||||
|
||||
// @MindfulMinun
|
||||
public class Health : MonoBehaviour {
|
||||
public int startingHealth = 3;
|
||||
public float damageTimeout = 1f;
|
||||
public int currentHealth;
|
||||
public bool isInvincible;
|
||||
public bool isDead;
|
||||
public UnityEvent OnDead = new UnityEvent();
|
||||
public UnityEvent OnHit = new UnityEvent();
|
||||
|
||||
void Start() {
|
||||
currentHealth = startingHealth;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
// if (Input.GetKeyDown(KeyCode.)) {
|
||||
// takeHit();
|
||||
// }
|
||||
}
|
||||
|
||||
public void takeHit() {
|
||||
if (isInvincible) return;
|
||||
currentHealth = Mathf.Clamp(currentHealth - 1, 0, startingHealth);
|
||||
isDead = currentHealth <= 0;
|
||||
OnHit.Invoke();
|
||||
if (isDead) OnDead.Invoke();
|
||||
StartCoroutine(damageTimer());
|
||||
}
|
||||
|
||||
// Waits for a second before allowing the player to take damage again
|
||||
private IEnumerator damageTimer() {
|
||||
bool wasInvincible = isInvincible;
|
||||
isInvincible = true;
|
||||
yield return new WaitForSeconds(damageTimeout);
|
||||
isInvincible = wasInvincible;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ea69ce370e264d42b693f40a13a25b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Interaction : MonoBehaviour
|
||||
{
|
||||
public Transform detectionPoint;
|
||||
public float radius = 3f;
|
||||
public LayerMask detectLayer;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool InteractInput() {
|
||||
if(Input.GetKeyDown(KeyCode.E))
|
||||
Debug.Log("input");
|
||||
return true;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(DetectObject()) {
|
||||
if(InteractInput()) {
|
||||
Debug.Log("interacted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DetectObject() {
|
||||
if(Physics2D.OverlapCircle(detectionPoint.position, radius, detectLayer))
|
||||
Debug.Log("detected");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63ebc7b06abc3e848a932ff1f7c7e3b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MainCharScript : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//Hello!
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5b8173df8386e44185e05b75f55e258
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MeanBird : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
// public Movement controller;
|
||||
public Animator animator;
|
||||
[SerializeField] float runSpeed = 5.0f;
|
||||
// private Rigidbody2D m_Rigidbody2D;
|
||||
private bool attack;
|
||||
private Vector3 direction;
|
||||
Transform player;
|
||||
[SerializeField] float detectRange;
|
||||
|
||||
private float accelTime = 1f;
|
||||
private float elapsed = 0f;
|
||||
private float t;
|
||||
|
||||
//constructs an NPC using parameters
|
||||
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player").transform;
|
||||
animator.SetInteger("Animation", 2);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
// if(Movement.pause) {
|
||||
// animator.SetFloat("Horizontal", 0);
|
||||
// }
|
||||
// if (animator != null && !Movement.pause) {
|
||||
// animator.SetFloat("Horizontal", (horizontalMove/Mathf.Abs(horizontalMove)));
|
||||
// animator.SetBool("Airborne", !controller.m_Grounded);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void FixedUpdate() {
|
||||
if(!attack) {
|
||||
direction = player.position - transform.position;
|
||||
if(direction.magnitude < detectRange) {
|
||||
attack = true;
|
||||
animator.SetInteger("Animation", 3);
|
||||
Debug.Log("attack");
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(t < 1f) {
|
||||
t = elapsed / accelTime;
|
||||
t = t * t * (3f - 2f * t);
|
||||
}
|
||||
else {
|
||||
t = 1f;
|
||||
}
|
||||
GetComponent<Rigidbody2D>().MovePosition(transform.position + direction.normalized * runSpeed * t / 100f);
|
||||
elapsed += Time.fixedDeltaTime;
|
||||
}
|
||||
}
|
||||
private void OnTriggerEnter2D(Collider2D collision) {
|
||||
if (collision.tag == "Player") {
|
||||
collision.GetComponent<Health>().takeHit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2ac1ab11e649f44588372b17008679c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class MenuController : MonoBehaviour
|
||||
{
|
||||
public GameObject pauseMenu;
|
||||
public bool isPaused;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
if (isPaused)
|
||||
{
|
||||
ResumeGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
isPaused = true;
|
||||
pauseMenu.SetActive(true);
|
||||
Time.timeScale = 0f;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void ResumeGame()
|
||||
{
|
||||
isPaused = false;
|
||||
pauseMenu.SetActive(false);
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
|
||||
public void ReturnToMain()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene("Main Menu");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 124f85fe181674b4ba16b24a7202af6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,167 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class Movement : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float m_JumpForce = 400f; // Amount of force added when the player jumps.
|
||||
[Range(0, 1)][SerializeField] private float m_CrouchSpeed = .8f; // Amount of maxSpeed applied to crouching movement. 1 = 100%
|
||||
[Range(0, .3f)][SerializeField] private float m_MovementSmoothing = .05f; // How much to smooth out the movement
|
||||
[SerializeField] private bool m_AirControl = false; // Whether or not a player can steer while jumping;
|
||||
/** @MindfulMinun -- This is for the water level, if the player is swimming just let them double jump as many times as they want. */
|
||||
[SerializeField] public bool swimming = false; // Whether or not a player the player is in a swimming level
|
||||
[SerializeField] private LayerMask m_WhatIsGround; // A mask determining what is ground to the character
|
||||
[SerializeField] private Transform m_GroundCheck; // A position marking where to check if the player is grounded.
|
||||
[SerializeField] private Transform m_CeilingCheck; // A position marking where to check for ceilings
|
||||
[SerializeField] private Collider2D m_CrouchDisableCollider; // A collider that will be disabled when crouching
|
||||
|
||||
const float k_GroundedRadius = .2f; // Radius of the overlap circle to determine if grounded
|
||||
public bool m_Grounded; // Whether or not the player is grounded.
|
||||
const float k_CeilingRadius = .2f; // Radius of the overlap circle to determine if the player can stand up
|
||||
private Rigidbody2D m_Rigidbody2D;
|
||||
public bool m_FacingRight = true; // For determining which way the player is currently facing.
|
||||
public Vector3 m_Velocity = Vector3.zero;
|
||||
public static bool pause = false;
|
||||
private bool dj = false;
|
||||
|
||||
[Header("Events")]
|
||||
[Space]
|
||||
|
||||
public UnityEvent OnLandEvent;
|
||||
|
||||
[System.Serializable]
|
||||
public class BoolEvent : UnityEvent<bool> { }
|
||||
|
||||
public BoolEvent OnCrouchEvent;
|
||||
private bool m_wasCrouching = false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
pause = false;
|
||||
m_Rigidbody2D = GetComponent<Rigidbody2D>();
|
||||
|
||||
if (OnLandEvent == null)
|
||||
OnLandEvent = new UnityEvent();
|
||||
|
||||
if (OnCrouchEvent == null)
|
||||
OnCrouchEvent = new BoolEvent();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
bool wasGrounded = m_Grounded;
|
||||
m_Grounded = false;
|
||||
|
||||
// The player is grounded if a circlecast to the groundcheck position hits anything designated as ground
|
||||
// This can be done using layers instead but Sample Assets will not overwrite your project settings.
|
||||
Collider2D[] colliders = Physics2D.OverlapCircleAll(m_GroundCheck.position, k_GroundedRadius, m_WhatIsGround);
|
||||
for (int i = 0; i < colliders.Length; i++)
|
||||
{
|
||||
if (colliders[i].gameObject != gameObject)
|
||||
{
|
||||
m_Grounded = true;
|
||||
if (!wasGrounded)
|
||||
OnLandEvent.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Move(float move, bool crouch, bool jump)
|
||||
{
|
||||
if(!pause)
|
||||
{
|
||||
// If crouching, check to see if the character can stand up
|
||||
if (!crouch)
|
||||
{
|
||||
// If the character has a ceiling preventing them from standing up, keep them crouching
|
||||
if (Physics2D.OverlapCircle(m_CeilingCheck.position, k_CeilingRadius, m_WhatIsGround))
|
||||
{
|
||||
crouch = true;
|
||||
}
|
||||
}
|
||||
|
||||
//only control the player if grounded or airControl is turned on
|
||||
if (m_Grounded || m_AirControl)
|
||||
{
|
||||
|
||||
// If crouching
|
||||
if (crouch)
|
||||
{
|
||||
if (!m_wasCrouching)
|
||||
{
|
||||
m_wasCrouching = true;
|
||||
OnCrouchEvent.Invoke(true);
|
||||
}
|
||||
|
||||
// Reduce the speed by the crouchSpeed multiplier
|
||||
move *= m_CrouchSpeed;
|
||||
|
||||
// Disable one of the colliders when crouching
|
||||
if (m_CrouchDisableCollider != null)
|
||||
m_CrouchDisableCollider.enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enable the collider when not crouching
|
||||
if (m_CrouchDisableCollider != null)
|
||||
m_CrouchDisableCollider.enabled = true;
|
||||
|
||||
if (m_wasCrouching)
|
||||
{
|
||||
m_wasCrouching = false;
|
||||
OnCrouchEvent.Invoke(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Move the character by finding the target velocity
|
||||
Vector3 targetVelocity = new Vector2(move * 10f, m_Rigidbody2D.velocity.y);
|
||||
// And then smoothing it out and applying it to the character
|
||||
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
|
||||
|
||||
// If the input is moving the player right and the player is facing left...
|
||||
if (move > 0 && !m_FacingRight)
|
||||
{
|
||||
// ... flip the player.
|
||||
Flip();
|
||||
}
|
||||
// Otherwise if the input is moving the player left and the player is facing right...
|
||||
else if (move < 0 && m_FacingRight)
|
||||
{
|
||||
// ... flip the player.
|
||||
Flip();
|
||||
}
|
||||
}
|
||||
// If the player should jump...
|
||||
if (m_Grounded && jump)
|
||||
{
|
||||
// Add a vertical force to the player.
|
||||
m_Grounded = false;
|
||||
m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce));
|
||||
dj = false;
|
||||
}else if (jump && (dj == false || swimming == true)){
|
||||
m_Grounded = false;
|
||||
m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce));
|
||||
dj = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Velocity = Vector3.zero;
|
||||
m_Rigidbody2D.velocity = m_Velocity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Flip()
|
||||
{
|
||||
// Switch the way the player is labelled as facing.
|
||||
m_FacingRight = !m_FacingRight;
|
||||
|
||||
// Multiply the player's x local scale by -1.
|
||||
Vector3 theScale = transform.localScale;
|
||||
theScale.x *= -1;
|
||||
transform.localScale = theScale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90da90214d3bb324a8ed8f5b046ba4b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
//WIP
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NPC : MonoBehaviour
|
||||
{
|
||||
|
||||
public Movement controller;
|
||||
public Animator animator;
|
||||
float horizontalMove = 1f;
|
||||
public float runSpeed = 20f;
|
||||
public float leftBound;
|
||||
public float rightBound;
|
||||
float elapsed;
|
||||
public float minDelay;
|
||||
public float maxDelay;
|
||||
float delay;
|
||||
|
||||
//constructs an NPC using parameters
|
||||
|
||||
void Start()
|
||||
{
|
||||
delay = Random.Range(minDelay, maxDelay);
|
||||
horizontalMove = horizontalMove * runSpeed;
|
||||
leftBound += controller.transform.localPosition.x;
|
||||
rightBound -= controller.transform.localPosition.x;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(elapsed > delay) {
|
||||
horizontalMove = -1 * (horizontalMove/Mathf.Abs(horizontalMove)) * runSpeed;
|
||||
elapsed = 0f;
|
||||
delay = Random.Range(minDelay, maxDelay);
|
||||
}
|
||||
if(Movement.pause) {
|
||||
animator.SetFloat("Horizontal", 0);
|
||||
}
|
||||
if (animator != null && !Movement.pause) {
|
||||
animator.SetFloat("Horizontal", (horizontalMove/Mathf.Abs(horizontalMove)));
|
||||
animator.SetBool("Airborne", !controller.m_Grounded);
|
||||
}
|
||||
elapsed += Time.deltaTime;
|
||||
if(transform.localPosition.x > rightBound) {
|
||||
horizontalMove = -1 * runSpeed;
|
||||
} else
|
||||
if(transform.localPosition.x < leftBound) {
|
||||
horizontalMove = runSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
//NPC movement determined by script in subclasses
|
||||
void FixedUpdate()
|
||||
{
|
||||
controller.Move(horizontalMove *Time.fixedDeltaTime, false, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c758205fd1750fd44aa79e63528ce670
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,135 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class OptionsScreen : MonoBehaviour
|
||||
{
|
||||
|
||||
public Toggle fullscreenTog, vsyncTog;
|
||||
public List<ResItem> resolutions = new List<ResItem>();
|
||||
private int selectedResolution;
|
||||
public TMP_Text resolutionLabel;
|
||||
public AudioMixer theMixer;
|
||||
public TMP_Text masterLabel, musicLabel, SFXLabel;
|
||||
public Slider masterSlider, musicSlider, SFXSlider;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
fullscreenTog.isOn = Screen.fullScreen;
|
||||
|
||||
if (QualitySettings.vSyncCount == 0)
|
||||
{
|
||||
vsyncTog.isOn = false;
|
||||
} else
|
||||
{
|
||||
vsyncTog.isOn = true;
|
||||
}
|
||||
|
||||
bool foundRes = false;
|
||||
for (int i = 0; i < resolutions.Count; i++)
|
||||
{
|
||||
if (Screen.width == resolutions[i].horizontal && Screen.height == resolutions[i].vertical)
|
||||
{
|
||||
foundRes = true;
|
||||
selectedResolution = i;
|
||||
UpdateResLabel();
|
||||
}
|
||||
}
|
||||
if (!foundRes)
|
||||
{
|
||||
ResItem newRes = new ResItem();
|
||||
newRes.horizontal = Screen.width;
|
||||
newRes.vertical = Screen.height;
|
||||
resolutions.Add(newRes);
|
||||
selectedResolution = resolutions.Count - 1;
|
||||
UpdateResLabel();
|
||||
}
|
||||
|
||||
float vol = 0f;
|
||||
theMixer.GetFloat("MasterVol", out vol);
|
||||
masterSlider.value = vol;
|
||||
theMixer.GetFloat("MusicVol", out vol);
|
||||
musicSlider.value = vol;
|
||||
theMixer.GetFloat("SFXVol", out vol);
|
||||
SFXSlider.value = vol;
|
||||
|
||||
masterLabel.text = Mathf.RoundToInt(masterSlider.value *5/3+100).ToString();
|
||||
musicLabel.text = Mathf.RoundToInt(musicSlider.value *5/3+100).ToString();
|
||||
SFXLabel.text = Mathf.RoundToInt(SFXSlider.value *5/3+100).ToString();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ResLeft()
|
||||
{
|
||||
selectedResolution--;
|
||||
if (selectedResolution < 0)
|
||||
{
|
||||
selectedResolution = resolutions.Count - 1;
|
||||
}
|
||||
UpdateResLabel();
|
||||
}
|
||||
|
||||
public void ResRight()
|
||||
{
|
||||
selectedResolution++;
|
||||
if (selectedResolution > resolutions.Count - 1)
|
||||
{
|
||||
selectedResolution = 0;
|
||||
}
|
||||
UpdateResLabel();
|
||||
}
|
||||
|
||||
public void UpdateResLabel()
|
||||
{
|
||||
resolutionLabel.text = resolutions[selectedResolution].horizontal.ToString() + " x " + resolutions[selectedResolution].vertical.ToString();
|
||||
}
|
||||
public void ApplyGraphics()
|
||||
{
|
||||
//Screen.fullScreen = fullscreenTog.isOn;
|
||||
|
||||
if (vsyncTog.isOn)
|
||||
{
|
||||
QualitySettings.vSyncCount = 1;
|
||||
} else
|
||||
{
|
||||
QualitySettings.vSyncCount = 0;
|
||||
}
|
||||
|
||||
Screen.SetResolution(resolutions[selectedResolution].horizontal, resolutions[selectedResolution].vertical, fullscreenTog.isOn);
|
||||
}
|
||||
|
||||
public void SetMasterVol()
|
||||
{
|
||||
masterLabel.text = Mathf.RoundToInt(masterSlider.value *5/3+100).ToString();
|
||||
theMixer.SetFloat("MasterVol", masterSlider.value);
|
||||
PlayerPrefs.SetFloat("MasterVol", masterSlider.value);
|
||||
}
|
||||
|
||||
public void SetMusicVol()
|
||||
{
|
||||
musicLabel.text = Mathf.RoundToInt(musicSlider.value *5/3+100).ToString();
|
||||
theMixer.SetFloat("MusicVol", musicSlider.value);
|
||||
PlayerPrefs.SetFloat("MusicVol", musicSlider.value);
|
||||
}
|
||||
|
||||
public void SetSFXVol()
|
||||
{
|
||||
SFXLabel.text = Mathf.RoundToInt((SFXSlider.value *5/3+100)).ToString();
|
||||
theMixer.SetFloat("SFXVol", SFXSlider.value);
|
||||
PlayerPrefs.SetFloat("SFXVol", SFXSlider.value);
|
||||
}
|
||||
}
|
||||
[System.Serializable]
|
||||
public class ResItem
|
||||
{
|
||||
public int horizontal, vertical;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 447f7ce6530519346b944ce158890ad6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,84 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Platform : MonoBehaviour
|
||||
{
|
||||
public bool isMoving;
|
||||
public Vector3 positionToMoveTo;
|
||||
public float length;
|
||||
float prevY;
|
||||
Vector3 startPos;
|
||||
void Start()
|
||||
{
|
||||
if(isMoving)
|
||||
{
|
||||
startPos = transform.position;
|
||||
StartCoroutine(LerpPosition(positionToMoveTo, length));
|
||||
}
|
||||
}
|
||||
IEnumerator LerpPosition(Vector3 targetPosition, float duration)
|
||||
{
|
||||
float time = 0;
|
||||
while (time < duration)
|
||||
{
|
||||
float t = time / duration;
|
||||
t = t * t * (3f - 2f * t);
|
||||
transform.position = Vector3.Lerp(startPos, targetPosition, t);
|
||||
time += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
transform.position = targetPosition;
|
||||
}
|
||||
|
||||
void Switch() {
|
||||
Vector3 temp = startPos;
|
||||
startPos = positionToMoveTo;
|
||||
positionToMoveTo = temp;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if(isMoving) {
|
||||
if(transform.position == positionToMoveTo) {
|
||||
Switch();
|
||||
StartCoroutine(LerpPosition(positionToMoveTo, length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void OnCollisionEnter2D (Collision2D other) {
|
||||
|
||||
// if (other.gameObject.tag == "Player") {
|
||||
// if(goThrough) {
|
||||
// if(other.gameObject.GetComponent<Movement>().m_Velocity.y > 0.01f) {
|
||||
// GetComponent<Collider2D>().isTrigger = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// GetComponent<Collider2D>().isTrigger = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
void OnCollisionEnter2D (Collision2D other) {
|
||||
if (other.gameObject.tag == "Player") {
|
||||
other.gameObject.transform.parent = transform;
|
||||
}
|
||||
// if(other.gameObject.tag == "Enemy") {
|
||||
// Debug.Log("take hit");
|
||||
// health.takeHit();
|
||||
// }
|
||||
// if(other.gameObject.tag == "Detection") {
|
||||
// Debug.Log("detect");
|
||||
// other.gameObject.GetComponent<MeanBird>().Detected(transform.position - other.gameObject.transform.position);
|
||||
// }
|
||||
}
|
||||
void OnCollisionExit2D (Collision2D other) {
|
||||
if (other.gameObject.tag == "Platform") {
|
||||
transform.parent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56977ce248620a94199b7ddedef0152e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,108 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class PlayerMovement : MonoBehaviour {
|
||||
public Movement controller;
|
||||
public Animator animator;
|
||||
public Health health;
|
||||
public Animator healthBarAnimator;
|
||||
|
||||
public float runSpeed = 40f;
|
||||
float horizontalMove = 0f;
|
||||
bool jump = false;
|
||||
bool crouch = false;
|
||||
|
||||
void Awake() {
|
||||
if (health == null) {
|
||||
Debug.Log("Health not found! Please attach the Health script to the player so the player can take damage.");
|
||||
}
|
||||
Debug.Log(health);
|
||||
if (health != null) {
|
||||
health.OnHit.AddListener(OnHit);
|
||||
health.OnDead.AddListener(OnDead);
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
|
||||
|
||||
if (healthBarAnimator != null) {
|
||||
healthBarAnimator.SetInteger("Health", health.currentHealth);
|
||||
}
|
||||
|
||||
if (Input.GetButtonDown("Jump")) {
|
||||
jump = true;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.LeftShift)) {
|
||||
crouch = true;
|
||||
} else if (Input.GetKeyUp(KeyCode.LeftShift)) {
|
||||
crouch = false;
|
||||
}
|
||||
|
||||
if (Movement.pause) {
|
||||
animator.SetFloat("Horizontal", 0);
|
||||
} else if (animator != null) {
|
||||
if (controller.m_Grounded) {
|
||||
animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
|
||||
}
|
||||
|
||||
if (controller.swimming) {
|
||||
animator.SetBool("Airborne", false);
|
||||
animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
|
||||
} else {
|
||||
animator.SetBool("Airborne", !controller.m_Grounded);
|
||||
}
|
||||
|
||||
if (healthBarAnimator != null) {
|
||||
healthBarAnimator.SetInteger("Health", health.currentHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
void FixedUpdate() {
|
||||
if (Movement.pause) return;
|
||||
controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump);
|
||||
jump = false;
|
||||
}
|
||||
|
||||
//if colliding with platform, move with platform
|
||||
void OnCollisionEnter2D (Collision2D other) {
|
||||
if (other.gameObject.tag == "Platform") {
|
||||
transform.parent = other.transform;
|
||||
}
|
||||
// if(other.gameObject.tag == "Enemy") {
|
||||
// Debug.Log("take hit");
|
||||
// health.takeHit();
|
||||
// }
|
||||
// if(other.gameObject.tag == "Detection") {
|
||||
// Debug.Log("detect");
|
||||
// other.gameObject.GetComponent<MeanBird>().Detected(transform.position - other.gameObject.transform.position);
|
||||
// }
|
||||
}
|
||||
void OnCollisionExit2D (Collision2D other) {
|
||||
if (other.gameObject.tag == "Platform") {
|
||||
transform.parent = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ChangePos(double x, double y) {
|
||||
transform.position = new Vector2();
|
||||
}
|
||||
/*void OnTriggerEnter2D(Collider2D col)
|
||||
{
|
||||
Debug.Log("Trigger Detected!");
|
||||
}*/
|
||||
|
||||
void OnHit() {
|
||||
Debug.Log("Hit Detected!");
|
||||
}
|
||||
|
||||
void OnDead() {
|
||||
Debug.Log("Fuck, I'm dead!");
|
||||
Movement.pause = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84aafa4f9de096e4abfe9d463bffd26d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,100 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ScriptRayHit : MonoBehaviour
|
||||
{
|
||||
|
||||
public RaycastHit2D hit;
|
||||
public Ray ray;
|
||||
private int counter;
|
||||
|
||||
public GameObject followCam;
|
||||
public Camera staticCam;
|
||||
private bool cam = false;
|
||||
[Range(0.5f, 25f)] public float smoothSpeed = 1f;
|
||||
[Range(1, 10)] public float rayLength = 4f;
|
||||
private float angleStep = 4;
|
||||
|
||||
public Transform target;
|
||||
public Rigidbody2D rb;
|
||||
private Vector3 offset;
|
||||
private LayerMask layerMask;
|
||||
private Vector3 save;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
counter = 0;
|
||||
layerMask = LayerMask.GetMask("Background");
|
||||
save = Vector3.zero;
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
offset = Vector3.zero;
|
||||
for (int i = 1; i <=angleStep; i++)
|
||||
{
|
||||
var rayAngle = Quaternion.AngleAxis((360f / angleStep) * i, target.forward) * target.up;
|
||||
hit = Physics2D.Raycast(target.position, rayAngle, rayLength, layerMask);
|
||||
|
||||
if (hit)
|
||||
{
|
||||
offset += (rayAngle * rayLength) - (rayAngle * hit.distance);
|
||||
//Debug.Log(hit.point);
|
||||
}
|
||||
|
||||
Vector3 smoothedPos = Vector3.Lerp(transform.position, new Vector3(((target.position.x - offset.x)*rayLength), (target.position.y - offset.y)*smoothSpeed/5, -65f), smoothSpeed * Time.fixedDeltaTime);
|
||||
|
||||
float x = Mathf.Abs(target.position.x - smoothedPos.x);
|
||||
float y = Mathf.Abs(target.position.y - smoothedPos.y);
|
||||
|
||||
if (x < 4 && y < 3)
|
||||
{
|
||||
save = smoothedPos;
|
||||
//followCam.transform.position = smoothedPos;
|
||||
}
|
||||
else if (x < 4)
|
||||
{
|
||||
//followCam.transform.position =new Vector3((save.x + target.position.x),smoothedPos.y, -1.3f);
|
||||
}else if (y < 3)
|
||||
{
|
||||
//followCam.transform.position = new Vector3((save.x + target.position.x), smoothedPos.y, -1.3f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//Vector3 smoothedPos = Vector3.Lerp(transform.position, new Vector3((target.position.x - offset.x)*rayLength, target.position.y - offset.y, -1.3f), smoothSpeed * Time.fixedDeltaTime);
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
|
||||
|
||||
/*hit = Physics2D.Raycast(transform.position, transform.TransformDirection(Vector2.right), 4f);
|
||||
if (hit)
|
||||
{
|
||||
Debug.Log(" Hit a wall "+ hit.collider.name);
|
||||
Debug.Log(hit.distance);
|
||||
//staticCam.enabled = true;
|
||||
//followCam.enabled = false;
|
||||
counter = 0;
|
||||
//cam = true;
|
||||
|
||||
}
|
||||
else if (cam && counter == 30)
|
||||
{
|
||||
staticCam.enabled = false;
|
||||
followCam.enabled = true;
|
||||
counter = 0;
|
||||
cam = false;
|
||||
Debug.Log("");
|
||||
}
|
||||
counter++;*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fd41423fac95444da8286db867308b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine;
|
||||
[System.Serializable]
|
||||
public class Sound
|
||||
{
|
||||
public string name;
|
||||
public string output;
|
||||
public AudioClip clip;
|
||||
[Range(0f,1f)]
|
||||
public float volume;
|
||||
[Range(.1f,3f)]
|
||||
public float pitch;
|
||||
[HideInInspector]
|
||||
public AudioSource source;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37af6aa571006f94daeeabae711cbd44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SpawnTrigger : Trigger
|
||||
{
|
||||
[SerializeField] float despawnTimer = 10f;
|
||||
[SerializeField] GameObject entity;
|
||||
[SerializeField] Vector2 startPos;
|
||||
private GameObject clone;
|
||||
private bool spawned;
|
||||
[SerializeField] bool respawns = false;
|
||||
[SerializeField] float respawnTime = 3f;
|
||||
private float elapsed = 0f;
|
||||
|
||||
|
||||
|
||||
//And function itself
|
||||
IEnumerator SpawnDespawn(){
|
||||
clone = Instantiate(entity, startPos, Quaternion.identity);
|
||||
clone.gameObject.SetActive(true);
|
||||
yield return new WaitForSeconds(despawnTimer);
|
||||
Destroy(clone);
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
public override void Action() {
|
||||
if(!spawned && !respawns) {
|
||||
Debug.Log("spawn");
|
||||
StartCoroutine(SpawnDespawn());
|
||||
}
|
||||
else if(respawns) {
|
||||
if(elapsed < respawnTime) {
|
||||
elapsed = 0;
|
||||
|
||||
StartCoroutine(SpawnDespawn());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55be82907c3918e408296a2532d38fff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TextTrigger : Trigger
|
||||
{
|
||||
public GameObject TextBox;
|
||||
// public GameObject HeadBox;
|
||||
public List<string> pages;
|
||||
public List<int> emotes;
|
||||
public RuntimeAnimatorController controller;
|
||||
public Sprite startSprite;
|
||||
public AudioManager audioManager;
|
||||
public bool isTalking;
|
||||
GameObject instance;
|
||||
// GameObject instance;
|
||||
// GameObject headInstance;
|
||||
void Instant() {
|
||||
instance = Instantiate(TextBox, TextBox.transform.position, Quaternion.identity);
|
||||
instance.SetActive(true);
|
||||
instance.GetComponent<Dialogue>().pages = pages;
|
||||
instance.GetComponent<Dialogue>().emotes = emotes;
|
||||
instance.GetComponent<Dialogue>().controller = controller;
|
||||
instance.GetComponent<Dialogue>().audioManager = audioManager;
|
||||
instance.GetComponent<Dialogue>().isOpen = true;
|
||||
instance.GetComponent<Dialogue>().isTalking = isTalking;
|
||||
}
|
||||
public override void Action()
|
||||
{
|
||||
Instant();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58ad46602c4301d47a7b6f71726a1cd9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
//to implement inheritance
|
||||
public abstract class Trigger : MonoBehaviour
|
||||
{
|
||||
//tags for the trigger
|
||||
public bool forceInteract;
|
||||
public bool repeatable;
|
||||
bool isActive;
|
||||
//only worry about this if it is not repeatable
|
||||
bool hasOccurred;
|
||||
public int value;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
hasOccurred = false;
|
||||
}
|
||||
|
||||
//checks if player is in range of the trigger
|
||||
private void OnTriggerStay2D(Collider2D other) {
|
||||
if(other.CompareTag("Player")) {
|
||||
Debug.Log("entered");
|
||||
isActive = true;
|
||||
}
|
||||
// else {
|
||||
|
||||
// isActive = false;
|
||||
// Debug.Log("exit");
|
||||
|
||||
// if(forceInteract && repeatable) {
|
||||
// hasOccurred = false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D other) {
|
||||
if(other.CompareTag("Player")) {
|
||||
isActive = false;
|
||||
Debug.Log("exit");
|
||||
}
|
||||
if(forceInteract && repeatable) {
|
||||
hasOccurred = false;
|
||||
}
|
||||
}
|
||||
// Update is called once per frame
|
||||
public void Update()
|
||||
{
|
||||
// Debug.Log("testr");
|
||||
//checks if conditions are right
|
||||
if(isActive && !hasOccurred)
|
||||
{
|
||||
//executes action upon entering
|
||||
if(forceInteract)
|
||||
{
|
||||
Action();
|
||||
hasOccurred = true;
|
||||
if(!repeatable) {
|
||||
isActive = false;
|
||||
}
|
||||
}
|
||||
//only executes action if input is pressed
|
||||
else
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.E)) {
|
||||
Debug.Log("action");
|
||||
Action();
|
||||
if(!repeatable)
|
||||
{
|
||||
hasOccurred = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void Action();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c5bd9ef9eec88943a606227bd1cc04a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TutorialScript : Trigger
|
||||
{
|
||||
public GameObject tutorialText;
|
||||
public int currentLevel;
|
||||
|
||||
public void Start() {
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
}
|
||||
|
||||
|
||||
public override void Action()
|
||||
{
|
||||
if(currentLevel == 1){
|
||||
tutorialText.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53cdf00c0de710c429632b3251bdaf64
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UpdatedCeilingTrigger : MonoBehaviour
|
||||
{
|
||||
public RaycastHit2D hit;
|
||||
public Ray ray;
|
||||
private LayerMask layerMask;
|
||||
private float angleStep = 8;
|
||||
public Transform target;
|
||||
[Range(1f, 10f)] public float rayLength = 10f;
|
||||
public BoxCollider2D box;
|
||||
public GameObject camMove;
|
||||
public GameObject catMove;
|
||||
private int counter = 0;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
layerMask = LayerMask.GetMask("Player");
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
for (int i = 1; i <= angleStep; i++)
|
||||
{
|
||||
var rayAngle = Quaternion.AngleAxis((360f / angleStep) * i, target.forward) * Vector3.left;
|
||||
hit = Physics2D.Raycast(target.position, rayAngle, rayLength, layerMask);
|
||||
float xe = Mathf.Abs(hit.point.x - target.localPosition.x);
|
||||
float ye = Mathf.Abs(hit.point.y - target.localPosition.y);
|
||||
float goalx = Mathf.Abs(target.position.x * box.size.x);
|
||||
float goaly = Mathf.Abs(target.position.y * box.size.y);
|
||||
if (hit && counter >= 150)
|
||||
{
|
||||
if (ye >=1)
|
||||
{
|
||||
Debug.Log("Counter Up " + counter);
|
||||
Debug.Log("YE " + ye);
|
||||
Debug.Log("Goaly " + goaly);
|
||||
Debug.Log(target.position.y * box.size.y);
|
||||
camMove.transform.position = new Vector3(camMove.transform.position.x + 22f, camMove.transform.position.y, -1.3f);
|
||||
catMove.transform.position = new Vector3(catMove.transform.position.x + 10f, catMove.transform.position.y + 1f, 0);
|
||||
xe = 0;
|
||||
ye = 0;
|
||||
goalx = 0;
|
||||
goaly = 0;
|
||||
counter = 0;
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
Debug.Log("Counter Down " + counter);
|
||||
Debug.Log("YE " + ye);
|
||||
Debug.Log("Goaly " + goaly);
|
||||
camMove.transform.position = new Vector3(camMove.transform.position.x - 22f, catMove.transform.position.y + 1.0f, -1.3f);
|
||||
catMove.transform.position = new Vector3(catMove.transform.position.x - 10f, catMove.transform.position.y, 0);
|
||||
counter = 0;
|
||||
xe = 0;
|
||||
ye = 0;
|
||||
goalx = 0;
|
||||
goaly = 0;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c52b4040d972fe74bb3489c91de44fef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UpdatedWallTrigger : MonoBehaviour
|
||||
{
|
||||
public RaycastHit2D hit;
|
||||
public Ray ray;
|
||||
private LayerMask layerMask;
|
||||
private float angleStep = 8;
|
||||
public Transform target;
|
||||
[Range (1f,10f)]public float rayLength = 10f;
|
||||
public BoxCollider2D box;
|
||||
public GameObject camMove;
|
||||
public GameObject catMove;
|
||||
private int counter = 0;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
layerMask = LayerMask.GetMask("Player");
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
for (int i = 1; i <= angleStep; i++)
|
||||
{
|
||||
var rayAngle = Quaternion.AngleAxis((360f / angleStep) * i, target.forward) * Vector3.left;
|
||||
hit = Physics2D.Raycast(target.position, rayAngle, rayLength, layerMask);
|
||||
float xe = Mathf.Abs(hit.point.x - target.localPosition.x);
|
||||
float ye = Mathf.Abs(hit.point.y - target.position.y);
|
||||
float goalx = Mathf.Abs(target.position.x * box.size.x) ;
|
||||
float goaly = Mathf.Abs(target.position.x * box.size.x);
|
||||
if (hit && counter >=150)
|
||||
{
|
||||
if (xe >= 44 && xe <50)
|
||||
{
|
||||
/*Debug.Log("Counter Right "+counter);
|
||||
Debug.Log("XE " + xe);
|
||||
Debug.Log("Goaly " + goaly);
|
||||
Debug.Log(target.position.y * box.size.y);*/
|
||||
camMove.transform.position = new Vector3(camMove.transform.position.x + 22f, camMove.transform.position.y, -1.3f);
|
||||
catMove.transform.position = new Vector3(catMove.transform.position.x + 10f, catMove.transform.position.y+1f, 0);
|
||||
xe = 0;
|
||||
ye = 0;
|
||||
goalx = 0;
|
||||
goaly = 0;
|
||||
counter = 0;
|
||||
}
|
||||
else if (xe >=50)
|
||||
{
|
||||
/*Debug.Log("Counter Left " + counter);
|
||||
Debug.Log("XE "+ye);
|
||||
Debug.Log("Goaly "+ goaly);*/
|
||||
camMove.transform.position = new Vector3(camMove.transform.position.x - 22f, catMove.transform.position.y + 1.0f,-1.3f);
|
||||
catMove.transform.position = new Vector3(catMove.transform.position.x - 10f, catMove.transform.position.y ,0);
|
||||
counter = 0;
|
||||
xe = 0;
|
||||
ye = 0;
|
||||
goalx = 0;
|
||||
goaly = 0;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D col)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91e52ab338e7d0d4694d6799e50dac73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WallTrigger : MonoBehaviour
|
||||
{
|
||||
bool entered = false;
|
||||
public GameObject cam;
|
||||
public GameObject cat;
|
||||
private int counter = 0;
|
||||
private Vector3 moveCam = new Vector3(20,0,0);
|
||||
private Vector3 moveCat = new Vector3(5,0,0);
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D col)
|
||||
{
|
||||
if (Input.GetButtonDown("Interact"))
|
||||
{
|
||||
Interact(col);
|
||||
}
|
||||
if (!entered && counter >= 6)
|
||||
{
|
||||
entered = true;
|
||||
|
||||
//Debug.Log("Move Cam Right");
|
||||
//Vector3 test = Vector3.Lerp(cam.transform.position, new Vector3(cam.transform.position.x + 10, cam.transform.position.y + 5, -1.3f), 10f*Time.fixedDeltaTime);
|
||||
//Vector3 smoothedPos = Vector3.Lerp(transform.position, new Vector3(((target.position.x - offset.x)*rayLength),
|
||||
//target.position.y - offset.y, -65f), smoothSpeed * Time.fixedDeltaTime);
|
||||
//cam.transform.position += test;
|
||||
cam.transform.position += moveCam;
|
||||
//float x = Mathf.Abs(cam.transform.position.x - test.x);
|
||||
//float y = Mathf.Abs(cam.transform.position.y - test.y);
|
||||
|
||||
cat.transform.position += moveCat;
|
||||
//Debug.Log(counter);
|
||||
counter = 0;
|
||||
//PlayerMovement.ChangePos(1, 2);
|
||||
}
|
||||
else if (counter >= 6 && entered)
|
||||
{
|
||||
//Debug.Log("Moved cam left");
|
||||
//Debug.Log(counter);
|
||||
cam.transform.position -= moveCam;
|
||||
cat.transform.position -= moveCat;
|
||||
entered = false;
|
||||
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Interact(Collider2D col)
|
||||
{
|
||||
Debug.Log("Interact Buttion Pressed!!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e34ddf7efd0cb44ba69abc06b6567d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WaterSpirit : MonoBehaviour {
|
||||
private Transform player;
|
||||
public BoxCollider2D boxCollider;
|
||||
public float swimSpeed = .25f;
|
||||
private Rigidbody2D rb;
|
||||
private Vector2 movement = Vector2.zero;
|
||||
private float sizeOffset = 1;
|
||||
|
||||
void Start() {
|
||||
rb = this.GetComponent<Rigidbody2D>();
|
||||
boxCollider = this.GetComponent<BoxCollider2D>();
|
||||
sizeOffset = Random.Range(2f, 3f);
|
||||
player = GameObject.FindWithTag("Player").transform;
|
||||
if (player == null) {
|
||||
Debug.Log("Player not found! Make sure Seiden's Char Movement has a tag of Player!");
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Movement.pause) return;
|
||||
Vector3 direction = player.position - transform.position;
|
||||
movement = direction.normalized;
|
||||
// Scale spirit size so they look like the swim like squid lol
|
||||
float size = Mathf.Sin(Time.time * sizeOffset) * .25f + 1;
|
||||
transform.localScale = new Vector3(size, size, 1);
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
if (Movement.pause) return;
|
||||
moveMe(movement);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision) {
|
||||
if (collision.tag == "Player") {
|
||||
collision.GetComponent<Health>().takeHit();
|
||||
}
|
||||
}
|
||||
|
||||
void moveMe(Vector2 direction) {
|
||||
rb.MovePosition(rb.position + direction * swimSpeed * Time.fixedDeltaTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edd699794297e4f719289f355101655e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WorkingWallTrigger : MonoBehaviour
|
||||
{
|
||||
public GameObject cam;
|
||||
public GameObject cat;
|
||||
public BoxCollider2D box;
|
||||
private int counter = 0;
|
||||
[Range(1f, 25f)] public float camOffset = 10f;
|
||||
[Range(1f, 15f)] public float catOffset = 5f;
|
||||
[Range(5, 180)] public int countOffset = 10;
|
||||
private Vector3 moveCam;
|
||||
private Vector3 moveCat;
|
||||
private LayerMask layerMask;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
moveCam = new Vector3(camOffset, 0, 0);
|
||||
moveCat = new Vector3(catOffset, 0, 0);
|
||||
layerMask = LayerMask.GetMask("Player");
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
void OnTriggerEnter2D(Collider2D col)
|
||||
{
|
||||
float ye = cat.transform.position.y;
|
||||
float goaly = box.transform.localPosition.y;
|
||||
if (ye < goaly && counter >= countOffset && col.IsTouchingLayers(layerMask))
|
||||
{
|
||||
cam.transform.position -= moveCam;
|
||||
cat.transform.position -= moveCat;
|
||||
counter = 0;
|
||||
}
|
||||
else if (ye >= goaly && counter > countOffset && col.IsTouchingLayers(layerMask))
|
||||
{
|
||||
cam.transform.position += moveCam;
|
||||
cat.transform.position += moveCat;
|
||||
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9800bd0db2e93148b45782870fed8ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,184 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class WorldScreenController : MonoBehaviour
|
||||
{
|
||||
public int currentLevel;
|
||||
public GameObject openingDialogue, tutorialDialogue, speedDialogue, darkDialogue, waterDialogue, birdDialogue, crowdDialogue, epilogueDialogue;
|
||||
public GameObject page1;
|
||||
public GameObject page2;
|
||||
public GameObject trophy1, trophy2, trophy3, trophy4, trophy5, trophy6;
|
||||
public GameObject picture1, picture2, picture3, picture4, picture5, picture6;
|
||||
public GameObject fpicture1, fpicture2, fpicture3, fpicture4, fpicture5, fpicture6;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
|
||||
if (currentLevel == 1)
|
||||
{
|
||||
openingDialogue.SetActive(true);
|
||||
}
|
||||
if (currentLevel >= 2)
|
||||
{
|
||||
trophy1.SetActive(true);
|
||||
}
|
||||
if (currentLevel >= 3)
|
||||
{
|
||||
trophy2.SetActive(true);
|
||||
}
|
||||
if (currentLevel >= 4)
|
||||
{
|
||||
trophy3.SetActive(true);
|
||||
}
|
||||
if (currentLevel >= 5)
|
||||
{
|
||||
trophy4.SetActive(true);
|
||||
}
|
||||
if (currentLevel >= 6)
|
||||
{
|
||||
trophy5.SetActive(true);
|
||||
}
|
||||
if (currentLevel >= 7)
|
||||
{
|
||||
trophy6.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Level1()
|
||||
{
|
||||
if (currentLevel >= 1)
|
||||
{
|
||||
SceneManager.LoadScene("Heights Level");
|
||||
}
|
||||
}
|
||||
|
||||
public void Level2()
|
||||
{
|
||||
if (currentLevel >= 2)
|
||||
{
|
||||
SceneManager.LoadScene("Speed Level");
|
||||
}
|
||||
}
|
||||
|
||||
public void Level3()
|
||||
{
|
||||
if (currentLevel >= 3)
|
||||
{
|
||||
SceneManager.LoadScene("Dark Level");
|
||||
}
|
||||
}
|
||||
|
||||
public void Level4()
|
||||
{
|
||||
if (currentLevel >= 4)
|
||||
{
|
||||
SceneManager.LoadScene("Water Level");
|
||||
}
|
||||
}
|
||||
|
||||
public void Level5()
|
||||
{
|
||||
if (currentLevel >= 5)
|
||||
{
|
||||
SceneManager.LoadScene("Bird Level");
|
||||
}
|
||||
}
|
||||
|
||||
public void Level6()
|
||||
{
|
||||
if (currentLevel >= 6)
|
||||
{
|
||||
SceneManager.LoadScene("Heights Level");
|
||||
}
|
||||
}
|
||||
|
||||
public void NextPage()
|
||||
{
|
||||
page2.SetActive(true);
|
||||
page1.SetActive(false);
|
||||
}
|
||||
|
||||
public void PreviousPage()
|
||||
{
|
||||
page1.SetActive(true);
|
||||
page2.SetActive(false);
|
||||
}
|
||||
|
||||
public void ClosePage()
|
||||
{
|
||||
page2.SetActive(false);
|
||||
page1.SetActive(false);
|
||||
}
|
||||
|
||||
public void OpenBook()
|
||||
{
|
||||
if (currentLevel == 1)
|
||||
{
|
||||
picture1.SetActive(true);
|
||||
tutorialDialogue.SetActive(true);
|
||||
}
|
||||
if (currentLevel == 2)
|
||||
{
|
||||
fpicture1.SetActive(true);
|
||||
picture2.SetActive(true);
|
||||
speedDialogue.SetActive(true);
|
||||
}
|
||||
if (currentLevel == 3)
|
||||
{
|
||||
fpicture1.SetActive(true);
|
||||
fpicture2.SetActive(true);
|
||||
picture3.SetActive(true);
|
||||
darkDialogue.SetActive(true);
|
||||
}
|
||||
if (currentLevel == 4)
|
||||
{
|
||||
fpicture1.SetActive(true);
|
||||
fpicture2.SetActive(true);
|
||||
fpicture3.SetActive(true);
|
||||
picture4.SetActive(true);
|
||||
waterDialogue.SetActive(true);
|
||||
}
|
||||
if (currentLevel == 5)
|
||||
{
|
||||
fpicture1.SetActive(true);
|
||||
fpicture2.SetActive(true);
|
||||
fpicture3.SetActive(true);
|
||||
fpicture4.SetActive(true);
|
||||
picture5.SetActive(true);
|
||||
birdDialogue.SetActive(true);
|
||||
}
|
||||
if (currentLevel == 6)
|
||||
{
|
||||
fpicture1.SetActive(true);
|
||||
fpicture2.SetActive(true);
|
||||
fpicture3.SetActive(true);
|
||||
fpicture4.SetActive(true);
|
||||
fpicture5.SetActive(true);
|
||||
picture6.SetActive(true);
|
||||
crowdDialogue.SetActive(true);
|
||||
}
|
||||
if (currentLevel == 7)
|
||||
{
|
||||
fpicture1.SetActive(true);
|
||||
fpicture2.SetActive(true);
|
||||
fpicture3.SetActive(true);
|
||||
fpicture4.SetActive(true);
|
||||
fpicture5.SetActive(true);
|
||||
fpicture6.SetActive(true);
|
||||
epilogueDialogue.SetActive(true);
|
||||
}
|
||||
page1.SetActive(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26e1eff7dc1e047408f40c80d8d2c58d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class booMovement : MonoBehaviour
|
||||
{
|
||||
private Transform player;
|
||||
public BoxCollider2D boxCollider;
|
||||
public float swimSpeed = .25f;
|
||||
private Rigidbody2D rb;
|
||||
private Vector2 movement = Vector2.zero;
|
||||
private float sizeOffset = 1f;
|
||||
public GameObject cat;
|
||||
public bool ball;
|
||||
public Movement mvt;
|
||||
public Animator anim;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rb = this.GetComponent<Rigidbody2D>();
|
||||
boxCollider = this.GetComponent<BoxCollider2D>();
|
||||
sizeOffset = Random.Range(2f, 10f);
|
||||
player = cat.transform;
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
Debug.Log("Player not found! Make sure Seiden's Char Movement has a tag of Player!");
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Movement.pause) return;
|
||||
//if (boxCollider.transform.x < cat.transform.x && m_FacingRight)
|
||||
mvt = cat.GetComponent<Movement>();
|
||||
ball = mvt.m_FacingRight;
|
||||
|
||||
if ((transform.position.x < player.position.x && ball)||(transform.position.x > player.position.x && !ball)) {
|
||||
player = cat.transform;
|
||||
Vector3 direction = player.position - transform.position;
|
||||
movement = direction.normalized;
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
if (Movement.pause) return;
|
||||
if ((transform.position.x < player.position.x && ball) || (transform.position.x > player.position.x && !ball)) {
|
||||
moveMe(movement);
|
||||
} else {
|
||||
noMoveMe(transform);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.tag == "Player")
|
||||
{
|
||||
collision.GetComponent<Health>().takeHit();
|
||||
}
|
||||
}
|
||||
|
||||
void moveMe(Vector2 direction) {
|
||||
if (anim != null) anim.SetBool("Shy?", false);
|
||||
rb.MovePosition(rb.position + direction * swimSpeed * Time.fixedDeltaTime);
|
||||
}
|
||||
void noMoveMe(Transform transform) {
|
||||
if (anim != null) anim.SetBool("Shy?", true);
|
||||
rb.MovePosition(new Vector2(transform.position.x, transform.position.y));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f19ade9cdbc8e314195b298d78e2f5c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class camMoveUp : MonoBehaviour
|
||||
{
|
||||
public GameObject cam;
|
||||
public float offset;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
void OnTriggerEnter2D(Collider2D col){
|
||||
cam.transform.position = new Vector3(0, offset,-1.3f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8c23705bf1fc90429b5d3732a001af7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class mainMenu : MonoBehaviour
|
||||
{
|
||||
public string firstLevel;
|
||||
public GameObject optionsScreen;
|
||||
public GameObject creditsScreen;
|
||||
public GameObject binderRing;
|
||||
public int currentLevel = 1;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void StartGame()
|
||||
{
|
||||
if (!PlayerPrefs.HasKey("CurrentLevel"))
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", currentLevel);
|
||||
}
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
|
||||
public void OpenOptions()
|
||||
{
|
||||
optionsScreen.SetActive(true);
|
||||
binderRing.SetActive(false);
|
||||
}
|
||||
|
||||
public void CloseOptions()
|
||||
{
|
||||
optionsScreen.SetActive(false);
|
||||
binderRing.SetActive(true);
|
||||
}
|
||||
|
||||
public void OpenCredits()
|
||||
{
|
||||
creditsScreen.SetActive(true);
|
||||
binderRing.SetActive(false);
|
||||
}
|
||||
|
||||
public void CloseCredits()
|
||||
{
|
||||
creditsScreen.SetActive(false);
|
||||
binderRing.SetActive(true);
|
||||
}
|
||||
|
||||
public void ResetLevel()
|
||||
{
|
||||
PlayerPrefs.SetInt("CurrentLevel", currentLevel);
|
||||
}
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
Application.Quit();
|
||||
Debug.Log("Quitting");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2016499ebecddb44ba79257186ee0f4f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user