Merge branch 'master' of https://github.com/new-00-0ne/System-Purge
This commit is contained in:
commit
609665c9f3
63
Assets/Dusty Char/ActivateTextAtLine.cs
Normal file
63
Assets/Dusty Char/ActivateTextAtLine.cs
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
Assets/Dusty Char/ActivateTextAtLine.cs.meta
Normal file
12
Assets/Dusty Char/ActivateTextAtLine.cs.meta
Normal 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:
|
@ -62,7 +62,7 @@ public class CharacterMovement : MonoBehaviour {
|
|||||||
// transform.eulerAngles = new Vector2(0, 180);
|
// transform.eulerAngles = new Vector2(0, 180);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.T))
|
if (Input.GetKeyDown(KeyCode.E))
|
||||||
{
|
{
|
||||||
powerTeleport();
|
powerTeleport();
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ public class CharacterMovement : MonoBehaviour {
|
|||||||
canPass = true;
|
canPass = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.P))
|
if (Input.GetKeyDown(KeyCode.Q))
|
||||||
{
|
{
|
||||||
if(SceneManager.GetActiveScene().name == "GMLevel1")
|
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)
|
if (changeBox == true)
|
||||||
changeBox = false;
|
changeBox = false;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityStandardAssets._2D;
|
||||||
|
|
||||||
|
|
||||||
public class TextBoxManager : MonoBehaviour {
|
public class TextBoxManager : MonoBehaviour {
|
||||||
|
|
||||||
@ -12,7 +14,10 @@ public class TextBoxManager : MonoBehaviour {
|
|||||||
|
|
||||||
public int currentLine;
|
public int currentLine;
|
||||||
public int endAtLine;
|
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 isActive;
|
||||||
public bool stopPlayerMovement;
|
public bool stopPlayerMovement;
|
||||||
@ -22,7 +27,7 @@ public class TextBoxManager : MonoBehaviour {
|
|||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
player = FindObjectOfType<PlayerCharacter>();
|
player = FindObjectOfType<Platformer2DUserControl>(); // need to change...again....(i think platformer2dusercontrol)
|
||||||
|
|
||||||
if (textfile != null)
|
if (textfile != null)
|
||||||
{
|
{
|
||||||
@ -52,7 +57,7 @@ public class TextBoxManager : MonoBehaviour {
|
|||||||
|
|
||||||
theText.text = textLines[currentLine];
|
theText.text = textLines[currentLine];
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Space))
|
if (Input.GetKeyDown(KeyCode.K))
|
||||||
currentLine++;
|
currentLine++;
|
||||||
|
|
||||||
if (currentLine > endAtLine)
|
if (currentLine > endAtLine)
|
||||||
@ -62,6 +67,7 @@ public class TextBoxManager : MonoBehaviour {
|
|||||||
public void EnableTextBox()
|
public void EnableTextBox()
|
||||||
{
|
{
|
||||||
textBox.SetActive(true);
|
textBox.SetActive(true);
|
||||||
|
isActive = true;
|
||||||
if (stopPlayerMovement)
|
if (stopPlayerMovement)
|
||||||
player.canMove = false;
|
player.canMove = false;
|
||||||
|
|
||||||
@ -70,6 +76,17 @@ public class TextBoxManager : MonoBehaviour {
|
|||||||
public void DisableTextBox()
|
public void DisableTextBox()
|
||||||
{
|
{
|
||||||
textBox.SetActive(false); //Once we get to the end of the "lines" we turn off the text block.
|
textBox.SetActive(false); //Once we get to the end of the "lines" we turn off the text block.
|
||||||
|
isActive = false;
|
||||||
player.canMove = true;
|
player.canMove = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ReloadScript(TextAsset theText)
|
||||||
|
{
|
||||||
|
if(theText != null)
|
||||||
|
{
|
||||||
|
textLines = new string[1];
|
||||||
|
textLines = (theText.text.Split('\n'));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ using System.Collections;
|
|||||||
|
|
||||||
public class TextImporter : MonoBehaviour {
|
public class TextImporter : MonoBehaviour {
|
||||||
|
|
||||||
public TextAsset textfile;
|
public TextAsset textfile; //A block of text that will be "put" into the box.
|
||||||
public string[] textLines;
|
public string[] textLines; //An array of lines that will be put on screen line by line.
|
||||||
|
|
||||||
|
|
||||||
// Use this for initialization
|
// 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 |
@ -11,7 +11,6 @@ public class mGUI : MonoBehaviour
|
|||||||
float nativeWidth = 640;
|
float nativeWidth = 640;
|
||||||
float nativeHeight = 400;
|
float nativeHeight = 400;
|
||||||
float percentHealth;
|
float percentHealth;
|
||||||
int healthBarLength = 400;
|
|
||||||
Matrix4x4 guiMatrix;
|
Matrix4x4 guiMatrix;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@ -34,20 +33,20 @@ public class mGUI : MonoBehaviour
|
|||||||
GUI.matrix = GetGUIMatrix();
|
GUI.matrix = GetGUIMatrix();
|
||||||
// Create one Group to contain both images
|
// Create one Group to contain both images
|
||||||
// Adjust the first 2 coordinates to place it somewhere else on-screen
|
// 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
|
// Draw the background image
|
||||||
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
|
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;
|
percentHealth = curHealth / maxHealth;
|
||||||
// Create a second Group which will be clipped
|
// 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
|
// 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
|
// Draw the foreground image
|
||||||
GUI.backgroundColor = new Color(0, 0, 0, 0.0f);
|
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
|
// End both Groups
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user