void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { // We own this player: send the others our data stream.SendNext(transform.position); stream.SendNext(transform.rotation); //send my state MoveMent myC = GetComponent <MoveMent>(); stream.SendNext((int)myC._characterState); stream.SendNext((bool)myC.isFinish); } else { // Network player, receive data this.correctPlayerPos = (Vector3)stream.ReceiveNext(); this.correctPlayerRot = (Quaternion)stream.ReceiveNext(); MoveMent myC = GetComponent <MoveMent>(); //receive network player's state myC._characterState = (BirdState)stream.ReceiveNext(); isFinish = (bool)stream.ReceiveNext(); //If the game is finished,stop the game if (isFinish) { Time.timeScale = 0f; } } }
private void Window1_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { switch (e.Key) { case Key.Up: Walk = MoveMent.Pos; break; case Key.Down: Walk = MoveMent.Neg; break; case Key.Left: Strafe = MoveMent.Neg; break; case Key.Right: Strafe = MoveMent.Pos; break; case Key.Z: CamPos.Y += 0.1; break; case Key.X: CamPos.Y -= 0.1; break; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { MoveMent moveMent = collision.GetComponent <MoveMent>(); moveMent.canMove = false; UImanager._instance.Playpolt2(); } }
public Floor GetNext(MoveMent move) { var nextFuc = Nexts.FirstOrDefault(n => n(this, move) != null); if (nextFuc == null) { return(null); } return(nextFuc(this, move)); }
private void Awake() { Cube = Instantiate(Cube_Data); if (!instance) { instance = this; } else { DestroyImmediate(this); } }//123
void StartGame() { // Spawn our local player camera.enabled = false; Vector3 location = new Vector3(-80f, 98f, 118f); GameObject bird = PhotonNetwork.Instantiate(this.playerPrefabName, location, Quaternion.identity, 0); bird.gameObject.transform.Rotate(0.0f, 90.0f, 0.0f); MoveMent controller = bird.GetComponent <MoveMent>(); // Enable the camera controller.isControllable = true; Transform playerCam = bird.transform.Find("Camera"); playerCam.gameObject.SetActive(true); start.enabled = true; }
private void Window1_KeyUp(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Up: Walk = MoveMent.None; break; case Key.Down: Walk = Walk = MoveMent.None; break; case Key.Left: Strafe = MoveMent.None; break; case Key.Right: Strafe = MoveMent.None; break; } }
public void Roll() { var roll = RandomHelper.Next(1, 7); Movement = new MoveMent(Group, roll); }
public Player(string name, Group group) { Name = name; Group = group; Movement = new MoveMent(Group, 0); }