Exemple #1
0
        protected virtual void OnFixedUpdate(float timeMult)
        {
            eventMap.ProcessGenerators(timeMult);

            ResolveCollisions();

            // ToDo: Weather

            /*if (weatherType != WeatherType.None && commonResources.Graphics != null)
             * {
             *  // ToDo: Apply weather effect to all other cameras too
             *  Vector3 viewPos = cameras[0].Transform.Pos;
             *  for (int i = 0; i < weatherIntensity; i++)
             *  {
             *      TileMap.DebrisCollisionAction collisionAction;
             *      if (weatherOutdoors)
             *      {
             *          collisionAction = TileMap.DebrisCollisionAction.Disappear;
             *      }
             *      else
             *      {
             *          collisionAction = (MathF.Rnd.NextFloat() > 0.7f
             *              ? TileMap.DebrisCollisionAction.None
             *              : TileMap.DebrisCollisionAction.Disappear);
             *      }
             *
             *      Vector3 debrisPos = viewPos + MathF.Rnd.NextVector3((LevelRenderSetup.TargetSize.X / -2) - 40,
             *                        (LevelRenderSetup.TargetSize.Y * -2 / 3), MainPlaneZ,
             *                        LevelRenderSetup.TargetSize.X + 120, LevelRenderSetup.TargetSize.Y, 0);
             *
             *      if (weatherType == WeatherType.Rain)
             *      {
             *          GraphicResource res = commonResources.Graphics["Rain"];
             *          Material material = res.Material.Res;
             *          Texture texture = material.MainTexture.Res;
             *
             *          float scale = MathF.Rnd.NextFloat(0.4f, 1.1f);
             *          float speedX = MathF.Rnd.NextFloat(2.2f, 2.7f) * scale;
             *          float speedY = MathF.Rnd.NextFloat(7.6f, 8.6f) * scale;
             *
             *          debrisPos.Z = MainPlaneZ * scale;
             *
             *          tileMap.CreateDebris(new TileMap.DestructibleDebris
             *          {
             *              Pos = debrisPos,
             *              Size = res.Base.FrameDimensions,
             *              Speed = new Vector2(speedX, speedY),
             *
             *              Scale = scale,
             *              Angle = MathF.Atan2(speedY, speedX),
             *              Alpha = 1f,
             *
             *              Time = 180f,
             *
             *              Material = material,
             *              MaterialOffset = texture.LookupAtlas(res.FrameOffset + MathF.Rnd.Next(res.FrameCount)),
             *
             *              CollisionAction = collisionAction
             *          });
             *      }
             *      else
             *      {
             *          GraphicResource res = commonResources.Graphics["Snow"];
             *          Material material = res.Material.Res;
             *          Texture texture = material.MainTexture.Res;
             *
             *          float scale = MathF.Rnd.NextFloat(0.4f, 1.1f);
             *          float speedX = MathF.Rnd.NextFloat(-1.6f, -1.2f) * scale;
             *          float speedY = MathF.Rnd.NextFloat(3f, 4f) * scale;
             *          float accel = MathF.Rnd.NextFloat(-0.008f, 0.008f) * scale;
             *
             *          debrisPos.Z = MainPlaneZ * scale;
             *
             *          tileMap.CreateDebris(new TileMap.DestructibleDebris
             *          {
             *              Pos = debrisPos,
             *              Size = res.Base.FrameDimensions,
             *              Speed = new Vector2(speedX, speedY),
             *              Acceleration = new Vector2(accel, -MathF.Abs(accel)),
             *
             *              Scale = scale,
             *              Angle = MathF.Rnd.NextFloat(MathF.TwoPi),
             *              AngleSpeed = speedX * 0.02f,
             *              Alpha = 1f,
             *
             *              Time = 180f,
             *
             *              Material = material,
             *              MaterialOffset = texture.LookupAtlas(res.FrameOffset + MathF.Rnd.Next(res.FrameCount)),
             *
             *              CollisionAction = collisionAction
             *          });
             *      }
             *  }
             * }*/

            // Active Boss
            if (activeBoss != null && activeBoss.Scene == null)
            {
                activeBoss = null;

                // ToDo

                InitLevelChange(ExitType.Normal, null);
            }

            if (initState == InitState.Initializing)
            {
                initState = InitState.Initialized;
            }


            //collisionsCountA = 0;
            //collisionsCountB = 0;
            //collisionsCountC = 0;
        }