public override void UpdateFixed(float step_time)
        {
            Listener.Position = new Vector3f(player.Bounds.center.X, player.Bounds.center.Y, 5.0f);

            UpdatePlayerInput();



            // old: gameActions.Dequeue().Invoke()
            Task.Factory.StartNew(() => {
                while (gameActions.Count > 0)
                {
                    gameActions.Dequeue().Invoke();
                }
            });



            ShakeScreen.Update();

            player.Update(step_time);

            entityPool.Update(step_time);


            /*
             * if (cCollision.IsPointInsideBox(player.Position, gameWorld.LevelEndRegion))
             * {
             *  //vége a pályának
             * }
             */

            this.particleManager.Update(step_time);
            effectSystem.Update();

            Vector2f playerCenter = player.Bounds.center;

            this.camera.Update(playerCenter + ShakeScreen.Offset, gameWorld.WorldBounds);

            // worldEnvironment.Update(step_time);
        }
Beispiel #2
0
    void Update()
    {
        if (newEntities.Count > 0)
        {
            int num = newEntities.Count;
            for (int i = 0; i < num; ++i)
            {
                entities.Add(newEntities.Dequeue());
            }
        }

        foreach (Entity entity in entities)
        {
            //Debug.Log("GameWorld.Update, tag:" + entity.identity.tag);
            aiSystem.Update(entity.identity, entity.aiComponent, entity.inputComponent);
            controllerSystem.Update(entity.tankComponent, entity.inputComponent, entity.moveComponent, entity.gameobjectComponent);
            gunSystem.Update(entity.gunComponent, entity.inputComponent, entity.gameobjectComponent);
            bulletSystem.Update(entity.identity, entity.bulletComponent, entity.moveComponent, entity.gameobjectComponent);
            buffSystem.Update(entity.buffComponent);
            effectSystem.Update(entity.identity, entity.effectComponent, entity.gameobjectComponent);
            laserSystem.Update(entity.identity, entity.laserComponent, entity.gameobjectComponent);
            levelSystem.Update();
            inputSystem.Update(entity.inputComponent);
        }

        if (expiredEntities.Count > 0)
        {
            Entity entity = null;
            int    num    = expiredEntities.Count;
            for (int i = 0; i < num; ++i)
            {
                entity = expiredEntities.Dequeue();
                Debug.Log("remove entity:" + entity.identity.tag);
                entity.gameobjectComponent.Destroy();
                entities.Remove(entity);
            }
        }
    }