-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a6a94a6
Showing
27 changed files
with
1,413 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class AndroidTut : MonoBehaviour { | ||
public string AndroidText; | ||
// Use this for initialization | ||
void Start () { | ||
if (SystemInfo.deviceType == DeviceType.Handheld) | ||
{ | ||
GetComponent<TextMesh>().text = AndroidText; | ||
} | ||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class AnimSwitch : MonoBehaviour { | ||
|
||
public GameObject LeftEye; | ||
public GameObject RightEye; | ||
public Animator animator; | ||
public float EyeRad; | ||
public float AnimOffsX, AnimOffsY; | ||
private Vector3 DefaultL, DefaultR; | ||
public Rigidbody2D rig; | ||
public Collider2D col; | ||
private float TimeFrame; | ||
|
||
// Use this for initialization | ||
void Start() | ||
{ | ||
animator = GetComponent<Animator>(); | ||
//rig = GetComponent<Rigidbody2D>(); | ||
//col = GetComponent<Collider2D>(); | ||
DefaultL = LeftEye.transform.localPosition; | ||
DefaultR = RightEye.transform.localPosition; | ||
} | ||
|
||
// Update is called once per frame | ||
void Update () | ||
{ | ||
animator.SetFloat("Speed", rig.velocity.magnitude); | ||
animator.SetBool("OnGround", col.IsTouchingLayers(1)); | ||
if (Input.anyKey) | ||
{ | ||
animator.SetFloat("IdleTime", 0); | ||
TimeFrame = Time.timeSinceLevelLoad; | ||
} | ||
else | ||
{ | ||
animator.SetFloat("IdleTime", Time.timeSinceLevelLoad - TimeFrame); | ||
} | ||
Vector3 _MousePoint = | ||
Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)); | ||
//use animation set values to indicate how far the eyes may wander | ||
Vector3 AnimOffs = new Vector3(AnimOffsX, AnimOffsY, 0); | ||
//convert mouse pos to localpos | ||
Vector3 LEP = transform.InverseTransformPoint(_MousePoint); | ||
Vector3 REP = transform.InverseTransformPoint(_MousePoint); | ||
//reduce mouse pos to a small number, then set eye pos to that number. | ||
if (LEP.magnitude > EyeRad) | ||
LEP = LEP.normalized * EyeRad; | ||
if (REP.magnitude > EyeRad) | ||
REP = REP.normalized * EyeRad; | ||
LeftEye.transform.localPosition = LEP + DefaultL + AnimOffs; | ||
RightEye.transform.localPosition = REP + DefaultR + AnimOffs; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class AttMoveCheck : MonoBehaviour { | ||
public AttractorBalance[] AB; | ||
public Vector3 PrevPos; | ||
public Quaternion zero = new Quaternion(0, 0, 0, 0); | ||
private AudioSource AS; | ||
// Use this for initialization | ||
void Start () { | ||
AB = FindObjectsOfType<AttractorBalance>(); | ||
AS = GetComponent<AudioSource>(); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
if (Input.GetButtonDown("Slow Time") && AS.pitch > 0.11f) | ||
AS.pitch *= 0.1f; | ||
if (Input.GetButtonUp("Slow Time") && AS.pitch < 0.11f) | ||
AS.pitch *= 10f; | ||
if (transform.position != PrevPos) | ||
{ | ||
PrevPos = transform.position; | ||
foreach (AttractorBalance A in AB) | ||
A.ChangeMags(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class Attractor : MonoBehaviour { | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class AttractorBalance : MonoBehaviour { | ||
|
||
public bool Gset = true; | ||
public Vector2 MagnetizePos; | ||
private Rigidbody2D CharRig; | ||
// Use this for initialization | ||
void Start () | ||
{ | ||
CharRig = GetComponent<Rigidbody2D>(); | ||
} | ||
|
||
// Update is called once per frame | ||
void FixedUpdate () | ||
{ | ||
if (!Gset) | ||
{ | ||
CharRig.AddForce(((MagnetizePos - CharRig.position)/4) , ForceMode2D.Impulse); | ||
CharRig.velocity *= 0.925f; | ||
} | ||
} | ||
|
||
public void ChangeMags() | ||
{ | ||
GameObject[] GO = | ||
GameObject.FindGameObjectsWithTag("Attractor_tag"); | ||
|
||
MagnetizePos = Vector2.zero; | ||
|
||
if (GO.Length > 0) | ||
{ | ||
int j = 0; | ||
foreach (GameObject i in GO) | ||
{ | ||
i.transform.rotation = Quaternion.identity; | ||
j++; | ||
MagnetizePos += new Vector2(i.transform.position.x, i.transform.position.y); | ||
} | ||
MagnetizePos /= j; | ||
if (Gset) | ||
{ | ||
CharRig.gravityScale = 0; | ||
Gset = false; | ||
} | ||
} | ||
else if (!Gset) | ||
{ | ||
CharRig.gravityScale = 1; | ||
Gset = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class ButtonHoldObject : MonoBehaviour { | ||
public GameObject LeverObject; | ||
public Sprite UnPressed; | ||
public Sprite Pressed; | ||
public bool RequiresPressable; | ||
private SpriteRenderer SR; | ||
public int ObjectsInside; | ||
private void Start() | ||
{ | ||
SR = GetComponent<SpriteRenderer>(); | ||
} | ||
void OnTriggerEnter2D(Collider2D other) | ||
{ | ||
if (RequiresPressable) | ||
{ | ||
if(other.tag == "CanPress") | ||
ObjectsInside++; | ||
} | ||
else | ||
ObjectsInside++; | ||
if (ObjectsInside > 0) | ||
{ | ||
SR.sprite = Pressed; | ||
LeverObject.SetActive(false); | ||
} | ||
} | ||
void OnTriggerExit2D(Collider2D other) | ||
{ | ||
|
||
if (RequiresPressable) | ||
{ | ||
if (other.tag == "CanPress") | ||
ObjectsInside--; | ||
} | ||
else | ||
ObjectsInside--; | ||
if (ObjectsInside <= 0) | ||
{ | ||
SR.sprite = UnPressed; | ||
LeverObject.SetActive(true); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class Checkpoint : MonoBehaviour { | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update () | ||
{ | ||
|
||
} | ||
void OnTriggerEnter2D(Collider2D collision) | ||
{ | ||
Debug.Log(collision.gameObject.tag); | ||
if (collision.gameObject.tag == "Contravert") | ||
{ | ||
collision.gameObject.GetComponent<GenAtt>().StartPos = collision.gameObject.transform.position; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class ConSpr_Code : MonoBehaviour { | ||
private GameObject Contravert; | ||
|
||
void Start () | ||
{ | ||
Contravert = GameObject.FindGameObjectWithTag("Contravert"); | ||
} | ||
// Update is called once per frame | ||
void Update () | ||
{ | ||
transform.position = Contravert.transform.position; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class Fan : MonoBehaviour { | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update () | ||
{ | ||
transform.Rotate(Vector3.up, Time.deltaTime * 360); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class FollowChar : MonoBehaviour { | ||
|
||
//this class is really shit, if I intend to use the chase cam I should redo the whole thing. | ||
|
||
private GameObject Conv; | ||
private Vector3 Target; | ||
public float MincX, MincY, MaxcX, MaxcY, MinX, MinY, MaxX, MaxY; | ||
// Use this for initialization | ||
void Start () | ||
{ | ||
Conv = GameObject.FindGameObjectWithTag("Contravert"); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update () | ||
{ | ||
if (Conv.transform.position.x > MincX && Conv.transform.position.y > MincY && Conv.transform.position.x < MaxcX && Conv.transform.position.y < MaxcY) | ||
{ | ||
Target.z = -10; | ||
if (Conv.transform.position.x < MinX) | ||
Target.x = MinX; | ||
else if (Conv.transform.position.x > MaxX) | ||
Target.x = MaxX; | ||
else | ||
Target.x = Conv.transform.position.x; | ||
|
||
if (Conv.transform.position.y < MinY) | ||
Target.y = MinY; | ||
else if (Conv.transform.position.y > MaxY) | ||
Target.y = MaxY; | ||
else | ||
Target.y = Conv.transform.position.y; | ||
transform.position = Vector3.MoveTowards(transform.position, Target, 1); | ||
} | ||
} | ||
} |
Oops, something went wrong.