public void UpdatePosition(int actorId, GameUtility.Coordinate position) { try { actors [actorId].Position = position; } catch (KeyNotFoundException e) { } }
/// ---------------------------------------------- /// CONSTRUCTOR: Actor /// /// DATE: March 11th, 2019 /// /// REVISIONS: /// /// DESIGNER: Cameron Roberts /// /// PROGRAMMER: Cameron Roberts /// /// INTERFACE: public Actor (int actorId, int team, GameUtility.Coordinate spawnLocation) /// /// NOTES: /// ---------------------------------------------- public Actor(int actorId, int team, GameUtility.Coordinate spawnLocation) { ActorId = actorId; Team = team; SpawnLocation = spawnLocation; Position = SpawnLocation; TargetPosition = SpawnLocation; }
// Player constructor public Player(int actorId, int team, GameUtility.Coordinate spawnLocation) : base(actorId, team, spawnLocation) { Health = 1000; Abilities = new AbilityType[5]; Abilities[0] = AbilityType.AutoAttack; Cooldowns = new int[Abilities.Length]; Experience = 0; Level = 1; Attack = 1; Defense = 1; }
// Tower constructor public Tower(int actorId, int team, GameUtility.Coordinate spawnLocation) : base(actorId, team, spawnLocation) { Health = 1000; Attack = 1; Defense = 1.5f; RespawnAllowed = false; Abilities = new AbilityType[1]; Abilities[0] = AbilityType.TowerAttack; Cooldowns = new int[1]; Cooldowns[0] = AbilityInfo.InfoArray[(int)AbilityType.TowerAttack].Cooldown; Stationary = true; }
public int AddTower(GameUtility.Coordinate spawnLoc) { int actorId = CreatedActorsCount++; int team = 0; Tower newTower = new Tower(actorId, team, spawnLoc); if (!actors.TryAdd(actorId, newTower)) { //TODO Handle failure } Log.V("Adding tower actor with id " + actorId); OutgoingReliableElements.Enqueue(new SpawnElement(ActorType.TowerA, actorId, team, newTower.SpawnLocation.x, newTower.SpawnLocation.z)); return(actorId); }
/// ------------------------------------------------------------------------------------------- /// Class: Creep - A class to create creep objects. /// /// PROGRAM: Server /// /// CONSTRUCTORS: public Creep(int actorId, int team, GameUtility.Coordinate spawnLocation) /// /// FUNCTIONS: None /// /// DATE: April 8, 2019 /// /// REVISIONS: /// /// DESIGNER: Wayne Huang /// /// PROGRAMMER: Wayne Huang /// /// NOTES: Extends from the Actor class. /// ------------------------------------------------------------------------------------------- public Creep(int actorId, int team, GameUtility.Coordinate spawnLocation) : base(actorId, team, spawnLocation) { Health = 25; Attack = 1; Defense = 1; }