public PlayerBlob(Player owner, IGame game, IPhysics physics, IStateTracker stateTracker, Vector position, bool controlledByPlayer) : base(game, physics, stateTracker, position, game.Settings.MinPlayerBlobMass) { _physics = physics; Owner = owner; RecombineTicks = game.TickCount; ControlledByPlayer = controlledByPlayer; Mass = Game.Settings.MinPlayerBlobMass; MakeDynamic(); }
protected Blob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position, float mass) { _physics = physics; Game = game; StateTracker = stateTracker; Position = position; Mass = mass; IsStatic = false; _isCreated = false; Id = BlobIdProvider.GetId(); }
public MovePlayerCommand(float dx, float dy) { _direction = new Vector(dx, dy); }
public void SyncWithPhysics(bool overrideAll) { if (_radiusOverride || overrideAll) { _body.Radius = _radius; _radiusOverride = false; } else { if (_radius != _body.Radius) { StateTracker.UpdateBlob(this); } _radius = _body.Radius; } if (_positionOverride || overrideAll) { _body.Position = _position; _positionOverride = false; } else { if (_position != _body.Position) { StateTracker.UpdateBlob(this); } _position = _body.Position; } if (_body.IsStatic) { return; } if (_velocityOverride || overrideAll) { _body.LinearVelocity = _velocity; _velocityOverride = false; } else { _velocity = _body.LinearVelocity; } if (_massOverride || overrideAll) { _body.Mass = _mass; _massOverride = false; } else { _mass = _body.Mass; } }
public EjectedMassBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position) : base(game, physics, stateTracker, position) { MakeDynamic(); }
public FoodBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position) : base(game, physics, stateTracker, position, game.Settings.FoodMass) { MakeStatic(); }
public bool Equals(Vector other) { return Math.Abs(X - other.X) < Epsilon && Math.Abs(Y - other.Y) < Epsilon; }
public float Dist(Vector other) { return (float)Math.Sqrt(Math.Pow(X - other.X, 2) + Math.Pow(Y - other.Y, 2)); }