public void StartBarrelRollPlanning() { ShipStand = MonoBehaviour.Instantiate(Game.Position.prefabShipStand, Selection.ThisShip.GetPosition(), Selection.ThisShip.GetRotation(), BoardManager.GetBoard()); ShipStand.transform.Find("ShipStandTemplate").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material = Selection.ThisShip.Model.transform.Find("RotationHelper").Find("RotationHelper2").Find("ShipAllParts").Find("ShipStand").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material; Roster.SetRaycastTargets(false); inReposition = true; MovementTemplates.CurrentTemplate = MovementTemplates.GetMovement1Ruler(); MovementTemplates.SaveCurrentMovementRulerPosition(); MovementTemplates.CurrentTemplate.position = Selection.ThisShip.TransformPoint(new Vector3(0.5f, 0, -0.25f)); }
public void StartBarrelRollPlanning() { GameObject prefab = (GameObject)Resources.Load(Selection.ThisShip.ShipBase.TemporaryPrefabPath, typeof(GameObject)); ShipStand = MonoBehaviour.Instantiate(prefab, Selection.ThisShip.GetPosition(), Selection.ThisShip.GetRotation(), BoardManager.GetBoard()); ShipStand.transform.Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material = Selection.ThisShip.Model.transform.Find("RotationHelper").Find("RotationHelper2").Find("ShipAllParts").Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material; ShipStand.transform.Find("ShipBase").Find("ObstaclesStayDetector").gameObject.AddComponent <ObstaclesStayDetectorForced>(); obstaclesStayDetectorBase = ShipStand.GetComponentInChildren <ObstaclesStayDetectorForced>(); barrelRollDistance = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 2f : 2.5f; barrelRollTemplateDistance = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 0.5f : 1.25f; battelRollTemplateLimitTop = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 0.25f : 1f; battelRollTemplateLimitBottom = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 0.75f : 2f; MovementTemplates.CurrentTemplate = MovementTemplates.GetMovement1Ruler(); MovementTemplates.CurrentTemplate.position = Selection.ThisShip.TransformPoint(new Vector3(barrelRollTemplateDistance, 0, -battelRollTemplateLimitTop)); obstaclesStayDetectorMovementTemplate = MovementTemplates.CurrentTemplate.GetComponentInChildren <ObstaclesStayDetectorForced>(); Roster.SetRaycastTargets(false); inReposition = true; }