public static void CacheLivingEntity(LivingGameEntity lent) { if (!LivingGameEntity.cachedEntities.Contains(lent)) { LivingGameEntity.cachedEntities.Add(lent); } }
private void SpawnEntity() { LivingGameEntity newEnt; // Cloning isn't working right, so we don't want to do this. if (GameEntity.Cached(spawnBatches[currentBatch].GameEntityName) && 1 == 2) { newEnt = LivingGameEntity.CloneByName(spawnBatches[currentBatch].GameEntityName); } else { newEnt = new LivingGameEntity(spawnBatches[currentBatch].GameEntityName); } newEnt.Faction = this.DefaultFaction; newEnt.SetPosition(this.GetPosition().x, this.GetPosition().y); newEnt.SetParentStage(this.GetParentStage()); this.GetParentStage().AddGameEntity(newEnt); if (spawnBatches[currentBatch].templateAI != null) { newEnt.SetAI(spawnBatches[currentBatch].templateAI.Clone()); } if (this.EntitySpawned != null) { try { this.EntitySpawned.Invoke(this, newEnt); } catch (Exception ex) { } } }
public void createShadowCreature(int x, int y) { LivingGameEntity shadowCreature = new LivingGameEntity("ShadowCreature"); shadowCreature.AddCustomStyling("shadowCreature"); shadowCreature.SetParentStage(Stage.CurrentStage); Stage.CurrentStage.AddLivingGameEntity(shadowCreature); shadowCreature.SetPosition(x, y); ArtificialIntelligence creatureAI = new ArtificialIntelligence(); creatureAI.SetMovementThoughtPattern(customCreatureThoughtPattern); shadowCreature.SetAI(creatureAI); }
public static void SetPlayerCharacter(LivingGameEntity newCharacter) { playerCharacter = newCharacter; }
public void SetOwner(LivingGameEntity newOwner) { this.owner = newOwner; }
//test function to make a new tower... public void placeATower(GuiEvent gEvent) { //hide the collision map gui layer Stage.CurrentStage.HideCollisionMap(); // Make sure we can place a tower there. if (checkTowerPlacement(gEvent) == false) { // Make a noise. return; } // Need to add a check for financial ability as well ... // But maybe on the tower menu instead. Tile clickedTile = gEvent.clickedTiles[0]; // Decrement the player's currency changePlayerCurrency(-33); towerToPlace = LivingGameEntity.CloneByName(desiredTowerName); towerToPlace.SetParentStage(Stage.CurrentStage); towerToPlace.SetPosition(clickedTile.GetPosition().x, clickedTile.GetPosition().y); towerToPlace.Faction = playerFaction; Stage.CurrentStage.AddLivingGameEntity(towerToPlace); //deselect the selected tower in the gui menu GuiLayer towerLayer = GuiLayer.GetLayerByName("TowerMenu"); //towerLayer.SelectItem("By putting this text here, everything will be deselected, but nothing will be selected.", -1); // Destroy the notification. placeTower.Destroy(); // After the tower is placed, re-calculate pathing for the stage. // If there is only one path enemies can take, mark the crucial point(s) as walkable but unbuildable. }
public void prepTowers() { LivingGameEntity NyanTower = new LivingGameEntity("NyanTower"); LivingGameEntity XTheYTower = new LivingGameEntity("XTheYTower"); LivingGameEntity TableFlipperTower = new LivingGameEntity("TableFlipperTower"); LivingGameEntity BarrelRollTower = new LivingGameEntity("BarrelRollTower"); LivingGameEntity ArrowKneeTower = new LivingGameEntity("GuardTower"); LivingGameEntity PepperCopTower = new LivingGameEntity("PepperCopTower"); //NyanTower.SetResource("Currency", 15); //PepperCopTower.SetResource("Currency", 35); //XTheYTower.SetResource("Currency", 40); //TableFlipperTower.SetResource("Currency", 20); //this will automatically draw the sprite for the projectile from the (hopefully) pre-established table sprite Projectile TableProjectile = new Projectile("Table"); TableProjectile.SetDamage(30); Weapon TableFlipperWeapon = new Weapon(10, 1, .5, 180, 40); TableFlipperWeapon.SetProjectile(TableProjectile); TableFlipperWeapon.SetRange(5); TableFlipperTower.AddWeapon(TableFlipperWeapon); Weapon dummyWeapon = new Weapon(10, 1, .5, 180, 40); dummyWeapon.SetRange(5); NyanTower.AddWeapon(dummyWeapon); Projectile barrel = new Projectile("Barrel"); barrel.SetDamage(70); Weapon BarrelThrower = new Weapon(10, 1, .5, 180, 40); BarrelThrower.SetRange(5); BarrelThrower.SetProjectile(barrel); BarrelRollTower.AddWeapon(BarrelThrower); Projectile arrow = new Projectile("Arrow"); arrow.SetDamage(70); Weapon Bow = new Weapon(10, 1, .5, 180, 40); Bow.SetRange(15); Bow.SetProjectile(arrow); ArrowKneeTower.AddWeapon(Bow); }
/// <summary> /// Set the entity that this AI is attached to (the "body" to this "mind") /// </summary> /// <param name="newBody">The Entity to attach.</param> public void SetBody(LivingGameEntity newBody) { this.body = newBody; }