Пример #1
0
        public Collidable(int w, int h, MovementController mc, LifeController lc, DamageController dc)
        {
            ID = -1;
            _width = w;
            _height = h;
            CollidedAt = new Vector2();            
            _bounds = new Rectangle(Convert.ToInt32(mc.Position.X), Convert.ToInt32(mc.Position.Y), _width, _height);
            MovementController = mc;
            LifeController = lc;
            DamageController = dc;
            Controllable = new ValueRef<bool>(true);

            _serverID = Interlocked.Increment(ref _itemCount);
        }
Пример #2
0
        public virtual void HandleOutOfBounds()
        {
            _altered = true;
            var bounceMultiplier = new Vector2(1, 1);

            // Collided with left or right side
            if (MovementController.Position.X <= 0 || (MovementController.Position.X + Width()) >= Map.WIDTH)
            {
                bounceMultiplier = new Vector2(-Map.BARRIER_DEPRECATION, Map.BARRIER_DEPRECATION);
            }
            else if (MovementController.Position.Y <= 0 || (MovementController.Position.Y + Height()) >= Map.HEIGHT) // Top or bottom
            {
                bounceMultiplier = new Vector2(Map.BARRIER_DEPRECATION, -Map.BARRIER_DEPRECATION);
            }

            // Re-position object in bounds
            MovementController.RepositionInBounds(_width, _height);

            //Bounce
            MovementController.Forces   *= bounceMultiplier;
            MovementController.Velocity *= bounceMultiplier;
            UpdateBounds();
        }
Пример #3
0
 public MovementAbility(string name, MovementController movementController)
     : base(name)
 {            
     _movementController = movementController;
     _initialPower = _movementController.Power;
 }
Пример #4
0
 public override void StopMoving(Movement where, long commandID = -1)
 {
     Host.IdleManager.RecordActivity();
     MovementController.StopMoving(where);
 }
Пример #5
0
 public MovementAbility(string name, MovementController movementController)
     : base(name)
 {
     _movementController = movementController;
     _initialPower       = _movementController.Power;
 }
Пример #6
0
 public Powerup(int w, int h, MovementController mc, LifeController lc, DamageController dc, short type)
     : base(w, h, mc, lc, dc)
 {
     ID   = Interlocked.Increment(ref _powerupGUID);
     Type = type;
 }
Пример #7
0
 public Powerup(int w, int h, MovementController mc, LifeController lc, DamageController dc, short type)
     : base(w, h, mc, lc, dc)
 {
     ID = Interlocked.Increment(ref _powerupGUID);
     Type = type;
 }