private void Retract() { movementTimer = new Timer(RETRACT_DURATION, EndRetract, false); stateTimer = new Timer(RETRACTED_DURATION, PartiallyExtend, false); extensionState = ExtensionStates.RETRACT; Active = false; }
public RetractableSpikes(Platform platform) : base(HazardTypes.RETRACTABLE_SPIKES) { BoundingBox2D platformBox = platform.BoundingBox; numSpikes = (int)platformBox.Width / textureWidth; platformTop = (int)platformBox.Top; partialExtensionTarget = platformTop - PARTIAL_EXTENSION_LENGTH; fullExtensionTarget = platformTop - texture.Height; position = new Vector2(platformBox.Left, platformTop); BoundingBox = new BoundingBox2D(platformBox); stateTimer = new Timer(RETRACTED_DURATION, PartiallyExtend, false); extensionState = ExtensionStates.NONE; }
public StatusChangedEventArgs(ExtensionInfo ext, ExtensionStates status) { ExtensionValue = ext; StatusValue = status; }
private void EndRetract() { position.Y = platformTop; extensionState = ExtensionStates.NONE; }
private void EndFullExtension() { position.Y = fullExtensionTarget; extensionState = ExtensionStates.NONE; Active = true; }
private void EndPartialExtension() { position.Y = partialExtensionTarget; extensionState = ExtensionStates.NONE; }
private void FullyExtend() { movementTimer = new Timer(FULL_EXTENSION_DURATION, EndFullExtension, false); stateTimer = new Timer(EXTENDED_DURATION, Retract, false); extensionState = ExtensionStates.FULL; }
private void PartiallyExtend() { movementTimer = new Timer(PARTIAL_EXTENSION_DURATION, EndPartialExtension, false); stateTimer = new Timer(PARTIALLY_EXTENDED_DURATION, FullyExtend, false); extensionState = ExtensionStates.PARTIAL; }