1
0
This commit is contained in:
JohnCodyWheeler 2016-01-31 16:22:52 -05:00
commit b479fee5c1
34 changed files with 187 additions and 33 deletions

Binary file not shown.

View File

@ -0,0 +1,63 @@
using UnityEngine;
using System.Collections;
public class ActivateTextAtLine : MonoBehaviour {
public TextAsset theText;
public int startLine;
public int endLine;
public TextBoxManager theTextBox;
public bool destroyWhenActivated;
public bool requireButtonPress;
private bool waitForPress;
// Use this for initialization
void Start () {
theTextBox = FindObjectOfType<TextBoxManager>();
}
// Update is called once per frame
void Update () {
if(waitForPress && Input.GetKeyDown(KeyCode.J))
{
theTextBox.ReloadScript(theText);
theTextBox.currentLine = startLine;
theTextBox.endAtLine = endLine;
theTextBox.EnableTextBox();
if (destroyWhenActivated)
Destroy(gameObject);
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.name == "CharacterRobotBoy") //need to do object type instead for "better purposes"
{
if(requireButtonPress)
{
waitForPress = true;
return;
}
theTextBox.ReloadScript(theText);
theTextBox.currentLine = startLine;
theTextBox.endAtLine = endLine;
theTextBox.EnableTextBox();
if (destroyWhenActivated)
Destroy(gameObject);
}
}
void OnTriggerExit2D(Collider2D other)
{
if (other.name == "CharacterRobotBoy")
waitForPress = false;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9d3a91edf675e3440aee1f05323b59db
timeCreated: 1454260365
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -62,7 +62,7 @@ public class CharacterMovement : MonoBehaviour {
// transform.eulerAngles = new Vector2(0, 180);
//}
if (Input.GetKeyDown(KeyCode.T))
if (Input.GetKeyDown(KeyCode.Q))
{
powerTeleport();
}
@ -76,7 +76,7 @@ public class CharacterMovement : MonoBehaviour {
canPass = true;
}
if (Input.GetKeyDown(KeyCode.P))
if (Input.GetKeyDown(KeyCode.E))
{
if(SceneManager.GetActiveScene().name == "GMLevel1")
{
@ -89,7 +89,7 @@ public class CharacterMovement : MonoBehaviour {
}
if (Input.GetKeyDown(KeyCode.G))
if (Input.GetKeyDown(KeyCode.R))
{
if (changeBox == true)
changeBox = false;

View File

@ -35,6 +35,9 @@ namespace UnityStandardAssets._2D
private void FixedUpdate()
{
if (!canMove)
return;
// Read the inputs.
bool crouch = Input.GetKey(KeyCode.LeftControl);
float h = CrossPlatformInputManager.GetAxis("Horizontal");

View File

@ -6,11 +6,12 @@ namespace UnityStandardAssets._2D
{
public class Restarter : MonoBehaviour
{
public string levelName;
private void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
if (other.tag == "Scene_Object")
{
SceneManager.LoadScene(SceneManager.GetSceneAt(0).path);
SceneManager.LoadScene(levelName);
}
}
}

View File

@ -1,22 +1,14 @@
Hey There! (Press K to continue)
......
Not much of a talker anymore huh?
......
Doesn't surprise me. Not after all that you've been through.
......
Don't recognize me? It's been the same thing every year...
......
We've always tried to change the ritual...the ritual is not fair.
......
Not fair to me....nor any of us....for we are all the same.
......
(Press J to learn more)
Still around huh? Well don't worry, we will fight back this time.
......
I'll help you out as long as you carry me along with you...
......
Time has not been in my favor....I feel that I don't have long.
......
Get ready up ahead...there are many Platforms that you must jump
over to succeed. But be warned, the farther in you go, the worst the system gets.(Press 'SPACE' to jump on each Platform)
over to succeed. But be warned, the farther in you go, the worst the system gets.(Press 'SPACE' to jump on each Platform)

View File

@ -4,3 +4,5 @@ Whew! I honestly thought that we weren't going to make it through
Sorry about that, that's something new. Anyways...be carefull
up ahead, there are multiple different platforms that the System
thinks they can just spawn on us. Just remember t* &^%# #@10.

View File

@ -3,4 +3,5 @@ Hey! Be careful up ahead! The Platforms can kindof be glitchy
Some of the platforms tend to glitch in and out of existance so
be sure to time your jumps right! You can also change the MUSIC
by pressing the '-' and the '+' from the top row.
by pressing the '-' and the '+' from the top row.

View File

@ -1,6 +1,8 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityStandardAssets._2D;
public class TextBoxManager : MonoBehaviour {
@ -12,7 +14,10 @@ public class TextBoxManager : MonoBehaviour {
public int currentLine;
public int endAtLine;
public PlayerCharacter player;
//public PlatformerCharacter2D player; // Need to wait till don gets here to figure out what we did the first time....
//public PlayerCharacter player;
//public PlatformerCharacter2D player;
public Platformer2DUserControl player;
public bool isActive;
public bool stopPlayerMovement;
@ -22,7 +27,7 @@ public class TextBoxManager : MonoBehaviour {
// Use this for initialization
void Start()
{
player = FindObjectOfType<PlayerCharacter>();
player = FindObjectOfType<Platformer2DUserControl>(); // need to change...again....(i think platformer2dusercontrol)
if (textfile != null)
{
@ -52,7 +57,7 @@ public class TextBoxManager : MonoBehaviour {
theText.text = textLines[currentLine];
if (Input.GetKeyDown(KeyCode.Space))
if (Input.GetKeyDown(KeyCode.K))
currentLine++;
if (currentLine > endAtLine)
@ -62,6 +67,7 @@ public class TextBoxManager : MonoBehaviour {
public void EnableTextBox()
{
textBox.SetActive(true);
isActive = true;
if (stopPlayerMovement)
player.canMove = false;
@ -70,6 +76,17 @@ public class TextBoxManager : MonoBehaviour {
public void DisableTextBox()
{
textBox.SetActive(false); //Once we get to the end of the "lines" we turn off the text block.
isActive = false;
player.canMove = true;
}
public void ReloadScript(TextAsset theText)
{
if(theText != null)
{
textLines = new string[1];
textLines = (theText.text.Split('\n'));
}
}
}

View File

@ -3,8 +3,8 @@ using System.Collections;
public class TextImporter : MonoBehaviour {
public TextAsset textfile;
public string[] textLines;
public TextAsset textfile; //A block of text that will be "put" into the box.
public string[] textLines; //An array of lines that will be put on screen line by line.
// Use this for initialization

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -11,7 +11,6 @@ public class mGUI : MonoBehaviour
float nativeWidth = 640;
float nativeHeight = 400;
float percentHealth;
int healthBarLength = 400;
Matrix4x4 guiMatrix;
void Start()
@ -34,20 +33,20 @@ public class mGUI : MonoBehaviour
GUI.matrix = GetGUIMatrix();
// Create one Group to contain both images
// Adjust the first 2 coordinates to place it somewhere else on-screen
GUI.BeginGroup(new Rect(0, 0, 640, 400));
GUI.BeginGroup(new Rect(0, 0, 207, 82));
// Draw the background image
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
GUI.Box(new Rect(0, 0, 620, 400), bgImage);
GUI.Box(new Rect(0, 0, 207, 82), bgImage);
percentHealth = curHealth / maxHealth;
// Create a second Group which will be clipped
// We want to clip the image and not scale it, which is why we need the second Group
GUI.BeginGroup(new Rect(0, 0, percentHealth * 640, 400));
GUI.BeginGroup(new Rect(0, 0, percentHealth * 207, 82));
// Draw the foreground image
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
GUI.Box(new Rect(0, 0, 620, 400), fgImage);
GUI.Box(new Rect(0, 0, 207, 82), fgImage);
// End both Groups

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 01275eb458a35534997899ab69e88ec4
folderAsset: yes
timeCreated: 1454231669
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e98fe5e64ed309843a5f45f86ab687d2
timeCreated: 1454257207
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 25f479fa6d93a7b4a90e1cfc8cae89d3
timeCreated: 1454258086
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 6afbb3b544510eb4d98533be41418730
timeCreated: 1454172726
timeCreated: 1454272704
licenseType: Free
DefaultImporter:
userData:

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,19 +6,27 @@ using System;
public class Enemy : Controller{
public bool isAir;
private state currentState;
private Animator mAnimator;
public LayerMask enemyMask;
public bool rightdirection;
public float[] time = new float[10];
public bool idle;
public bool wander;
// Use this for initialization
void Start ()
{
time [0] = 2.0f;
time [1] = 4.0f;
print("start");
mAnimator = GetComponent<Animator> ();
changestate(new idle());
}
// Update is called once per frame
void Update ()
{
mAnimator.SetFloat ("Speed", GetComponent<Rigidbody2D> ().velocity.magnitude);
//mAnimator.SetFloat ("Player Health", GameObject.FindWithTag ("Scene_Object").GetComponent<Rigidbody2D>());
currentState.Execute();
}
public void changestate(state newstate)

View File

@ -8,7 +8,7 @@ public class hover : MonoBehaviour
public float speed = 1;
public bool flyPattern; // false is x-axis, true is y axis YOU HAPPY???? good
public float maxFlightDistance = 0; // if flight distance is 0, fly foreva, probably should never do.. lol
float distanceFlown;
float distanceFlown = 0;
Rigidbody2D myBody;
Transform myTrans;
BoxCollider2D hitBox;
@ -74,6 +74,7 @@ public class hover : MonoBehaviour
Vector3 currentRot = myTrans.eulerAngles;
currentRot.y += 180;
myTrans.eulerAngles = currentRot;
//print("DUMB ");
distanceFlown = 0;
}

View File

@ -16,15 +16,22 @@ public class idle : state
}
public void Enter(Enemy enemy)
{
time = 0;
Debug.Log("idle");
this.enemy = enemy;
enemy.idle = true;
enemy.wander = false;
}
public void Exit(){}
public void onTriggerEnter(Collider2D other){}
public void Idle()
{
time += Time.deltaTime;
if (time >= enemy.time[0])
enemy.changestate(new wander());
if (time >= enemy.time [0]) {
time = 0;
enemy.idle = false;
enemy.wander = true;
enemy.changestate (new wander ());
}
}
}

View File

@ -25,8 +25,12 @@ public class wander : state
public void Execute()
{
time += Time.deltaTime;
if (time >= enemy.time[1])
enemy.changestate(new idle());
if (time >= enemy.time [1]) {
time = 0;
enemy.idle = true;
enemy.wander = false;
enemy.changestate (new idle ());
}
seeplayer();
if (enemy.isAir)
{
@ -41,6 +45,9 @@ public class wander : state
}
public void Enter(Enemy enemy)
{
time = 0;
enemy.wander = true;
enemy.idle = false;
Debug.Log("Wander");
this.enemy = enemy;
this.enemyMask = enemy.enemyMask;

View File

@ -18,7 +18,7 @@ public class Platform : MonoBehaviour
//Updates all of the children's SpriteRender sprites
foreach (SpriteRenderer i in GetComponentsInChildren<SpriteRenderer>())
{
if (i.tag != "Player")
if (i.tag != "Scene_Object")
{
i.transform.localScale = new Vector3(scaleFactor, scaleFactor);
i.sprite = sprite;

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a85a73eb6330eaa4fb472f22a8a78955
timeCreated: 1454227347
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bdb824d553c6df645b8240a915ac7828
timeCreated: 1454258941
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant: