/// <summary> /// Resumes the normal simulation and exits the replay mode, showing all UI elements again /// </summary> public override void Resume() { lastFrameCount = physicsWorld.frameCount; Tracking = true; CollisionTracker.Reset(); }
/// <summary> /// Called every step of the program to listen to input commands for various features /// </summary> public override void Update() { //If the reset button is held down after a certain amount of time, then go into change spawnpoint mode (reset spawnpoint feature) //Otherwise, reset the robot normally (quick reset feature) if (!activeRobot.IsResetting) { if (Input.GetKeyDown(KeyCode.U)) { LoadRobot(robotPath); } if (Input.GetKeyDown(KeyCode.Y)) { SwitchActiveRobot(); } } // Toggles between the different camera states if the camera toggle button is pressed if ((InputControl.GetButtonDown(Controls.buttons[0].cameraToggle))) { if (dynamicCameraObject.activeSelf && DynamicCamera.MovingEnabled) { dynamicCamera.ToggleCameraState(dynamicCamera.cameraState); } } // Switches to replay mode if (!activeRobot.IsResetting && Input.GetKeyDown(KeyCode.Tab)) { CollisionTracker.Synchronize(lastFrameCount); StateMachine.Instance.PushState(new ReplayState(fieldPath, robotPath, CollisionTracker.ContactPoints, Trackers)); } UpdateTrackers(); }
// Start is called before the first frame update void Start() { //get main camera component mainCamera = GameObject.Find("Main Camera").GetComponent <Camera>(); //get players rigidbody playerRB = GameObject.Find("Player").GetComponent <Rigidbody>(); //get the animator of the player playerAnimation = GameObject.Find("Player").GetComponent <Animator>(); //get the audio component playerAudio = GameObject.Find("Player").GetComponent <AudioSource>(); //get CollisionTracker script collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); //get the object bullets come from shootFrom = GameObject.Find("ShootFrom"); //get all of the bullet images bulletCountArray = new GameObject[] { GameObject.Find("BulletCount1"), GameObject.Find("BulletCount2"), GameObject.Find("BulletCount3"), GameObject.Find("BulletCount4"), GameObject.Find("BulletCount5"), GameObject.Find("BulletCount6"), GameObject.Find("BulletCount7"), GameObject.Find("BulletCount8"), GameObject.Find("BulletCount9"), GameObject.Find("BulletCount10"), }; }
public override void ApplyEffect(StateMachine actor) { WorldConstants.CrowdCheering.CreateCrowdCheer(CrowdCheers.Events.SmallPowerup); //Get some needed references. CollisionTracker colTrack = WorldConstants.ColTracker; Rules gameRules = WorldConstants.MatchController.GetComponent <LevelManager>().MatchRules; //Get all enemies to this player. Color team = actor.ActorData.Team; //Let the actor know what he did. WorldConstants.Creator.CreateFloatingTextsForPlayers(WorldConstants.Creator.FourMessages(WorldConstants.ActorConsts.PowerupConfusedEnemiesMessages, actor, null), st => st.ActorData.Team == actor.ActorData.Team, WorldConstants.Creator.CreatePowerupFloatingText); //Jumble each enemy's controls. foreach (StateMachine oth in colTrack.Actors) { //Include non-player enemies if the game rules call for it. if (!team.Equals(oth.ActorData.Team) && (gameRules.EnemiesArePeopleToo || oth.IsPlayer)) { oth.Input.JumbleInput(oth.ActorData.PlayerID, PowerupBehavior.Consts.PowerupJumbleControlsTime); } } }
// Start is called before the first frame update void Start() { //determines the position of the score on the HUD //transform.localPosition = Camera.main.ViewportToWorldPoint(new Vector3(3.1f, 0, -850f)); collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); }
// Start is called before the first frame update void Start() { spawnRangeZ = GameObject.Find("Border").transform.position.z; InvokeRepeating("SpawnObstacles", startDelay, spawnInterval); collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); }
public void StartReplay() { if (!activeRobot.IsResetting) { CollisionTracker.Synchronize(lastFrameCount); StateMachine.Instance.PushState(new ReplayState(fieldPath, robotPath, CollisionTracker.ContactPoints, Trackers)); } }
// Start is called before the first frame update void Start() { //get the CollisionTracker script collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); //execute the method SpeedIncrease() after 10 seconds, then repeat it every 10 seconds InvokeRepeating("SpeedIncrease", speedIncreaseStartDelay, speedIncreaseInterval); }
// Start is called before the first frame update void Start() { //find the collision tracker script from the Player object so we can access that scripts methods from this script collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); //find the IncreaseSpeed script from the IncreaseObstacleSpeed object so we can access that script's methods from this script increaseSpeedScript = GameObject.Find("IncreaseObstacleSpeed").GetComponent <IncreaseSpeed>(); }
/// <summary> /// Ends the restting process of the active robot and resets the replay tracking objects /// </summary> public void EndRobotReset() { ActiveRobot.EndReset(); foreach (Tracker t in UnityEngine.Object.FindObjectsOfType <Tracker>()) { t.Clear(); CollisionTracker.Reset(); } }
void Awake() { PScolor = standardPS.colorOverLifetime; tracker = GameObject.FindWithTag("CollisionTracker").GetComponent <CollisionTracker> (); sr = GetComponent <SpriteRenderer>(); spawner = GameObject.FindWithTag("BrickSpawner").GetComponent <BrickSpawner> (); gameInit = GameObject.FindWithTag("GameInitializer").GetComponent <GameInitializer> (); hb = GetComponent <HazardBrick>(); gm = GameObject.FindWithTag("GameManager").GetComponent <GameSceneManager>(); hc = GameObject.FindWithTag("HazardController").GetComponent <HazardController>(); }
// Start is called before the first frame update void Start() { //get the z-axis boundary position from the ZBorder object zRange = GameObject.Find("ZBorder").transform.position.z; //get the negative and positive x-axis boundary position from the ZBorder object positiveXBorder = GameObject.Find("XBorder1").transform.position.x; negativeXBorder = GameObject.Find("XBorder2").transform.position.x; //find the collision tracker script from the Player object so we can access that scripts methods from this script collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); }
public void Update() { if (Collision == null) { Collision = WorldConstants.ColTracker; } foreach (GameTypeRules gtr in EnabledGameTypes) { gtr.Update(); } }
public void EnterReplayState() { if (!activeRobot.IsResetting) { CollisionTracker.Synchronize(lastFrameCount); StateMachine.Instance.PushState(new ReplayState(fieldPath, robotPath, CollisionTracker.ContactPoints, Trackers)); } else { UserMessageManager.Dispatch("Please finish resetting before entering replay mode!", 5f); } }
/// <summary> /// Resumes the normal simulation and exits the replay mode, showing all UI elements again /// </summary> public override void Resume() { lastFrameCount = physicsWorld.frameCount; Tracking = true; foreach (Canvas c in Resources.FindObjectsOfTypeAll <Canvas>().Where(x => x.transform.root.name.Equals("Main Camera"))) { c.enabled = true; } CollisionTracker.Reset(); }
/// <summary> /// Called after Awake() when the script instance is enabled. /// Initializes variables then loads the field and robot as well as setting up replay features. /// </summary> public override void Start() { //getting bullet physics information physicsWorld = BPhysicsWorld.Get(); ((DynamicsWorld)physicsWorld.world).SetInternalTickCallback(BRobotManager.Instance.UpdateRaycastRobots); lastFrameCount = physicsWorld.frameCount; //setting up replay Trackers = new List <Tracker>(); CollisionTracker = new CollisionTracker(this); //starts a new instance of unity packet which receives packets from the driver station unityPacket = new UnityPacket(); unityPacket.Start(); //loads all the controls Controls.Load(); //If a replay has been selected, load the replay. Otherwise, load the field and robot. string selectedReplay = PlayerPrefs.GetString("simSelectedReplay"); SpawnedRobots = new List <Robot>(); if (string.IsNullOrEmpty(selectedReplay)) { Tracking = true; Debug.Log(LoadField(PlayerPrefs.GetString("simSelectedField")) ? "Load field success!" : "Load field failed."); Debug.Log(LoadRobot(PlayerPrefs.GetString("simSelectedRobot")) ? "Load robot success!" : "Load robot failed."); int isMixAndMatch = PlayerPrefs.GetInt("MixAndMatch", 0); // 0 is false, 1 is true int hasManipulator = PlayerPrefs.GetInt("hasManipulator"); if (isMixAndMatch == 1 && hasManipulator == 1) { Debug.Log(LoadManipulator(PlayerPrefs.GetString("simSelectedManipulator")) ? "Load manipulator success" : "Load manipulator failed"); } } else { awaitingReplay = true; LoadReplay(selectedReplay); } //initializes the dynamic camera dynamicCameraObject = GameObject.Find("Main Camera"); dynamicCamera = dynamicCameraObject.AddComponent <DynamicCamera>(); DynamicCamera.MovingEnabled = true; sensorManager = GameObject.Find("SensorManager").GetComponent <SensorManager>(); sensorManagerGUI = GameObject.Find("StateMachine").GetComponent <SensorManagerGUI>(); robotCameraManager = GameObject.Find("RobotCameraList").GetComponent <RobotCameraManager>(); }
/// <summary> /// Called when the script instance is being initialized. /// Initializes the bullet physics environment /// </summary> public override void Awake() { Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes"); GImpactCollisionAlgorithm.RegisterAlgorithm((CollisionDispatcher)BPhysicsWorld.Get().world.Dispatcher); //BPhysicsWorld.Get().DebugDrawMode = DebugDrawModes.DrawWireframe | DebugDrawModes.DrawConstraints | DebugDrawModes.DrawConstraintLimits; BPhysicsWorld.Get().DebugDrawMode = DebugDrawModes.All; BPhysicsWorld.Get().DoDebugDraw = false; ((DynamicsWorld)BPhysicsWorld.Get().world).SolverInfo.NumIterations = SolverIterations; CollisionTracker = new CollisionTracker(this); unityPacket = new UnityPacket(); SpawnedRobots = new List <SimulatorRobot>(); }
public override void ApplyEffect(StateMachine actor) { WorldConstants.CrowdCheering.CreateCrowdCheer(CrowdCheers.Events.LargePowerup); //Get some needed references. CollisionTracker colTrack = WorldConstants.ColTracker; PlayerProperties props = actor.PlayerProps; Rules gameRules = WorldConstants.MatchController.GetComponent <LevelManager>().MatchRules; //Get all enemies to this player. Color team = actor.ActorData.Team; //Artificially set the player's velocity really high to emulate a huge hit. Vector3 oldV = actor.Velocity; actor.Velocity = PowerupBehavior.Consts.PowerupHurtOthersTempVel; //Randomize direction. if (Random.value > 0.5f) { actor.Velocity.x *= -1.0f; } if (Random.value > 0.5f) { actor.Velocity.y *= -1.0f; } //Create floating texts. WorldConstants.Creator.CreateFloatingTextsForPlayers(WorldConstants.Creator.FourMessages(WorldConstants.ActorConsts.PowerupThrewEnemiesMessages, actor, null), st => st.ActorData.Team == actor.ActorData.Team, WorldConstants.Creator.CreatePowerupFloatingText); //Throw each enemy as if they were hurt. foreach (StateMachine oth in colTrack.Actors) { //Include non-player enemies if the game rules call for it. if (!team.Equals(oth.ActorData.Team) && (gameRules.EnemiesArePeopleToo || oth.IsPlayer)) { //Hurt the actor. oth.HurtByActor(actor.gameObject, 0.0f, 0.0f, StateMachine.NewVs(actor, oth)); //Artificially extend the time that the actor spends hurt. if (oth.tag == "Player") { ((HurtState)oth.CurrentState).elapsed -= PowerupBehavior.Consts.PowerupHurtOtherExtraHurtTime; } } } //Set the player's velocity back to normal. actor.Velocity = oldV; }
public void uutTestCollitionGet() { List <CollisionTracker> tracker = new List <CollisionTracker>(); var elm = new CollisionTracker() { Tag = "UUT", CollisionList = String.Empty }; tracker.Add(elm); Assert.Contains(elm, tracker); }
protected override void SetUp() { var t = GameObject.FindWithTag("Timer"); if (t != null) { timer = t.GetComponent <Timer> (); } else { timer = null; } tracker = GameObject.FindWithTag("CollisionTracker").GetComponent <CollisionTracker>(); ballControl = GameObject.FindWithTag("BallController").GetComponent <BallController>(); }
// Start is called before the first frame update void Start() { //get player controller script playerControlScript = GameObject.Find("Player").GetComponent <PlayerController>(); //get the player object player = GameObject.Find("Player"); //get the CollisionTracker script collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); //invoke the SpawnEnemies, SpawnPowerups, and IncreaseEnemySpawnNumber repeatedly with their respective repeat times. InvokeRepeating("SpawnNormalEnemies", normalEnemyStartDelay, normalEnemySpawnDelay); InvokeRepeating("SpawnBigEnemies", bigEnemyStartDelay, bigEnemySpawnDelay); InvokeRepeating("SpawnPowerups", powerupStartDelay, powerupSpawnDelay); InvokeRepeating("IncreaseEnemySpawnNumber", enemyNumberStartDelay, enemyNumberSpawnDelay); }
Quaternion _lastTargetRotation; // used to keep track of the rotation the player last was targeting when getting interupted by getting hit public void ManualAwake() { _character = GetComponent <Character>(); _model = _character.model; _stateComponent = _character.stateComponent; _flagComponent = _character.flagComponent; _collisionTracker = FindObjectOfType <CollisionTracker>(); _lastTargetRotation = transform.rotation; _character.OnCharacterSpawned += (Vector2DInt inSpawnTile) => { currentTile = Match.instance.level.tileMap.GetTile(inSpawnTile); currentTile.SetCharacter(_character); }; }
// Start is called before the first frame update void Start() { //set the spawn range on the Z axis based on the z position of the ZBorder object spawnRangeZ = GameObject.Find("ZBorder").transform.position.z; //set the positive spawn range on the X axis based on the x position of the XBorder1 object positiveSpawnRangeX = GameObject.Find("XBorder1").transform.position.x; //set the negative spawn range on the X axis based on the x position of the XBorder1 object negativeSpawnRangeX = GameObject.Find("XBorder2").transform.position.x; //execute the SpawnObstaclesFromRight() method after 2 seconds and then repeat the method every 1.5 seconds InvokeRepeating("SpawnObstaclesFromRight", rightSideStartDelay, spawnInterval); //execute the SpawnObstaclesFromTop() method after 25 seconds and then repeat the method every 1.5 seconds InvokeRepeating("SpawnObstaclesFromTop", topSideStartDelay, spawnInterval); //find the collision tracker script from the Player object so we can access that scripts methods from this script collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); }
public void uutTestCollitionSet() { List <CollisionTracker> tracker = new List <CollisionTracker>(); var elm = new CollisionTracker() { Tag = "UUT", CollisionList = String.Empty }; tracker.Add(elm); var collisionTracker = tracker.First(); collisionTracker.CollisionList = "EXF232"; collisionTracker.Tag = "SET"; Assert.AreEqual("EXF232", collisionTracker.CollisionList); Assert.AreEqual("SET", collisionTracker.Tag); }
// Start is called before the first frame update void Start() { //get the z-axis boundary position from the PlayerZBoundary object zRange = GameObject.Find("ZBoundary").transform.position.z; //get the x-axis boundary position from the PlayerXBoundary object xRange = GameObject.Find("XBoundary").transform.position.x; //get the CollisionTracker script collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); //get the animator for the player playerAnimation = GetComponent <Animator>(); //get the original color of player object playerColor = GameObject.Find("Player").GetComponent <Renderer>().material.color; //get the rendering component of player object, so we can change color with powerups playerRenderer = GameObject.Find("Player").GetComponent <Renderer>(); }
// Start is called before the first frame update void Start() { //get necessary scripts collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); playerControlScript = GameObject.Find("Player").GetComponent <PlayerController>(); increaseSpeedScript = GameObject.Find("SpawnManager").GetComponent <IncreaseSpeed>(); enemyRB = gameObject.GetComponent <Rigidbody>(); //get the target to follow enemyTarget = GameObject.Find("EnemyLookAt").transform; //stops enemies from flying away on spawn if (gameObject.transform.position.y != enemyTarget.transform.position.y) { enemyRB.velocity = Vector3.zero; //gameObject.transform.position = new Vector3(gameObject.transform.position.x, enemyTarget.transform.position.y, gameObject.transform.position.z); gameObject.transform.position = new Vector3(gameObject.transform.position.x, 0.5f, gameObject.transform.position.z); } }
/// <summary> /// Called when the script instance is being initialized. /// Initializes the bullet physics environment /// </summary> public override void Awake() { QualitySettings.SetQualityLevel(PlayerPrefs.GetInt("qualityLevel")); Screen.fullScreenMode = (FullScreenMode)PlayerPrefs.GetInt("fullscreen", 1); GameObject.Find("VersionNumber").GetComponent <Text>().text = "Version " + CurrentVersion; if (CheckConnection()) { WebClient client = new WebClient(); ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback; var json = new WebClient().DownloadString("https://raw.githubusercontent.com/Autodesk/synthesis/master/VersionManager.json"); VersionManager update = JsonConvert.DeserializeObject <VersionManager>(json); SimUI.updater = update.URL; var localVersion = new Version(CurrentVersion); var globalVersion = new Version(update.Version); var check = localVersion.CompareTo(globalVersion); if (check < 0) { Auxiliary.FindGameObject("UpdatePrompt").SetActive(true); } } robotDirectory = PlayerPrefs.GetString("RobotDirectory"); Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes"); GImpactCollisionAlgorithm.RegisterAlgorithm((CollisionDispatcher)BPhysicsWorld.Get().world.Dispatcher); //BPhysicsWorld.Get().DebugDrawMode = DebugDrawModes.DrawWireframe | DebugDrawModes.DrawConstraints | DebugDrawModes.DrawConstraintLimits; BPhysicsWorld.Get().DebugDrawMode = DebugDrawModes.All; BPhysicsWorld.Get().DoDebugDraw = false; ((DynamicsWorld)BPhysicsWorld.Get().world).SolverInfo.NumIterations = SolverIterations; CollisionTracker = new CollisionTracker(this); SpawnedRobots = new List <SimulatorRobot>(); }
public IEnumerator CollisionEndsOnTrackerGameObjectDisable() { WaitForFixedUpdate yieldInstruction = new WaitForFixedUpdate(); GameObject trackerContainer = GameObject.CreatePrimitive(PrimitiveType.Cube); trackerContainer.GetComponent <Collider>().isTrigger = true; trackerContainer.AddComponent <Rigidbody>().isKinematic = true; trackerContainer.transform.position = Vector3.forward; CollisionTracker tracker = trackerContainer.AddComponent <CollisionTracker>(); GameObject notifierContainer = GameObject.CreatePrimitive(PrimitiveType.Cube); notifierContainer.GetComponent <Collider>().isTrigger = true; notifierContainer.AddComponent <Rigidbody>().isKinematic = true; notifierContainer.transform.position = Vector3.back; CollisionNotifier notifier = notifierContainer.AddComponent <CollisionNotifier>(); UnityEventListenerMock trackerCollisionStartedListenerMock = new UnityEventListenerMock(); UnityEventListenerMock trackerCollisionChangedListenerMock = new UnityEventListenerMock(); UnityEventListenerMock trackerCollisionStoppedListenerMock = new UnityEventListenerMock(); tracker.CollisionStarted.AddListener(trackerCollisionStartedListenerMock.Listen); tracker.CollisionChanged.AddListener(trackerCollisionChangedListenerMock.Listen); tracker.CollisionStopped.AddListener(trackerCollisionStoppedListenerMock.Listen); UnityEventListenerMock notifierCollisionStartedListenerMock = new UnityEventListenerMock(); UnityEventListenerMock notifierCollisionChangedListenerMock = new UnityEventListenerMock(); UnityEventListenerMock notifierCollisionStoppedListenerMock = new UnityEventListenerMock(); notifier.CollisionStarted.AddListener(notifierCollisionStartedListenerMock.Listen); notifier.CollisionChanged.AddListener(notifierCollisionChangedListenerMock.Listen); notifier.CollisionStopped.AddListener(notifierCollisionStoppedListenerMock.Listen); yield return(yieldInstruction); Assert.IsFalse(trackerCollisionStartedListenerMock.Received); Assert.IsFalse(trackerCollisionChangedListenerMock.Received); Assert.IsFalse(trackerCollisionStoppedListenerMock.Received); Assert.IsFalse(notifierCollisionStartedListenerMock.Received); Assert.IsFalse(notifierCollisionChangedListenerMock.Received); Assert.IsFalse(notifierCollisionStoppedListenerMock.Received); trackerCollisionStartedListenerMock.Reset(); trackerCollisionChangedListenerMock.Reset(); trackerCollisionStoppedListenerMock.Reset(); notifierCollisionStartedListenerMock.Reset(); notifierCollisionChangedListenerMock.Reset(); notifierCollisionStoppedListenerMock.Reset(); trackerContainer.transform.position = Vector3.zero; notifierContainer.transform.position = Vector3.zero; yield return(yieldInstruction); Assert.IsTrue(trackerCollisionStartedListenerMock.Received); Assert.IsTrue(trackerCollisionChangedListenerMock.Received); Assert.IsFalse(trackerCollisionStoppedListenerMock.Received); Assert.IsTrue(notifierCollisionStartedListenerMock.Received); Assert.IsTrue(notifierCollisionChangedListenerMock.Received); Assert.IsFalse(notifierCollisionStoppedListenerMock.Received); trackerCollisionStartedListenerMock.Reset(); trackerCollisionChangedListenerMock.Reset(); trackerCollisionStoppedListenerMock.Reset(); notifierCollisionStartedListenerMock.Reset(); notifierCollisionChangedListenerMock.Reset(); notifierCollisionStoppedListenerMock.Reset(); trackerContainer.SetActive(false); yield return(yieldInstruction); Assert.IsFalse(trackerCollisionStartedListenerMock.Received); Assert.IsFalse(trackerCollisionChangedListenerMock.Received); Assert.IsTrue(trackerCollisionStoppedListenerMock.Received); Assert.IsFalse(notifierCollisionStartedListenerMock.Received); Assert.IsFalse(notifierCollisionChangedListenerMock.Received); Assert.IsTrue(notifierCollisionStoppedListenerMock.Received); Object.DestroyImmediate(trackerContainer); Object.DestroyImmediate(notifierContainer); }
// Start is called before the first frame update void Start() { InvokeRepeating("SpawnObstacles", startDelay, spawnInterval); collisionTrackerScript = GameObject.Find("Player").GetComponent <CollisionTracker>(); }
/// <summary> /// Called after Awake() when the script instance is enabled. /// Initializes variables then loads the field and robot as well as setting up replay features. /// </summary> public override void Start() { AppModel.ClearError(); //getting bullet physics information physicsWorld = BPhysicsWorld.Get(); ((DynamicsWorld)physicsWorld.world).SetInternalTickCallback(BPhysicsTickListener.Instance.PhysicsTick); lastFrameCount = physicsWorld.frameCount; //setting up raycast robot tick callback BPhysicsTickListener.Instance.OnTick -= BRobotManager.Instance.UpdateRaycastRobots; BPhysicsTickListener.Instance.OnTick += BRobotManager.Instance.UpdateRaycastRobots; //setting up replay CollisionTracker = new CollisionTracker(this); //starts a new instance of unity packet which receives packets from the driver station unityPacket = new UnityPacket(); unityPacket.Start(); //loads all the controls Controls.Load(); //If a replay has been selected, load the replay. Otherwise, load the field and robot. string selectedReplay = PlayerPrefs.GetString("simSelectedReplay"); SpawnedRobots = new List <Robot>(); if (string.IsNullOrEmpty(selectedReplay)) { Tracking = true; if (!LoadField(PlayerPrefs.GetString("simSelectedField"))) { AppModel.ErrorToMenu("Could not load field: " + PlayerPrefs.GetString("simSelectedField") + "\nHas it been moved or deleted?)"); return; } if (!LoadRobot(PlayerPrefs.GetString("simSelectedRobot"), RobotTypeManager.IsMixAndMatch)) { AppModel.ErrorToMenu("Could not load robot: " + PlayerPrefs.GetString("simSelectedRobot") + "\nHas it been moved or deleted?)"); return; } if (RobotTypeManager.IsMixAndMatch && RobotTypeManager.HasManipulator) { Debug.Log(LoadManipulator(RobotTypeManager.ManipulatorPath) ? "Load manipulator success" : "Load manipulator failed"); } } else { awaitingReplay = true; LoadReplay(selectedReplay); } //initializes the dynamic camera DynamicCameraObject = GameObject.Find("Main Camera"); dynamicCamera = DynamicCameraObject.AddComponent <DynamicCamera>(); DynamicCamera.MovingEnabled = true; sensorManager = GameObject.Find("SensorManager").GetComponent <SensorManager>(); sensorManagerGUI = GameObject.Find("StateMachine").GetComponent <SensorManagerGUI>(); robotCameraManager = GameObject.Find("RobotCameraList").GetComponent <RobotCameraManager>(); IsMetric = PlayerPrefs.GetString("Measure").Equals("Metric") ? true : false; StateMachine.Instance.Link <MainState>(GameObject.Find("Main Camera").transform.GetChild(0).gameObject); StateMachine.Instance.Link <ReplayState>(Resources.FindObjectsOfTypeAll <GameObject>().First(x => x.name.Equals("ReplayUI"))); StateMachine.Instance.Link <SaveReplayState>(Resources.FindObjectsOfTypeAll <GameObject>().First(x => x.name.Equals("SaveReplayUI"))); }