public override void Drop(RpcArgs args) { uint playerID = args.GetNext <uint>(); Player p = GameLogic.GetPlayerByID(playerID); p.networkObject.SendRpc(Player.RPC_ADD_SCORE, Receivers.AllBuffered, 1); BMSLogger.DebugLog("Player scored : " + playerID); }
// ------------------------------------------------------------------------ private void Start() { Instance = this; var player = NetworkManager.Instance.InstantiatePlayer(position: StartPos); PlayerTransform = player.transform; BMSLogger.DebugLog("Player " + player.networkObject.NetworkId + " joined the game"); }
public override void Push(RpcArgs args) { lastPlayerIDTouched = args.GetNext <uint>(); Vector2 dir = args.GetNext <Vector2>(); if (lastPlayerIDTouched == 0) { return; } BMSLogger.DebugLog("-- push rpc by " + lastPlayerIDTouched + " --"); rb2d.AddForce(dir, ForceMode2D.Impulse); }
void CheckAndRespawnItems() { int itemNb = GameObject.FindObjectsOfType <PickableItem>().Length; int newItemNb = maxItems - itemNb; for (int i = 0; i < newItemNb; i++) { BMSLogger.DebugLog("Spawning 1 item"); var item = NetworkManager.Instance.InstantiatePickableItem( position: generateRd(15, 15, 3, 3, new Vector3(0.06f, 3.41f))); //position:new Vector3(Random.Range(-10, 10), Random.Range(-20, -5))); } }