Ejemplo n.º 1
0
    public void Launch(int degree, int force)
    {
        /*
         * if(!GameManager.Instance.isPlayerA)
         * {
         *      degree += 180 * 10000;
         * }
         */
        float deg = (float)degree / 10000;
        float rad = deg * Mathf.Deg2Rad;
        float len = (float)force / 10000;

        rb.velocity = new Vector2(-Mathf.Cos(rad), -Mathf.Sin(rad)) * len * GetComponent <Ball>().launchSpeed;
        if (RoundManager.Instance.isCurrentPlayerA == GetComponent <Ball>().isPlayerA)
        {
            /*
             * if(!GetComponent<Ball>().isPlayerA)
             * {
             *      degree += 180;
             * }
             */
            //BallLaunchClass ballLaunchClass = new BallLaunchClass(GetComponent<Ball>().id, -1, force, degree + 180 * 10000);
            BallLaunchClass ballLaunchClass = new BallLaunchClass(GetComponent <Ball>().id, -1, force, degree);
            LoginRequist.ucl.rpcCall("play.id_ball_launch", JsonConvert.SerializeObject(ballLaunchClass), null);
        }
    }
Ejemplo n.º 2
0
        private void NotifyBallLaunch(Message msg)
        {
            object          retParam     = MessagePackDecoder <object>(msg.NotifyInfo.RpcParams);
            BallLaunchClass idBallLaunch = (BallLaunchClass)JsonConvert.DeserializeObject(retParam.ToString(), typeof(BallLaunchClass));

            if (idBallLaunch != null)
            {
                RoundManager.Instance.GetServerMsg(idBallLaunch.ball_id, idBallLaunch.radian, idBallLaunch.force);
            }

            //ServerModules.BallLaunchServer.text = idBallLaunch.radian.ToString();
            //DebugLogger.Debug("idBallLaunch class :" + idBallLaunch.radian.ToString());
        }
Ejemplo n.º 3
0
        void BallLaunchFunc()
        {
            BallLaunchClass ballLaunchAttr = new BallLaunchClass(1, -1, 12f, 1f);

            LoginRequist.ucl.rpcCall("play.id_ball_launch", JsonConvert.SerializeObject(ballLaunchAttr), null);
        }