public override void Think() { base.Think(); if (World.DistanceOutOfBounds(Position, World.Hook.ObstacleBorderBuffer) > 0) { var speed = TargetMomentum.Length(); speed *= Multiplier; if (Position != Vector2.Zero) { TargetMomentum = Vector2.Normalize(Vector2.Zero - Position) * speed; } } var weatherMultiplerDelta = Math.Abs(World.Hook.ObstacleMaxMomentumWeatherMultiplier - Multiplier); if (weatherMultiplerDelta / World.Hook.ObstacleMaxMomentumWeatherMultiplier > 0.02) { Multiplier = Multiplier * 0.97f + World.Hook.ObstacleMaxMomentumWeatherMultiplier * 0.03f; } Momentum = TargetMomentum * Multiplier; if (IdealSize > 0 && MathF.Abs(IdealSize - TargetSize) / IdealSize > 0.02f) { var step = (IdealSize * 0.97f + TargetSize * 0.03f) - IdealSize; if (step > 0) { step = MathF.Max(step, 0.03f * MathF.Abs(IdealSize - TargetSize)); } else if (step < 0) { step = MathF.Min(step, -0.03f * MathF.Abs(IdealSize - TargetSize)); } IdealSize += step; } if (IdealSize < World.Hook.ObstacleMinSize * 0.02) { if (World.Hook.ObstaclesSpawnShieldCannons) { SpawnPickup = true; } this.PendingDestruction = true; } /* if (GrowthRate != 0) * IdealSize += (GrowthRate * (float)World.LastStepSize); * * if (DieByTime > 0 && DieByTime < World.Time) * this.PendingDestruction = true; * * if (GrowthRate > 0 && IdealSize > TargetSize) * GrowthRate = 0;*/ //Console.WriteLine(Size); Size = (int)IdealSize; }
public override void Think() { base.Think(); if (World.DistanceOutOfBounds(Position) > 0) { var speed = IdealMomentum.Length(); speed *= Multiplier; if (Position != Vector2.Zero) { IdealMomentum = Vector2.Normalize(Vector2.Zero - Position) * speed; } } if (Math.Abs(World.Hook.ObstacleMaxMomentumWeatherMultiplier - Multiplier) < 0.02) { Multiplier = World.Hook.ObstacleMaxMomentumWeatherMultiplier; } else { Multiplier = Multiplier * 0.97f + World.Hook.ObstacleMaxMomentumWeatherMultiplier * 0.03f; } Momentum = IdealMomentum * Multiplier; }
public override void Think() { base.Think(); if (World.DistanceOutOfBounds(Position) > 0) { var speed = Momentum.Length(); if (Position != Vector2.Zero) { Momentum = Vector2.Normalize(Vector2.Zero - Position) * speed; } } }