private void EnterState(PLAYER_STATE state) { switch (state) { case PLAYER_STATE.PCS_NORMAL: currentSpeed = normalSpeed; sprite = GraphicsManager.Instance.charFine; dimensions = normalSize; break; case PLAYER_STATE.PCS_WET: currentSpeed = wetMovementSpeed; sprite = GraphicsManager.Instance.charNotFine; dimensions = wetSize; dampnessTimer = EventManager.Instance.AddTimer(3.0f, new TimedEvent(EventStopDamp)); break; case PLAYER_STATE.PCS_POWEREDUP: currentSpeed = normalSpeed; sprite = GraphicsManager.Instance.charArmoured; dimensions = normalSize; break; } }
public void Initialise(Viewport viewSize, Game1 coreGameClass) { viewport = viewSize; worldBounds = viewport.Bounds; worldBounds.Location -= new Point(100, 100); worldBounds.Size += new Point(200, 200); upperGameClass = coreGameClass; randNumGen = new Random(); allObjects = new List <PhysicalObject>(); timeElapsed = 0; thePlayer = new PlayerCharacter(new Vector2(388, 10)); allObjects.Add(thePlayer); scrollingBackground = new Background(60, viewport); EventManager.Instance.Reset(); //Initial cloud, missile, and plane events EventManager.Instance.AddTimer(3, new TimedEvent(EventSpawnCloud)); EventManager.Instance.AddTimer(5, new TimedEvent(EventSpawnMissile)); EventManager.Instance.AddTimer(8, new TimedEvent(EventSpawnPlane)); //Midpoint event EventManager.Instance.AddTimer(30, new TimedEvent(EventMidwayPoint)); //Endgame events EventManager.Instance.AddTimer(56, new TimedEvent(EventSpawnCastle)); gameEndTimer = EventManager.Instance.AddTimer(60, new TimedEvent(EventGameCompleted)); }
public EventTimer AddTimer(float duration, TimedEvent callbackFunction) { EventTimer newTimer = new EventTimer(duration, callbackFunction); currentTimers.Add(newTimer); return(newTimer); }
public void EventStopDamp() { if (playerState == PLAYER_STATE.PCS_WET) { SetState(PLAYER_STATE.PCS_NORMAL); } dampnessTimer = null; }
public void RemoveTimer(EventTimer timerToRemove) { currentTimers.Remove(timerToRemove); }