示例#1
0
 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;
         }
     }
 }
示例#2
0
        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;
            }
        }
示例#3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         MoveMent moveMent = collision.GetComponent <MoveMent>();
         moveMent.canMove = false;
         UImanager._instance.Playpolt2();
     }
 }
示例#4
0
        public Floor GetNext(MoveMent move)
        {
            var nextFuc = Nexts.FirstOrDefault(n => n(this, move) != null);

            if (nextFuc == null)
            {
                return(null);
            }
            return(nextFuc(this, move));
        }
示例#5
0
 private void Awake()
 {
     Cube = Instantiate(Cube_Data);
     if (!instance)
     {
         instance = this;
     }
     else
     {
         DestroyImmediate(this);
     }
 }//123
示例#6
0
    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;
    }
示例#7
0
        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;
            }
        }
示例#8
0
        public void Roll()
        {
            var roll = RandomHelper.Next(1, 7);

            Movement = new MoveMent(Group, roll);
        }
示例#9
0
 public Player(string name, Group group)
 {
     Name     = name;
     Group    = group;
     Movement = new MoveMent(Group, 0);
 }