Esempio n. 1
0
        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();
        }
Esempio n. 2
0
File: Blob.cs Progetto: kfazi/AgarIo
        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();
        }
Esempio n. 3
0
 public MovePlayerCommand(float dx, float dy)
 {
     _direction = new Vector(dx, dy);
 }
Esempio n. 4
0
File: Blob.cs Progetto: kfazi/AgarIo
        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;
            }
        }
Esempio n. 5
0
 public EjectedMassBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position)
     : base(game, physics, stateTracker, position)
 {
     MakeDynamic();
 }
Esempio n. 6
0
 public FoodBlob(IGame game, IPhysics physics, IStateTracker stateTracker, Vector position)
     : base(game, physics, stateTracker, position, game.Settings.FoodMass)
 {
     MakeStatic();
 }
Esempio n. 7
0
 public bool Equals(Vector other)
 {
     return Math.Abs(X - other.X) < Epsilon && Math.Abs(Y - other.Y) < Epsilon;
 }
Esempio n. 8
0
 public float Dist(Vector other)
 {
     return (float)Math.Sqrt(Math.Pow(X - other.X, 2) + Math.Pow(Y - other.Y, 2));
 }