/// <summary> /// Change trajectory line and move arrows to new active robot /// </summary> private void OnActiveRobotChange() { dpmRobot = mainState.ActiveRobot.GetDriverPractice(); trajectoryLine.transform.parent = dpmRobot.transform; Destroy(moveArrows); moveArrows = CreateMoveArrows(); }
void Update() { if (mainState == null) { mainState = StateMachine.SceneGlobal.FindState <MainState>(); } else { if (dpmRobot == null) { dpmRobot = mainState.ActiveRobot.GetDriverPractice(); FindElements(); } if (mainState.ActiveRobot.GetDriverPractice() != dpmRobot) { OnActiveRobotChange(); } SetGamepieceIndex(); if (trajectory && !editing) { UpdateTrajectoryValues(); } if (dpmRobot.drawing && DPMDataHandler.dpmodes.Where(d => d.gamepiece.Equals(FieldDataHandler.gamepieces[gamepieceIndex].name)).ToArray().Length > 0) { DrawTrajectory(); } else { trajectoryLine.GetComponent <LineRenderer>().enabled = false; } } }
/// <summary> /// Change trajectory line and move arrows to new active robot /// </summary> private void OnActiveRobotChange() { dpmRobot = mainState.ActiveRobot.GetDriverPractice(); trajectoryLine.transform.parent = dpmRobot.transform; Destroy(moveArrows); if (Auxiliary.FindGameObject("Field") != null) { moveArrows = CreateMoveArrows(); } }