protected virtual void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.FileName: FileName = subBlock.ReadString(); break; case TokenID.Position: //Position = new STFPositionItem(subBlock); ReadLocation(subBlock, holder); break; case TokenID.QDirection: //QDirection = new STFQDirectionItem(subBlock); ReadDirection(subBlock, holder); break; case TokenID.Matrix3x3: //Matrix3x3 = ReadMatrix3x3(subBlock); ReadPosition(subBlock, holder); break; case TokenID.VDbId: ViewDbId = subBlock.ReadUInt(); break; case TokenID.StaticFlags: StaticFlags = subBlock.ReadFlags(); break; default: subBlock.Skip(); break; } }
private void ReadDirection(SBR block, PositionHolder holder) { block.VerifyID(TokenID.QDirection); holder.Direction = new Quaternion(block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat()); holder.DirectionSet = true; block.VerifyEndOfBlock(); }
protected void ReadBlock(SBR block, int tileX, int tileZ) { PositionHolder holder = new PositionHolder() { TileX = tileX, TileZ = tileZ, }; while (!block.EndOfBlock()) { using (var subBlock = block.ReadSubBlock()) { if (subBlock.ID == TokenID.UiD) { UiD = subBlock.ReadUInt(); } else { AddOrModifyObj(subBlock, holder); } } } worldPosition = PositionHolder.WorldPositionFromMSTSLocation(holder, UiD); if (this is HazardObject hazard) //remember the Quaternation component { hazard.Direction = holder.Direction; } }
private void ReadLocation(SBR block, PositionHolder holder) { block.VerifyID(TokenID.Position); holder.Location = new Vector3(block.ReadFloat(), block.ReadFloat(), block.ReadFloat()); holder.LocationSet = true; block.VerifyEndOfBlock(); }
public EnemyMovement(EnemySettings _enemySettings, PositionHolder _targetPosition, Transform _transform, NavMeshAgent _agent) { enemySettings = _enemySettings; targetPosition = _targetPosition; transform = _transform; agent = _agent; }
/// <summary> /// MSTS WFiles represent some location with a position, 3x3 matrix and tile coordinates /// This converts it to the ORTS WorldPosition representation /// </summary> internal static WorldPosition WorldPositionFromMSTSLocation(PositionHolder holder, uint uid) { if (holder.LocationSet && holder.PositionSet) { holder.Location.Z *= -1;; Matrix xnaMatrix = new Matrix( holder.Position.M00, holder.Position.M01, -holder.Position.M02, 0, holder.Position.M10, holder.Position.M11, -holder.Position.M12, 0, -holder.Position.M20, -holder.Position.M21, holder.Position.M22, 0, 0, 0, 0, 1); return(new WorldPosition(holder.TileX, holder.TileZ, MatrixExtension.Multiply(xnaMatrix, Matrix.CreateTranslation(holder.Location)))); } else if (holder.LocationSet && holder.DirectionSet) { holder.Direction.Z *= -1; holder.Location.Z *= -1;; return(new WorldPosition(holder.TileX, holder.TileZ, MatrixExtension.Multiply(Matrix.CreateFromQuaternion(holder.Direction), Matrix.CreateTranslation(holder.Location)))); } else { Trace.TraceWarning($"Scenery object UiD {uid} is missing Matrix3x3 and QDirection"); return(WorldPosition.None); } }
private void ReadPosition(SBR block, PositionHolder holder) { block.VerifyID(TokenID.Matrix3x3); holder.Position = new Matrix3x3(block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat()); holder.PositionSet = true; block.VerifyEndOfBlock(); }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.PlatformData: PlatformData = subBlock.ReadFlags(); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.TrItemId: TrackItemIds.Add(subBlock); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
public PlayerMovement(IInputReader _inputReader, Transform _transform, PlayerSettings _playerSettings, PositionHolder _positionHolder) { inputReader = _inputReader; playerSettings = _playerSettings; positionHolder = _positionHolder; transform = _transform; rb = transform.GetComponent <Rigidbody>(); }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.Width: Width = subBlock.ReadFloat(); break; case TokenID.Height: Height = subBlock.ReadFloat(); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.SignalSubObj: SignalSubObject = subBlock.ReadFlags(); break; case TokenID.SignalUnits: SignalUnits = new SignalUnits(subBlock); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.Speed_Digit_Tex: TextureFile = subBlock.ReadString(); break; case TokenID.Speed_Sign_Shape: ReadSpeedSignShape(subBlock); break; case TokenID.Speed_Text_Size: TextSize = new TextData(subBlock); break; case TokenID.TrItemId: TrackItemIds.Add(subBlock); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
internal void AddOrModifyObj(SBR subBlock) { PositionHolder holder = new PositionHolder() { TileX = worldPosition.TileX, TileZ = worldPosition.TileZ, }; AddOrModifyObj(subBlock, holder); if (holder.LocationSet && (holder.PositionSet || holder.DirectionSet)) { worldPosition = PositionHolder.WorldPositionFromMSTSLocation(holder, UiD); } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.SectionIdx: SectionIndex = subBlock.ReadUInt(); break; case TokenID.Elevation: Elevation = subBlock.ReadFloat(); break; case TokenID.CollideFlags: CollideFlags = subBlock.ReadUInt(); break; case TokenID.TrackSections: TrackSections = ReadTrackSections(subBlock); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.CarFrequency: CarFrequency = subBlock.ReadFloat(); break; case TokenID.CarAvSpeed: CarAverageSpeed = subBlock.ReadFloat(); break; case TokenID.OrtsListName: ListName = subBlock.ReadString(); break; case TokenID.TrItemId: TrackItemIds.Add(subBlock); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.TreeTexture: TreeTexture = subBlock.ReadString(); break; case TokenID.ScaleRange: ScaleRange = new Range(subBlock, subBlock.ID); break; case TokenID.Area: ForestArea = new Size2D(subBlock, subBlock.ID); break; case TokenID.Population: Population = subBlock.ReadInt(); break; case TokenID.TreeSize: TreeSize = new Size2D(subBlock, subBlock.ID); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.LevelCrParameters: ReadCrossingParameters(subBlock); break; case TokenID.CrashProbability: CrashProbability = subBlock.ReadInt(); break; case TokenID.LevelCrData: ReadCrossingData(subBlock); break; case TokenID.LevelCrTiming: ReadCrossingTiming(subBlock); break; case TokenID.TrItemId: TrackItemIds.Add(subBlock); break; case TokenID.OrtsSoundFileName: SoundFileName = subBlock.ReadString(); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
private void OnTriggerEnter(Collider other) { if (state == STATE.Wait && other.gameObject.layer.Equals(LayerMask.NameToLayer("Light"))) { PositionHolder holder = other.gameObject.GetComponent <PositionHolder>(); if (holder != null) { state = STATE.Follow; target = holder.position; } else { print("no holder"); } } else if ((state == STATE.Follow || state == STATE.Trail) && other.gameObject.tag == "Home") { state = STATE.ReturnHome; } }
protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder) { switch (subBlock.ID) { case TokenID.SpeedRange: SpeedRange = new Range(subBlock, subBlock.ID); break; case TokenID.PickupType: PickupType = (PickupType)subBlock.ReadUInt(); subBlock.Skip(); // Discard the 2nd value (0 or 1 but significance is not known) break; case TokenID.PickupAnimData: Options = new AnimationData(subBlock); break; case TokenID.PickupCapacity: Capacity = new CapacityData(subBlock); break; case TokenID.TrItemId: TrackItemIds.Add(subBlock); break; case TokenID.CollideFlags: CollideFlags = subBlock.ReadUInt(); break; default: base.AddOrModifyObj(subBlock, holder); break; } }
public CameraMovement(PositionHolder _targetPosition, PositionHolder _cameraOffset, Transform _cameraTransform) { targerPosition = _targetPosition; cameraOffset = _cameraOffset; cameraTransform = _cameraTransform; }
private void TrackView(PositionHolder positionHolder, PositionHolderView positionHolderView) { positionHolderViewMap.Add(positionHolder, positionHolderView); }
public void DeleteAllJewelsInList(HashSet <GameObject> deleteList, bool powerUpDelete) { removeList = new HashSet <GameObject> (); if (deleteList.Count >= 3) { soundHandler.PlayJewelBreak(); } assistanceTimeStamp = Time.time; timeStamp = Time.time; okayToMoveTimeStamp = Time.time; okayToMoveAgain = false; matchAssistant.SetResetRandoms(true); movementChecker.SetGridStaticToFalse(); GameObject tempJewel; if (deleteList.Count == 4) { soundHandler.PlayPowerUpSound(); fourInARowScript.ActivateFourInARowPower(deleteList); // scoreKeeper.IncreaseScoreByFourJewelBonus (); } foreach (GameObject a in deleteList) { if (a != null) { if (!powerUpDelete && a.tag != "Boulder") { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); if (jewelMovement.GetRow() + 1 < 9) { CheckForBoulders(jewelMovement.GetRow() + 1, jewelMovement.GetCol()); } if (jewelMovement.GetRow() - 1 >= 0) { CheckForBoulders(jewelMovement.GetRow() - 1, jewelMovement.GetCol()); } if (jewelMovement.GetCol() + 1 < 9) { CheckForBoulders(jewelMovement.GetRow(), jewelMovement.GetCol() + 1); } if (jewelMovement.GetCol() - 1 >= 0) { CheckForBoulders(jewelMovement.GetRow(), jewelMovement.GetCol() - 1); } } if (a.tag == "Boulder") { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); if (CheckForBoulders(jewelMovement.GetRow(), jewelMovement.GetCol())) { removeList.Add(a); } } } } foreach (GameObject a in removeList) { deleteList.Remove(a); } foreach (GameObject a in boulderDeleteList) { deleteList.Add(a); } foreach (GameObject a in deleteList) { if (a != null) { deleteListCopy = deleteList; if (a != null && a.tag == "Steel Block") { PowerStarTracker.RemoveFromHashSet(a); } if (a != null && a.tag != "Steel Block" && a.name != "Rock 3 Chain(Clone)" && a.name != "Rock 2 Chain(Clone)" && a.name != "Rock 1 Chain(Clone)") { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); // moveJewelsDown.MoveJewelsAboveDown(a); // if (GameObject.Find ("Time Bomb ID") != null) { // if (addJewels == null) // addJewels = GameObject.Find ("Time Bomb ID").GetComponent<AddTimeLevelOneJewels> (); // if (Bomb(a) && !bombHandler.TimeBombIsExploded ()) { // bombHandler.RemoveFromBombList (a); // addJewels.InstantiateSingleJewels (jewelMovement.GetCol (), true); // } else if (!bombHandler.TimeBombIsExploded ()) // addJewels.InstantiateSingleJewels (jewelMovement.GetCol (), false); // else if (bombHandler.TimeBombIsExploded ()) { // addJewels.InstantiateOnlyJewels (jewelMovement.GetCol ()); // } // } // else // instantiator.InstantiateSingleJewels (jewelMovement.GetRow (), jewelMovement.GetCol ()); if (Bomb(a) && GameObject.Find("Time Bomb ID") == null) { GameObject tempNumber = null; for (int i = 0; i < a.transform.childCount; i++) { if (a.transform.GetChild(i).tag == "Bomb Number") { tempNumber = a.transform.GetChild(i).gameObject; break; } } if (tempNumber != null) { tempNumber.transform.parent = null; tempNumber.GetComponent <BombNumberHandler> ().SetBombDestroyed(true); } if (bombHandler.GetBombListCount() == 1) { //Debug.Log ("Setting touch to fault"); touchHandler.SetGameStarted(false); } // bombInfo = a.GetComponent<LevelTwoBombInfo> (); // Instantiate (bombInfo.GetBombNumberSprite (), a.transform.position, Quaternion.identity); } else if (Bomb(a) && GameObject.Find("Time Bomb ID") != null) { GameObject tempBomb; // bombInfo = a.GetComponent<LevelTwoBombInfo> (); a.GetComponent <Rigidbody2D>().isKinematic = true; // bombInfo.SetBombDestroyed (true); } } } } boulderDeleteList.Clear(); foreach (GameObject a in deleteList) { if (a != null) { if (explosionsOn) { InstantiateExplosions(a); } if (a.tag != "Steel Block") { scoreKeeper.IncreaseScoreByOneJewel(); if (bombHandler.BombListContains(a)) { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); bombHandler.RemoveFromBombList(a); bombHandler.DecreaseBombCounterByOne(); // scoreKeeper.IncreaseScoreByOneBomb (); } if (/*(GameObject.Find ("Time Bomb ID") == null || (GameObject.Find ("Time Bomb ID") != null && !Bomb (a))) &&*/ a.name != "Rock 3 Chain(Clone)" && a.name != "Rock 2 Chain(Clone)" && a.name != "Rock 1 Chain(Clone)") { if (GameObject.Find("Time Bomb ID") != null && Bomb(a)) { bombDestroyed = true; } tempPositionHolder = new PositionHolder(a.GetComponent <RockLevelJewelMovement> ().GetRow(), a.GetComponent <RockLevelJewelMovement> ().GetCol()); deletedPositions.Add(tempPositionHolder); int row = a.GetComponent <RockLevelJewelMovement> ().GetRow(); int col = a.GetComponent <RockLevelJewelMovement> ().GetCol(); a.GetComponent <RockLevelJewelMovement> ().StartDestroyCountdown(); PowerStarTracker.RemoveFromHashSet(a); if (a.name == "Slug(Clone)") { SlugListManager.RemoveFromSlugList(a); } if (GameObject.Find("Jewel Collection Level ID") != null && !endOfLevelJewelSprayer.GetSprayingInProgress()) { InstantiateStaticJewel(a); } Destroy(a); instantiator.SetJewelGridGameObject(row, col, null); // moveJewelsDown.MoveJewelsAboveDown (tempPositionHolder.GetCol (), tempPositionHolder.GetRow ()); // instantiator.InstantiateSingleJewels (tempPositionHolder.GetRow (), tempPositionHolder.GetCol ()); } } } } // deleteCount++; // // if (deleteCount == 3) { // deleteCount = 0; // GameObject.Find ("Pump Up Word Holder").GetComponent<PumpUpWordHolder> ().InstantiateWow (); // } powerTrackerTimestamp = Time.time; swapMadeTimestamp = Time.time; // if (swapComplete) { // swapComplete = false; // SlugListManager.MoveAllSlugs (); // } deleteList.Clear(); foreach (PositionHolder a in deletedPositions) { // //Debug.Log ("deletePositions.Size = " + deletedPositions.Count); int row = a.GetRow(); int col = a.GetCol(); moveJewelsDown.MoveJewelsAboveDown(col, row); // instantiator.InstantiateSingleJewels (row, col); //// while (row >= 0 && instantiator.GetJewelGridGameObject (row, col) == null) //// row--; //// if (instantiator.GetJewelGridGameObject (row, col) != null) //// instantiator.GetJewelGridGameObject (row, col).GetComponent<RockLevelJewelMovement> ().MoveDown (false); } List <PositionHolder> nullPositions = null; if (!starShooter.GetStartLaunchingStars()) { nullPositions = new List <PositionHolder> (); int positionTotal = deletedPositions.Count, nullCount = 0; bool breakSecondLoop = false; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (instantiator.GetJewelGridGameObject(i, j) == null) { nullCount++; nullPositions.Add(new PositionHolder(i, j)); if (nullCount >= positionTotal) { breakSecondLoop = true; } } } if (breakSecondLoop) { break; } } } foreach (PositionHolder a in deletedPositions) { if (tutorialLevel1) { instantiator.InstantiateLevelOneTutorialJewels(a.GetRow(), a.GetCol()); } else if (tutorialLevel2) { instantiator.InstantiateLevelTwoTutorialJewels(a.GetRow(), a.GetCol()); } else if (tutorialLevel3) { instantiator.InstantiateLevelThreeTutorialJewels(a.GetRow(), a.GetCol()); } else if (tutorialLevel4) { instantiator.InstantiateLevelFourTutorialJewels(a.GetRow(), a.GetCol()); } else { instantiator.InstantiateSingleJewels(a.GetRow(), a.GetCol()); } } if (!starShooter.GetStartLaunchingStars()) { int whileCount = 0; if (!tutorialLevel1 && !tutorialLevel2 && !tutorialLevel3 && noMatchChecker.CheckForNoMatchesWithoutShuffle() && noMatchCount < 3) { Debug.Log("MAKING A NEW MATCH"); noMatchCount++; do { foreach (PositionHolder a in nullPositions) { Destroy(instantiator.GetJewelGridGameObject(a.GetRow(), a.GetCol())); instantiator.SetJewelGridGameObject(a.GetRow(), a.GetCol(), null); instantiator.InstantiateSingleJewels(a.GetRow(), a.GetCol()); } if (whileCount > 100) { Debug.Log("WHILECOUNT BREAK"); break; } whileCount++; } while (noMatchChecker.CheckForNoMatchesWithoutShuffle()); } else { noMatchCount = 0; } } deletedPositions.Clear(); // foreach (PositionHolder a in boulderHolder) { // if (instantiator.GetJewelGridGameObject (a.GetRow (), a.GetCol ()) != null) { // checkForMatches.CheckForSwapBack (instantiator.GetJewelGridGameObject (a.GetRow (), a.GetCol ()), a.GetRow (), a.GetCol ()); // } // } // boulderHolder.Clear (); // if (shadeCount == 0 || shadeCount == 1) { // shadeController = controller.GetCurrentTutorialShade ().GetComponent<LevelTwoTutorialShadeController> (); // shadeController.MakeInvisible (); // shadeCount++; // } // if (swapComplete) { // swapComplete = false; // SlugListManager.MoveAllSlugs (); // } }