public void Update() { var state = mods.ToBitfield(); if (state == oldState) { return; } oldState = state; field.Set(idStr + mods.GetDebugString()); }
/// Spawn items when they are due. void Update() { if (!isPlaying) { return; } if (Time.time > nextPingUpdateTime) { nextPingUpdateTime = Time.time + pingUpdateTime; pDbgLagField.Set("Ping: " + 0); } for (int i = 0; i < sPlayerData.Count; i++) { var data = sPlayerData[i]; if (data.positionSampler == null) { continue; } data.positionSampler.Run(data.playerGo.transform.position); } if (!isServer) { return; } if (s2ai != null) { s2ai.ExecAndMoveNext(); } if (itemFrequency != ItemFrequency.None && Time.time > nextItemTime) { nextItemTime = Time.time + GetNextItemSpawnTime(); SpawnItem(); } }
void UpdateDebug() { int netMax = 0, netAvg = 0; foreach (var pair in netPools) { var count = pair.Value.Count; if (count > netMax) { netMax = count; } netAvg += count; } if (netPools.Count != 0) { netAvg /= netPools.Count; } int locMax = 0, locAvg = 0; foreach (var pair in localPools) { var count = pair.Value.Count; if (count > locMax) { locMax = count; } locAvg += count; } if (localPools.Count != 0) { locAvg /= localPools.Count; } dbgNetPool.Set("NetPool A:" + netAvg + " M:" + netMax); dbgLocPool.Set("LocPool A:" + locAvg + " M:" + locMax); }
protected void BaseInput() { if (pInputManager == null) { return; } if (eLives <= 0) { return; } if (!hasAuthority) { for (var i = 0; i < eAttacks.Length; i++) { eAttacks[i].UpdateStateNonAuthoritative(); } eItemAttack.UpdateStateNonAuthoritative(); return; } pJoystick.KeyboardUpdate(); veloF.Set("Vp{0}x = {1}".F(eId, lRb.velocity.x.ToString())); if (!IsModifierEnabled(ModId.InKnockback)) { Walk(pJoystick.GetHorizontalAxis()); } AddExtraGravity(); if (pInputManager.IsControlActive(Control.Jump) && !eModifiers.CantMove.IsEnabled() && !eModifiers.CantJump.IsEnabled()) { pInputManager.InvalidateControl(Control.Jump); var jf = lHooks.CallJumpForceHooks(pIsTouchingGround, pNumJumps++, jumpForce); if (jf != 0) { if (pNumJumps > 0 && lRb.velocity.y < minDoubleJumpVelocity) { lRb.velocity = new Vector2(lRb.velocity.x, minDoubleJumpVelocity); } lRb.AddForce(new Vector2(0f, jf), ForceMode2D.Impulse); } } // Only fall through for a "hard down". if (pJoystick.GetVerticalAxis() < -.85f && !eModifiers.CantMove.IsEnabled()) { if (!eShouldFallThroughOneWayPlatform) { eShouldFallThroughOneWayPlatform = true; CmdFallThroughOneWayPlatform(); } } else { if (eShouldFallThroughOneWayPlatform) { eShouldFallThroughOneWayPlatform = false; CmdStopFallingThroughOneWayPlatform(); } } if (pInputManager.IsControlActive(Control.Block)) { if (!eShield.IsActive()) { eShield.Activate(); } } else { if (eShield.IsActive()) { eShield.Deactivate(); } } for (var i = 0; i < eAttacks.Length; i++) { eAttacks[i].UpdateState(pInputManager, Control.Attack1 + i); } eItemAttack.UpdateState(pInputManager, Control.Item); pModifiersDebugField.Update(); }