mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
Worked on base movement for npcs and figured out activating/deactivating textbox
This commit is contained in:
@@ -6,23 +6,49 @@ using TMPro;
|
||||
public class Dialogue : MonoBehaviour
|
||||
{
|
||||
public TMP_Text textbox;
|
||||
ArrayList<string> pages;
|
||||
List<string> pages;
|
||||
int curPage;
|
||||
public bool isOpen = true;
|
||||
//test object
|
||||
public GameObject textTest;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//pages to scroll through
|
||||
pages = new ArrayList<string>();
|
||||
pages = new List<string>();
|
||||
curPage = 0;
|
||||
}
|
||||
|
||||
//Adds a page of text
|
||||
void AddText(string 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;
|
||||
// if(Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0 || Input.GetKeyDown(KeyCode.Return))
|
||||
// {
|
||||
// //scroll through textbox using any movement key
|
||||
// if(curPage >= pages.Count - 1)
|
||||
// {
|
||||
// isOpen = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// textbox.text = pages[++curPage];
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//unpause
|
||||
else
|
||||
{
|
||||
Movement.pause = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//WIP
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//WIP
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
//WIP
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NPC : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
|
||||
public Movement controller;
|
||||
float horizontalMove = 0f;
|
||||
public float runSpeed = 40f;
|
||||
public string title = "";
|
||||
|
||||
//constructs an NPC using parameters
|
||||
public NPC(string name, float run, float hor)
|
||||
{
|
||||
title = name;
|
||||
runSpeed = run;
|
||||
horizontalMove = hor;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
@@ -15,4 +30,10 @@ public class NPC : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//NPC movement determined by script in subclasses
|
||||
void FixedUpdate()
|
||||
{
|
||||
controller.Move(horizontalMove *Time.fixedDeltaTime, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+3
-1
@@ -495,6 +495,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
textbox: {fileID: 7059772333148747626}
|
||||
isOpen: 0
|
||||
textTest: {fileID: 7059772332581294260}
|
||||
--- !u!1 &7059772333148747624
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -561,7 +563,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: a quick brown fox jumped over the lazy dog
|
||||
m_text: a quick brown fox jumps over the lazy dog
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
|
||||
m_sharedMaterial: {fileID: 1974643164809013703, guid: 8bd1780577b8eaf43ad60554189eb11e, type: 2}
|
||||
|
||||
Generated
+6
@@ -266,6 +266,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
controller: {fileID: 187176290}
|
||||
runSpeed: 40
|
||||
textTest: {fileID: 7059772332933783825}
|
||||
--- !u!1 &519420028
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -839,3 +840,8 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
|
||||
--- !u!1 &7059772332933783825 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7059772333487008123, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
|
||||
m_PrefabInstance: {fileID: 7059772332933783824}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
Reference in New Issue
Block a user