public override bool UseableAt(IntVector2 target) { Mobile m = GetComponentInParent <Mobile>(); if (target == m.Location) { return(false); } if (range == 1) { if ((m.Location - target).MagnitudeMax == 1) { // in melee range GameObject o = GameObjectAt(target); return(o && o.GetComponent <HitPoints>()); } return(false); } if ((m.Location - target).MagnitudePF <= range) { if (Obstructions.HasLOS(IntVector2.RoundFrom(transform.position), target)) { GameObject o = GameObjectAt(target); return(o && o.GetComponent <HitPoints>()); } } return(false); }
//Inform robot about obstruction on X,Y public void Avoid(int x, int y) { if (IsWithinTable(x) && IsWithinTable(y)) { Obstructions.Add(new Obstruction { X = x, Y = y }); } }
internal void CleanUp() { RegisterMyGridEvents(false); foreach (var grid in SubGrids) { if (grid == MyGrid) { continue; } RemSubGrids.Add(grid); } AddSubGrids.Clear(); SubGridChanges(); SubGrids.Clear(); Obstructions.Clear(); TargetAis.Clear(); EntitiesInRange.Clear(); Batteries.Clear(); Targets.Clear(); SortedTargets.Clear(); BlockGroups.Clear(); Weapons.Clear(); WeaponsIdx.Clear(); WeaponBase.Clear(); AmmoInventories.Clear(); Inventories.Clear(); LiveProjectile.Clear(); DeadProjectiles.Clear(); ControllingPlayers.Clear(); SourceCount = 0; BlockCount = 0; MyOwner = 0; PointDefense = false; FadeOut = false; SupressMouseShoot = false; OverPowered = false; UpdatePowerSources = false; AvailablePowerChanged = false; PowerIncrease = false; RequestedPowerChanged = false; RequestIncrease = false; DbReady = false; Focus.Clean(); MyShieldTmp = null; MyShield = null; MyPlanetTmp = null; MyPlanet = null; TerminalSystem = null; LastWeaponTerminal = null; LastTerminal = null; PowerDistributor = null; }
public ConfigurationMenu(string nameArg, Camera cameraArg, GameObject modelCubeArg) { _name = nameArg; _map = new MapMenu(new Vector3Int(40, 30, 4)); _modelCube = modelCubeArg; _obstructions = new Obstructions(); _cmdObstructionIsExists = new CommandObstructionIsExists(_obstructions); _cmdObstructionAdd = new CommandObstructionAdd(_obstructions); _cmdObstructionReplace = new CommandObstructionReplace(_obstructions); _cmdObstructionDelete = new CommandObstructionDelete(_obstructions); _mover = new Mover(_map.Size, _cmdObstructionIsExists, _cmdObstructionReplace); }
public ConfigurationMode1(string nameArg, Camera cameraArg, GameObject modelCubeArg) { _name = nameArg; _map = new MapGame(new Vector3Int(10, 20, 1)); _modelCube = modelCubeArg; _obstructions = new Obstructions(); _cmdObstructionIsExists = new CommandObstructionIsExists(_obstructions); _cmdObstructionAdd = new CommandObstructionAdd(_obstructions); _cmdObstructionReplace = new CommandObstructionReplace(_obstructions); _cmdObstructionDelete = new CommandObstructionDelete(_obstructions); _mover = new Mover(_map.Size, _cmdObstructionIsExists, _cmdObstructionReplace); _rotator = new Rotator(_mover, _map.Size); }
public override IntVector2[] TargetableTiles() { if (range == 1) { transform.localPosition = Vector3.zero; IntVector2 orig = IntVector2.RoundFrom(transform.position); IntVector2[] r = { orig + IntVector2.left, orig + IntVector2.up, orig + IntVector2.right, orig + IntVector2.down, orig + IntVector2.upleft, orig + IntVector2.upright, orig + IntVector2.downleft, orig + IntVector2.downright, }; return(r); } transform.localPosition = Vector3.zero; IntVector2 tile = IntVector2.RoundFrom(transform.position); List <IntVector2> l = new List <IntVector2>(); foreach (IntVector2 iv2 in IntVector2Utility.GetRect(tile - new IntVector2(range, range), tile + new IntVector2(range, range))) { if (tile == iv2) { continue; } if ((tile - iv2).MagnitudePF <= range) { if (Obstructions.HasLOS(tile, iv2)) { l.Add(iv2); } } } return(l.ToArray()); }
/// <summary> Класс описывает логику игры на SceneGame (Компонент Model). </summary> /// <see> Для получения информации по сущностям перейдите в Scripts/Global/GameConfigurators/AbstractConfigurator.cs </see> public TetrisGame() { AbstractConfigurator configurator = DataConfigs.LoadConfigurator(); if (configurator == null) { throw new TetrisException("Не выбран режим игры!"); } _map = configurator.CreateMap(); _generator = configurator.CreateGenerator(); _factory = configurator.CreateFactoryFigure(); _mover = configurator.CreateMover(); _rotator = configurator.CreateRotator(); _vectorDrop = configurator.CreateVectorDropInt(); _delayDrop = configurator.DelayFrameDrop(); _obstructions = configurator.CreateObstructions(); _stackFigures = configurator.CreateStackFigures(); _figure = _generator.NewFigure(_factory); }
public CommandObstructionIsExists(Obstructions obstructionsArg) { _obstructions = obstructionsArg; }
internal void CleanUp() { AiCloseTick = Session.Tick; MyGrid.Components.Remove <AiComponent>(); for (int i = 0; i < MIds.Length; i++) { MIds[i] = 0; } if (Session.IsClient) { Session.SendUpdateRequest(MyGrid.EntityId, PacketType.ClientAiRemove); } Data.Repo.ControllingPlayers.Clear(); Data.Repo.ActiveTerminal = 0; CleanSortedTargets(); Construct.Clean(); Obstructions.Clear(); ObstructionsTmp.Clear(); TargetAis.Clear(); TargetAisTmp.Clear(); EntitiesInRange.Clear(); Batteries.Clear(); Targets.Clear(); Weapons.Clear(); WeaponsIdx.Clear(); WeaponBase.Clear(); LiveProjectile.Clear(); DeadProjectiles.Clear(); NearByShieldsTmp.Clear(); NearByFriendlyShields.Clear(); StaticsInRange.Clear(); StaticsInRangeTmp.Clear(); TestShields.Clear(); NewEntities.Clear(); SubGridsRegistered.Clear(); SourceCount = 0; BlockCount = 0; AiOwner = 0; ProjectileTicker = 0; NearByEntities = 0; NearByEntitiesTmp = 0; MyProjectiles = 0; AccelChecked = false; PointDefense = false; FadeOut = false; SuppressMouseShoot = false; OverPowered = false; UpdatePowerSources = false; AvailablePowerChanged = false; PowerIncrease = false; RequestedPowerChanged = false; RequestIncrease = false; DbReady = false; GridInit = false; TouchingWater = false; Data.Clean(); MyShield = null; MyPlanetTmp = null; MyPlanet = null; TerminalSystem = null; LastTerminal = null; PowerDistributor = null; PowerBlock = null; MyGrid = null; PowerDistributor = null; Session = null; Closed = true; CanShoot = true; Version++; }
public CommandObstructionReplace(Obstructions obstructionsArg) { _obstructions = obstructionsArg; }
public CommandObstructionAdd(Obstructions obstructionsArg) { _obstructions = obstructionsArg; }
public CommandObstructionDelete(Obstructions obstructionsArg) { _obstructions = obstructionsArg; }