Time for action – building a computer terminal
Add a new class called ComputerTerminal to the Robot Rampage project.
Add the following
using
directives to the top of the class file:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics;
Add declarations to the ComputerTerminal class:
#region Declarations private Sprite activeSprite; private Sprite inactiveSprite; public Vector2 MapLocation; public bool Active = true; public float LastSpawnCounter = 0; public float minSpawnTime = 6.0f; #endregion
Add a constructor to the ComputerTerminal class:
#region Constructor public ComputerTerminal( Sprite activeSprite, Sprite inactiveSprite, Vector2 mapLocation) { MapLocation = mapLocation; this.activeSprite = activeSprite; this.inactiveSprite = inactiveSprite; } #endregion
Add public methods to the ComputerTerminal class:
#region Public Methods public bool IsCircleColliding(Vector2 otherCenter, float radius) { if (!Active) { return false; } ...