Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions Demo/Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -30087,8 +30087,8 @@ GameObject:
m_Component:
- component: {fileID: 1190204998}
- component: {fileID: 1190204997}
- component: {fileID: 1190204999}
- component: {fileID: 1190205000}
- component: {fileID: 1190205001}
m_Layer: 0
m_Name: ChatBar
m_TagString: Untagged
Expand Down Expand Up @@ -30156,16 +30156,16 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1190204992}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -7.8, y: -3.59, z: 10}
m_LocalScale: {x: 0.6625, y: 0.77502966, z: 1}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -12.14, y: -4.98, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1340503910}
- {fileID: 1602439422}
m_Father: {fileID: 519420032}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1190204999
--- !u!114 &1190205000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -30174,10 +30174,14 @@ MonoBehaviour:
m_GameObject: {fileID: 1190204992}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3aac67e6abf1dd6449a7214b2006f17b, type: 3}
m_Script: {fileID: 11500000, guid: bb133f371ef5953198ea606ff479ae3b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1190205000
spriteRenderer: {fileID: 1190204997}
Online: {fileID: 741323824, guid: a824ceda098699e009d18d7f50077187, type: 3}
Offline: {fileID: 1046802418, guid: a824ceda098699e009d18d7f50077187, type: 3}
keyStrokes: 0
--- !u!114 &1190205001
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -30186,13 +30190,16 @@ MonoBehaviour:
m_GameObject: {fileID: 1190204992}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bb133f371ef5953198ea606ff479ae3b, type: 3}
m_Script: {fileID: 11500000, guid: 9f2510bd6ca652f76b73d0404b807411, type: 3}
m_Name:
m_EditorClassIdentifier:
spriteRenderer: {fileID: 1190204997}
Online: {fileID: 741323824, guid: a824ceda098699e009d18d7f50077187, type: 3}
Offline: {fileID: 1046802418, guid: a824ceda098699e009d18d7f50077187, type: 3}
keyStrokes: 0
walkForce: 1
jumpForce: 1
spriteRenderer: {fileID: 0}
rb: {fileID: 0}
onlineSprite: {fileID: 0}
offlineSprite: {fileID: 0}
viewRadius: 50
--- !u!1 &1204895785
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -32989,6 +32996,9 @@ MonoBehaviour:
- {fileID: 1249644660, guid: c8720553b870f62869ff34f13c86167e, type: 3}
- {fileID: 999460749, guid: c8720553b870f62869ff34f13c86167e, type: 3}
- {fileID: 0}
fileLine:
projectPath:
filePath: /Chatbox/messageHistory.txt
--- !u!212 &1602439424
SpriteRenderer:
m_ObjectHideFlags: 0
Expand Down
5 changes: 2 additions & 3 deletions Demo/Assets/Scripts/ChatBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

public class ChatBar : Actor
{
public GameObject player;
public Sprite onlineSprite;
public Sprite offlineSprite;
public float viewRadius = 50;

public void Start()
{
player = GameObject.Find("Player");
//transform.position = new Vector3(1, 0, transform.position.z);
}

protected bool WithinView(Vector2 playerPosition)
Expand All @@ -25,6 +24,6 @@ protected bool WithinView(Vector2 playerPosition)

private void Update()
{
WithinView(new Vector2 (10, 10));
//WithinView(new Vector2 (10, 10));
}
}
20 changes: 13 additions & 7 deletions Demo/Assets/Scripts/MessageInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ public class MessageInput : MonoBehaviour
public int spriteCount = 9;
public Sprite[] spriteArray;
public string fileLine = "";
public string docPath;
public string filePath = "../Chatbox/messageHistory.txt";
public string projectPath;
public string filePath = "Chatbox/messageHistory.txt";

void Start()
{
docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
filePath = Path.Combine(docPath, filePath);
projectPath = Application.dataPath;
filePath = Path.Combine(projectPath, filePath);
chatBox = GameObject.Find("ChatBox").GetComponent<OpenChatBox>();
fileLine = System.IO.File.ReadLines( filePath.ToString() ).ToString();
if ( fileLine != "" ) messageIndex = int.Parse(fileLine);
Expand All @@ -34,13 +34,19 @@ void Update()
for (int i = 0 ; i < spriteCount ; i++) {
if (Input.GetKeyDown((i + 1).ToString())) {
messageIndex = i;
using ( StreamWriter outputFile = new StreamWriter( filePath.ToString() ) ) {
outputFile.WriteLine(messageIndex);
}

}
}

int realIndex = messageIndex % spriteCount;
spriteRenderer.sprite = spriteArray[realIndex];
}

void OnDestroy()
{
using ( StreamWriter outputFile = new StreamWriter( filePath.ToString() ) ) {
outputFile.WriteLine(messageIndex);
}

}
}
2 changes: 1 addition & 1 deletion Demo/Assets/Scripts/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void CheckFallDamage()
{
if (lastVelocity < -30f && CheckIfGrounded())
{
AdjustHealth(lastVelocity * 0.009f);
//AdjustHealth(lastVelocity * 0.009f);
}
lastVelocity = rb.velocity.y;
}
Expand Down