Пример #1
0
 public override void Die()
 {
     foreach (GEntity Tile in GameLevel.GetIntersectingTiles(ExplosionRange))
     {
         if (GameLevel.GetIntersectingEntities(Tile).Count == 0)
         {
             GameLevel.AddParticle(new MineExplosion(Tile.X, Tile.Y));
         }
     }
 }
Пример #2
0
        public override void Update()
        {
            Shooting = false;
            UpdateMoving();
            UpdateBonuses();
            UpdateInventory();

            IntersectingTiles = GameLevel.GetIntersectingTiles(this);

            // Self-destruction, yay!
            if (GameLevel.Input.Z.Clicked)
            {
                Damage(10);
            }

            LastUsedInvItem = null;
            if (GameLevel.Input.Attack.Clicked)
            {
                LastUsedInvItem = InvItem.GetPlayersInvItem(Id, CurrentInvItemAKey);
                LastUsedInvItem.Use(Id);
            }
            else
            {
                Shooting = false;
            }

            if (SkippedAnimTicks++ > 1)
            {
                SkippedAnimTicks = 0;
                if (AnimState++ >= 2)
                {
                    AnimState = 0;
                }
            }

            if (ReqAngle != 0)
            {
                Angle += 6;
                if (Angle >= ReqAngle)
                {
                    ReqAngle = 0;
                    Angle    = 0;
                }
            }

            // =================
            // Dragging entities
            GEntity Range = null;

            if (Direction == Directions.Up)
            {
                Range = new GEntity(X, Y - 4, W, H);
            }
            if (Direction == Directions.Right)
            {
                Range = new GEntity(X, Y, W + 8, H);
            }
            if (Direction == Directions.Down)
            {
                Range = new GEntity(X, Y, W, H + 8);
            }
            if (Direction == Directions.Left)
            {
                Range = new GEntity(X - 8, Y, W, H);
            }

            List <GEntity> InRangeEntities = GameLevel.GetIntersectingEntities(Range);
            bool           PassUnbindTick  = false;

            if (InRangeEntities.Count > 0)
            {
                GEntity E = InRangeEntities[0];

                if (E.Draggable && E.Owner == Id)
                {
                    E.HasFocus = true;
                    if (GameLevel.Input.E.Clicked)
                    {
                        DropBindedEntity();
                        E.BindMasterEntityMoving(this);
                        SetSlaveEntityMoving(E);
                        PassUnbindTick = true;
                    }
                }
            }

            if (!PassUnbindTick && BindingMaster && GameLevel.Input.E.Clicked)
            {
                DropBindedEntity();
            }

            GameLevel.ShowGrid = !IsHolding() && BindingMaster && InvItem.GetInvItem(GetSlaveEntityMoving().ToString()).ToString().Equals("inventory-item") || CurrentInvItemAKey != 1;

            int r = 200;

            GameLevel.RevealFog(iX - r / 2 + W / 2, iY - r / 2 + H / 2, r);
        }