public ShieldGeneratorComponent GetActiveShieldAffectingBoardPos(int targetBoardX, int targetBoardZ) { ShieldGeneratorComponent result = null; float num = 3.40282347E+38f; NodeList <ShieldGeneratorNode> shieldGeneratorNodeList = Service.BuildingLookupController.ShieldGeneratorNodeList; for (ShieldGeneratorNode shieldGeneratorNode = shieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { Entity entity = shieldGeneratorNode.Entity; if (entity != null && entity.Has <HealthComponent>() && !entity.Get <HealthComponent>().IsDead()) { ShieldGeneratorComponent shieldGenComp = shieldGeneratorNode.ShieldGenComp; if (shieldGenComp != null) { Entity shieldBorderEntity = shieldGenComp.ShieldBorderEntity; if (shieldBorderEntity != null && shieldBorderEntity.Has <HealthComponent>() && !shieldBorderEntity.Get <HealthComponent>().IsDead()) { float num2; if (this.IsPositionUnderShield(targetBoardX, targetBoardZ, (SmartEntity)entity, out num2) && num2 < num) { num = num2; result = shieldGenComp; } } } } } return(result); }
public void StopAllEffects() { NodeList <ShieldGeneratorNode> shieldGeneratorNodeList = Service.BuildingLookupController.ShieldGeneratorNodeList; for (ShieldGeneratorNode shieldGeneratorNode = shieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { this.effects.StopEffect(shieldGeneratorNode.Entity); } }
public void PlayAllEffects(bool idle) { float num = (!idle) ? 0.5f : 0f; float num2 = (!idle) ? 0.65f : 0f; int num3 = 0; NodeList <ShieldGeneratorNode> shieldGeneratorNodeList = Service.BuildingLookupController.ShieldGeneratorNodeList; for (ShieldGeneratorNode shieldGeneratorNode = shieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { if (!Service.BaseLayoutToolController.IsBuildingStashed((SmartEntity)shieldGeneratorNode.Entity)) { float delay = num + (float)num3 * num2; this.PlayEffect(shieldGeneratorNode.Entity, idle, delay); num3++; } } }
public bool IsTargetCellUnderShield(Vector3 targetPos) { Vector3 rayPos = new Vector3(targetPos.x, 100f, targetPos.z); NodeList <ShieldGeneratorNode> shieldGeneratorNodeList = Service.BuildingLookupController.ShieldGeneratorNodeList; Vector3 zero = Vector3.zero; for (ShieldGeneratorNode shieldGeneratorNode = shieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { SmartEntity smartEntity = (SmartEntity)shieldGeneratorNode.Entity; if (smartEntity.HealthComp != null && !smartEntity.HealthComp.IsDead()) { if (this.GetRayShieldIntersection(rayPos, targetPos, smartEntity.ShieldGeneratorComp, out zero)) { return(true); } } } return(false); }
private void SetShieldBorderEntities(ShieldGeneratorNode node) { FlagStamp flagStamp = node.BoardItem.BoardItem.FlagStamp; Board board = Service.BoardController.Board; for (int i = 0; i < flagStamp.Width; i++) { for (int j = 0; j < flagStamp.Depth; j++) { if ((flagStamp.FlagsMatrix[i, j] & 8u) == 8u) { BoardCell cellAt = board.GetCellAt(i + flagStamp.X, j + flagStamp.Z, false); if (cellAt != null) { cellAt.AddObstacle(node.ShieldGenComp.ShieldBorderEntity); } } } } }
public void PrepareShieldsForBattle() { Board board = Service.BoardController.Board; for (int i = 0; i < board.BoardSize; i++) { for (int j = 0; j < board.BoardSize; j++) { board.GetCellAt(i, j, true).ClearObstacles(); } } NodeList <ShieldGeneratorNode> shieldGeneratorNodeList = Service.BuildingLookupController.ShieldGeneratorNodeList; for (ShieldGeneratorNode shieldGeneratorNode = shieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { shieldGeneratorNode.ShieldGenComp.CurrentRadius = this.PointsToRange[shieldGeneratorNode.ShieldGenComp.PointsRange]; this.SetShieldBorderEntities(shieldGeneratorNode); this.effects.UpdateShieldScale(shieldGeneratorNode.ShieldGenComp.Entity); } this.effects.PlayAllEffects(false); }
public void InitializeEffects(Entity entity) { if (entity != null) { this.effects.CreateEffect(entity); } else { NodeList <ShieldGeneratorNode> shieldGeneratorNodeList = Service.BuildingLookupController.ShieldGeneratorNodeList; for (ShieldGeneratorNode shieldGeneratorNode = shieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { this.effects.CreateEffect(shieldGeneratorNode.Entity); } } Entity selectedBuilding = Service.BuildingController.SelectedBuilding; if (selectedBuilding != null && selectedBuilding.Has <ShieldGeneratorComponent>()) { this.effects.PlayAllEffects(true); } }
private void FillBuildingListByType(List <SmartEntity> list, BuildingType type) { switch (type) { case BuildingType.Any: { NodeList <BuildingNode> nodeList = this.entityController.GetNodeList <BuildingNode>(); for (BuildingNode buildingNode = nodeList.Head; buildingNode != null; buildingNode = buildingNode.Next) { list.Add((SmartEntity)buildingNode.Entity); } return; } case BuildingType.HQ: for (HQNode hQNode = this.HQNodeList.Head; hQNode != null; hQNode = hQNode.Next) { list.Add((SmartEntity)hQNode.Entity); } return; case BuildingType.Barracks: for (BarracksNode barracksNode = this.BarracksNodeList.Head; barracksNode != null; barracksNode = barracksNode.Next) { list.Add((SmartEntity)barracksNode.Entity); } return; case BuildingType.Factory: for (FactoryNode factoryNode = this.FactoryNodeList.Head; factoryNode != null; factoryNode = factoryNode.Next) { list.Add((SmartEntity)factoryNode.Entity); } return; case BuildingType.FleetCommand: for (FleetCommandNode fleetCommandNode = this.FleetCommandNodeList.Head; fleetCommandNode != null; fleetCommandNode = fleetCommandNode.Next) { list.Add((SmartEntity)fleetCommandNode.Entity); } return; case BuildingType.HeroMobilizer: for (TacticalCommandNode tacticalCommandNode = this.TacticalCommandNodeList.Head; tacticalCommandNode != null; tacticalCommandNode = tacticalCommandNode.Next) { list.Add((SmartEntity)tacticalCommandNode.Entity); } return; case BuildingType.ChampionPlatform: for (ChampionPlatformNode championPlatformNode = this.ChampionPlatformNodeList.Head; championPlatformNode != null; championPlatformNode = championPlatformNode.Next) { list.Add((SmartEntity)championPlatformNode.Entity); } return; case BuildingType.Housing: for (HousingNode housingNode = this.HousingNodeList.Head; housingNode != null; housingNode = housingNode.Next) { list.Add((SmartEntity)housingNode.Entity); } return; case BuildingType.Squad: for (SquadBuildingNode squadBuildingNode = this.SquadBuildingNodeList.Head; squadBuildingNode != null; squadBuildingNode = squadBuildingNode.Next) { list.Add((SmartEntity)squadBuildingNode.Entity); } return; case BuildingType.Starport: for (StarportNode starportNode = this.StarportNodeList.Head; starportNode != null; starportNode = starportNode.Next) { list.Add((SmartEntity)starportNode.Entity); } return; case BuildingType.DroidHut: for (DroidHutNode droidHutNode = this.DroidHutNodeList.Head; droidHutNode != null; droidHutNode = droidHutNode.Next) { list.Add((SmartEntity)droidHutNode.Entity); } return; case BuildingType.Wall: for (WallNode wallNode = this.WallNodeList.Head; wallNode != null; wallNode = wallNode.Next) { list.Add((SmartEntity)wallNode.Entity); } return; case BuildingType.Turret: for (TurretBuildingNode turretBuildingNode = this.TurretBuildingNodeList.Head; turretBuildingNode != null; turretBuildingNode = turretBuildingNode.Next) { list.Add((SmartEntity)turretBuildingNode.Entity); } return; case BuildingType.TroopResearch: for (OffenseLabNode offenseLabNode = this.OffenseLabNodeList.Head; offenseLabNode != null; offenseLabNode = offenseLabNode.Next) { list.Add((SmartEntity)offenseLabNode.Entity); } return; case BuildingType.DefenseResearch: for (DefenseLabNode defenseLabNode = this.DefenseLabNodeList.Head; defenseLabNode != null; defenseLabNode = defenseLabNode.Next) { list.Add((SmartEntity)defenseLabNode.Entity); } return; case BuildingType.Resource: for (GeneratorNode generatorNode = this.GeneratorNodeList.Head; generatorNode != null; generatorNode = generatorNode.Next) { list.Add((SmartEntity)generatorNode.Entity); } return; case BuildingType.Storage: for (StorageNode storageNode = this.StorageNodeList.Head; storageNode != null; storageNode = storageNode.Next) { list.Add((SmartEntity)storageNode.Entity); } return; case BuildingType.ShieldGenerator: for (ShieldGeneratorNode shieldGeneratorNode = this.ShieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { list.Add((SmartEntity)shieldGeneratorNode.Entity); } return; case BuildingType.Clearable: for (ClearableNode clearableNode = this.ClearableNodeList.Head; clearableNode != null; clearableNode = clearableNode.Next) { list.Add((SmartEntity)clearableNode.Entity); } return; case BuildingType.Trap: for (TrapNode trapNode = this.TrapNodeList.Head; trapNode != null; trapNode = trapNode.Next) { list.Add((SmartEntity)trapNode.Entity); } return; case BuildingType.Cantina: for (CantinaNode cantinaNode = this.CantinaNodeList.Head; cantinaNode != null; cantinaNode = cantinaNode.Next) { list.Add((SmartEntity)cantinaNode.Entity); } return; case BuildingType.NavigationCenter: for (NavigationCenterNode navigationCenterNode = this.NavigationCenterNodeList.Head; navigationCenterNode != null; navigationCenterNode = navigationCenterNode.Next) { list.Add((SmartEntity)navigationCenterNode.Entity); } return; case BuildingType.ScoutTower: for (ScoutTowerNode scoutTowerNode = this.ScoutTowerNodeList.Head; scoutTowerNode != null; scoutTowerNode = scoutTowerNode.Next) { list.Add((SmartEntity)scoutTowerNode.Entity); } return; case BuildingType.Armory: for (ArmoryNode armoryNode = this.ArmoryNodeList.Head; armoryNode != null; armoryNode = armoryNode.Next) { list.Add((SmartEntity)armoryNode.Entity); } return; } Service.Logger.Warn("Unknown building type " + type); }