コード例 #1
0
ファイル: Action2008.cs プロジェクト: jallenzhang/project3
    protected override void DecodePackage(NetReader reader)
    {
        Debug.logger.Log("Action2008 back!");
        actionResult       = new ActionResult();
        actionResult["qx"] = reader.getFloat();
        actionResult["qy"] = reader.getFloat();
        actionResult["qz"] = reader.getFloat();
        actionResult["sx"] = reader.getFloat();
        actionResult["sy"] = reader.getFloat();
        actionResult["sz"] = reader.getFloat();
        Action2008EventParam param = new Action2008EventParam();

        param.ballPosition = new Vector3(-actionResult.Get <float>("qx"), actionResult.Get <float>("qy"), actionResult.Get <float>("qz"));
        param.ballVelocity = new Vector3(-actionResult.Get <float>("sx"), actionResult.Get <float>("sy"), actionResult.Get <float>("sz"));
        EventService.Instance.GetEvent <Action2008Event>().Publish(param);
        Net.Instance.ReBuildHearbeat();
    }
コード例 #2
0
 void onFingerReleasePushed(Action2008EventParam param)
 {
     gm.enemyBall.transform.localPosition = param.ballPosition;
     gm.enemyBall.transform.GetComponent <Rigidbody2D>().velocity = new Vector2(param.ballVelocity.x, param.ballVelocity.y);
     gm.ResetEnemy();
 }