コード例 #1
0
ファイル: NetworkTransform.cs プロジェクト: mrgiang/U_Nodejs
 public void Start()
 {
     networkIdentity   = GetComponent <NetworkIdentity>();
     oldPosition       = transform.position;
     player            = new Player();
     player.position   = new Position();
     player.position.x = 0;
     player.position.y = 0;
     player.position.z = 0;
     player.id         = networkIdentity.GetID();
     if (!networkIdentity.IsControlling())
     {
         enabled = false;
     }
 }
コード例 #2
0
        private void onAnimationUpdate(SocketIOEvent E)
        {
            string id = E.data["id"].ToString();

            if (id == networkIdentity.GetID())
            {
                animatorState     = (NetworkAnimatorState)((int)E.data["state"].f);
                animatorDirection = (NetworkAnimatorDirection)((int)E.data["direction"].f);
                Vector2Int vect = getValues(animatorDirection);
                Debug.LogFormat("Received: ({0},{1})", vect.x, vect.y);
                animator.SetFloat("x", vect.x);
                animator.SetFloat("y", vect.y);

                if (animatorState == NetworkAnimatorState.Attacking)
                {
                    animator.SetTrigger("isAttacking");
                }
            }
        }