Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using Mirror;
- using UnityEngine;
- public class Movement : NetworkBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- Debug.Log("Do I have autority over this---"+hasAuthority);
- transform.Translate(Random.Range(-2f,2f), Random.Range(0f, 4f), Random.Range(0f, 1f));
- }
- // Update is called once per frame
- void Update()
- {
- MovementCube();
- }
- private void MovementCube()
- {
- if (Input.GetKeyDown(KeyCode.UpArrow))
- {
- transform.Translate(Vector3.up);
- if (PlayerConnectionObject.singelton != null) PlayerConnectionObject.singelton.CmdMove(transform.position);
- //if (PlayerConnectionObject.singelton != null) CmdMove(transform.position);
- }
- if (Input.GetKeyDown(KeyCode.DownArrow))
- {
- transform.Translate(Vector3.down);
- if (PlayerConnectionObject.singelton != null) PlayerConnectionObject.singelton.CmdMove(transform.position);
- //if (PlayerConnectionObject.singelton != null) CmdMove(transform.position);
- }
- }
- //[Command]
- //public void CmdMove(Vector3 positionTransform)
- //{
- // Debug.Log("server doing stuff");
- // PlayerConnectionObject.refer.transform.position = positionTransform;
- //}
- }
Add Comment
Please, Sign In to add comment