using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class TestPlayerScript : MonoBehaviour {
|
|
|
|
private Vector3 lastSentPos;
|
|
|
|
public float moveIncrement = 0.01f;
|
|
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
SendPosition();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void FixedUpdate () {
|
|
if (Vector3.Distance(lastSentPos, transform.position) > moveIncrement)
|
|
SendPosition();
|
|
}
|
|
|
|
private void SendPosition()
|
|
{
|
|
lastSentPos = transform.position;
|
|
|
|
Multiplayer.VectorMsg msg = new Multiplayer.VectorMsg(Multiplayer.ClientManager.Instance.ID, transform.position);
|
|
Multiplayer.ClientManager.Instance.SendMessage(Multiplayer.PlayerMsgID.Position, msg);
|
|
}
|
|
}
|