Update() public method

public Update ( ) : void
return void
Exemplo n.º 1
0
        private Boolean TryOpenDoor(GridSlot p_slot, EDirection p_dir)
        {
            List <InteractiveObject> doors = p_slot.GetDoors();

            for (Int32 i = 0; i < doors.Count; i++)
            {
                Door door = (Door)doors[i];
                if (door.Location == p_dir && door.State == EInteractiveObjectState.DOOR_CLOSED && door.Commands.Count > 0)
                {
                    door.Execute(LegacyLogic.Instance.MapLoader.Grid);
                    door.Update();
                    return(true);
                }
            }
            GridSlot neighborSlot = p_slot.GetNeighborSlot(LegacyLogic.Instance.MapLoader.Grid, p_dir);

            doors = neighborSlot.GetDoors();
            for (Int32 j = 0; j < doors.Count; j++)
            {
                Door door2 = (Door)doors[j];
                if (door2.Location == EDirectionFunctions.GetOppositeDir(p_dir) && door2.State == EInteractiveObjectState.DOOR_CLOSED && door2.Commands.Count > 0)
                {
                    door2.Execute(LegacyLogic.Instance.MapLoader.Grid);
                    door2.Update();
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            Door door = new Door();

            door.Id = Convert.ToInt32(tbxDoorId.Text);

            if (door.Id == 0 && tbxDoorName.Text != "" && tbxDepartmentId.Text != "")//insert
            {
                door.Name         = tbxDoorName.Text;
                door.DepartmentId = Convert.ToInt32(tbxDepartmentId.Text);
                int sonuc = door.Insert();
                MessageBox.Show("Kayıt Başarılı.");
                LoadDoorsGrid();
                BtnNew_Click(null, null);
            }
            else if (door.Id != 0)//update
            {
                int sonuc = door.Update();
                MessageBox.Show("Güncelleme Başarılı.");
                LoadDoorsGrid();
                BtnNew_Click(null, null);
            }
            else
            {
                MessageBox.Show("Door ismi ve Department Id yazınız.");
            }
            LoadDoorsGrid();
            BtnNew_Click(null, null);
        }
Exemplo n.º 3
0
        public override void Update(GameTime gameTime, bool OtherScreenHasFocus, bool CoveredByOtherScreen)
        {
            //Transition out
            if (Door.CurrentAnimation == 0)
            {
                Background.Update(gameTime);
                Player.Update(gameTime);
                Camera.Update(gameTime);
                Score.Update(gameTime);
                EnemyManager.Update(gameTime);
                Health.Update(gameTime);
                GFM.Update(gameTime);
                PickupManager.Update(gameTime);
            }
            else
            {
                if (Door.FinishedOnce)
                {
                    ScreenManager.AddScreen(new DeathScreen(ScreenManager, Score.Value));
                    ScreenManager.RemoveScreen(this);
                }
            }
            Door.Update(gameTime);

            base.Update(gameTime, OtherScreenHasFocus, CoveredByOtherScreen);
        }
Exemplo n.º 4
0
        public override void Update(GameTime gameTime, bool OtherScreenHasFocus, bool CoveredByOtherScreen)
        {
            Door.Update(gameTime);

            if (Door.FinishedOnce == true && Door.CurrentAnimation == 1)
            {
                ScreenManager.AddScreen(new GameScreen(ScreenManager));
                ScreenManager.RemoveScreen(this);
            }

            base.Update(gameTime, OtherScreenHasFocus, CoveredByOtherScreen);
        }
Exemplo n.º 5
0
 // Update is called once per frame
 void Update()
 {
     if (GetComponent <mouseHovor>().mouseOver == true && Input.GetKeyDown(KeyCode.E))
     {
         DoorView.RPC("DoorInteract", RpcTarget.AllBuffered, null);
         //ThisDoor.Interact();
     }
     else if (locked && ThisKey.GetPicked() == true && GetComponent <mouseHovor>().mouseOver == true && Input.GetKeyDown(KeyCode.Mouse0))
     {
         if (Player.AllPlayers[0].UseItemInInventory(ThisKey))
         {
             DoorView.RPC("DoorUnlock", RpcTarget.AllBuffered, null);
         }
     }
     ThisDoor.Update();
 }
Exemplo n.º 6
0
        public override void Update(GameTime gameTime, bool OtherScreenHasFocus, bool CoveredByOtherScreen)
        {
            Door.Update(gameTime);
            Menu.Update(gameTime);
            Score.Update(gameTime);

            if (Door.CurrentAnimation == 1)
            {
                if (Door.FinishedOnce)
                {
                    if (Menu.CurrentFrame == 0)
                    {
                        ScreenManager.AddScreen(new GameScreen(ScreenManager));
                    }
                    else
                    {
                        ScreenManager.AddScreen(new MenuScreen(ScreenManager));
                    }

                    ScreenManager.RemoveScreen(this);
                }
            }
            base.Update(gameTime, OtherScreenHasFocus, CoveredByOtherScreen);
        }
Exemplo n.º 7
0
        public override void Update(GameTime gameTime)
        {
            InputHelper.Update();

            if (GameState.isDead)
            {
                Game.SetScene(new DeathScene(Game, Graphics));
                return;
            }

            var pc = InputHelper.GetPlayerController();

            var Projectiles = Player.Update(pc, sprites, gameTime);

            var enProjectiles = new List <EnemyProjectile>();

            bool touching;

            touching = door.Update(Player, gameTime);
            if (touching)
            {
                ClearAndLoad(Level.NextLevel());
            }

            foreach (var sprite in sprites)
            {
                if (sprite == Player)
                {
                    continue;
                }

                if (sprite is Enemy)
                {
                    var enemy = (Enemy)sprite;
                    enProjectiles.AddRange(enemy.Update(gameTime, sprites, Player));
                }
                else if (sprite is Wall)
                {
                    var wall = (Wall)sprite;
                    wall.Update(gameTime, sprites.Where(x => x is Projectile).ToList());
                }
                else if (sprite is Door)
                {
                }
                else
                {
                    sprite.Update(gameTime);
                }
            }

            if (pc.Space)
            {
                var portals = sprites.Where(x => x is Portal).ToList();

                foreach (Portal portal in portals)
                {
                    SoundManager.PlaySound("warp");
                    Player.TeleportTo(new Vector2(portal.Rectangle.X, portal.Rectangle.Y));
                    portal.IsDead = true;
                    break;
                }
            }

            if (pc.Mouse.LeftClicked)
            {
                var portals = sprites.Where(x => x is Portal).ToList();
                foreach (Portal portal in portals)
                {
                    if (portal.Rectangle.Contains(pc.Mouse.Position))
                    {
                        SoundManager.PlaySound("warp");
                        Player.TeleportTo(new Vector2(portal.Rectangle.X, portal.Rectangle.Y));
                        portal.IsDead = true;
                        break;
                    }
                }
            }

            var deadSprites = sprites.Where(x => x.IsDead).ToList();

            foreach (var s in deadSprites)
            {
                if (s is Enemy)
                {
                    sprites.Add(new Portal(ContentManager.GetImage("Portal"), new Vector2(s.Rectangle.X, s.Rectangle.Y)));
                }
                sprites.Remove(s);
            }

            if (Projectiles != null && Projectiles.Count() > 0)
            {
                SoundManager.PlaySound("fire");
                foreach (var proj in Projectiles)
                {
                    sprites.Add(proj);
                }
            }
            if (enProjectiles != null && enProjectiles.Count() > 0)
            {
                SoundManager.PlaySound("fire");
                foreach (var proj in enProjectiles)
                {
                    sprites.Add(proj);
                }
            }

            checkIfAllEnemiesAreDead();

            HUD.Update(gameTime);
        }
Exemplo n.º 8
0
 public void UpdateDoor(float ms)
 {
     _door.Update(ms);
 }