addPositionManager

This commit is contained in:
jimmy Lim 2021-11-12 12:03:40 -05:00
parent 43f48e9d5c
commit 834444bc41
6 changed files with 70 additions and 4 deletions

View File

@ -70,7 +70,7 @@ public class Executable : MonoBehaviour
}
yield return new WaitForSeconds(1.5f);
yield return new WaitForSeconds(1.0f);
DataSaver.SaveTime();
if (count <= 0)
{

View File

@ -20,7 +20,7 @@ namespace Assets.Scripts.Utilities
writeToFile(toSave);
}
public static void SavePosition()
public static void SavePosition(List<Position> position)
{
//TODO
}

View File

@ -8,7 +8,12 @@ namespace Assets.Scripts.Utilities
{
class Position
{
private float x;
private float y;
private float x { get; set; };
private float y { get; set; };
public Position(x, y)
{
this.x = x;
this.y = y;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 84d96ee6f6aa2954595a4919634721f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PositionManager : MonoBehaviour
{
public GameObject player;
public List<Position> data;
public bool notSended = true;
// Start is called before the first frame update
void Start()
{
data = "";
StartCoroutine("TackerExecute");
}
// Update is called once per frame
void Update()
{
}
IEnumerator TackerExecute()
{
while (notSended)
{
data.Add(new Position(player.transform.position.x, player.transform.position.y));
yield return new WaitForSeconds(1.0f);
}
}
public sendData()
{
notSended = false;
DataSaver.SavePosition(data);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 350cae5776b138d4795c1003647b50b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: