public IEnumerator waitForSwipe() { SelectorManager selectorManager = GameSkeleton.selectorManager; float firstAngle = selectorManager.GiveAngleToThePositionRelativeToCurrentSelector(); yield return(new WaitUntil(() => firstAngle.GetDifferenceBetweenTwoAngle(selectorManager.GiveAngleToThePositionRelativeToCurrentSelector()) > 15f)); float secondAngle = selectorManager.currentSelectorObject.transform.TheAngleOfPositionRelativeToThisTransform(Camera.main.ScreenToWorldPoint(Input.mousePosition)); isTurned = true; bool isAngleFlipped = Mathf.Abs(firstAngle - secondAngle) > 270f ? true : false; if (isAngleFlipped) { if ((secondAngle > firstAngle)) { selectorManager.currentSelectorObject.GetComponent <DefaultSelector> ().StartTurnRoutine(-1); } else { selectorManager.currentSelectorObject.GetComponent <DefaultSelector> ().StartTurnRoutine(+1); } } else { if ((secondAngle < firstAngle)) { selectorManager.currentSelectorObject.GetComponent <DefaultSelector> ().StartTurnRoutine(-1); } else { selectorManager.currentSelectorObject.GetComponent <DefaultSelector> ().StartTurnRoutine(+1); } } }
public virtual void SelectGroupAccordingToPos(Vector3 Pos) { SelectorManager selectorManager = GameSkeleton.selectorManager; selectorManager.SetSelectorObjectByPieceType(this.GetType()); selectorManager.SelectedPieceGroup = GameSkeleton.gridSystem.GiveClosestIndexesOfAGridPieceInGridSystem(this, Pos, 2); selectorManager.SelectObjectsWithCurrentSelector(); }
// Start is called before the first frame update void Start() { if (instance != null) { Destroy(instance.gameObject); } instance = this; DontDestroyOnLoad(gameObject); activeHeroes = new List <HeroSelector>(); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public static bool TryConvertToDouble(SearchItem item, out double value, string selector = null) { value = double.NaN; object itemValue = SelectorManager.SelectValue(item, null, selector); if (itemValue == null) { return(false); } return(Utils.TryGetNumber(itemValue, out value)); }
void Awake() { gridSystem = GetComponent <GridSystem> (); selectorManager = GetComponent <SelectorManager> (); stats = GetComponent <Stats> (); inputManager = GetComponent <IInputManager> (); UImanager = GetComponent <UIManager> (); particleManager = GetComponent <IParticleManager> (); audoisource = GetComponent <AudioSource>(); Instance = this; }
/// <summary> /// The turn the routine of this selector. /// </summary> /// <returns>The routine.</returns> /// <param name="angleDir">Angle dir.</param> public override IEnumerator TurnRoutine(int angleDir) { GameSkeleton.inputManager.IsReadyForInput = false; SelectorManager selectorManager = GameSkeleton.selectorManager; //initialize selecteds List <Transform> selecteds = selectorManager.SelectedPieceGroup.AddThisGroupPiecesInToTheTransformList(); initializeSelectedsForTurn(selecteds); //get start rotation euler Vector3 startEuler = selectorManager.currentSelectorObject.transform.rotation.eulerAngles; //this is the algorith for that when in 3 selecteds turned on clockwise, if 2 of them in left 1 of them is right, indexes changes clockwise //but the in other situation indexes changes counter-clockwise //index turn direction also can be found with middle index minus lower index == 1 or bigger, int indexTurnDir = selecteds.CheckIfItsHaveAHighestXValue() == true ? angleDir : -angleDir; for (int i = 0; i < 3; i++) { //turn the selector for (int x = 0; x < 10; x++) { startEuler.z += (12f * angleDir); selectorManager.currentSelectorObject.transform.rotation = Quaternion.Euler(startEuler); yield return(new WaitForFixedUpdate()); } //correct Selecteds rotation for (int b = 0; b < selecteds.Count; b++) { selecteds [b].GetComponent <GridPiece> ().CorrectRotationWhenSelectorTurns(); } //turn idexes according to indexTurnDirection TurnSelectedIndexesInGridSystem(indexTurnDir); //wait for smoothness yield return(new WaitForSeconds(0.05f)); //check for any explosion if (ExplosionSystem.IsAnyExplosionInTheSystem) { resetSelectedsAfterTurn(selecteds); selectorManager.currentSelectorObject.SetActive(false); Stats.movedCountSystem.ActionMaded(); yield return(GameSkeleton.Instance.StartCoroutine(ExplosionSystem.Explode())); yield break; } } resetSelectedsAfterTurn(selecteds); GameSkeleton.inputManager.IsReadyForInput = true; }
public static string FormatItem(SearchContext ctx, SearchItem item, string formatString) { if (formatString == null) { var value = SelectorManager.SelectValue(item, ctx, null); return(value == null ? "null" : value.ToString()); } return(ParserUtils.ReplaceSelectorInExpr(formatString, (selector, cleanedSelector) => { var value = SelectorManager.SelectValue(item, ctx, cleanedSelector); return value == null ? "<no value>" : value.ToString(); })); }
public override void OnInspectorGUI() { serObj.Update(); SelectorManager MySelectorManager = (SelectorManager)target; EditorGUILayout.PropertyField(GlobalVariables, new GUIContent("Global Variables", "Reference the global variables to use it on the selector: (Money, Level)")); EditorGUILayout.PropertyField(Menu, new GUIContent("Main Menu", "Reference the main menu to return when the object is selected")); EditorGUILayout.PropertyField(FirstItem, new GUIContent("First", "First Object to appear on Focus")); EditorGUILayout.PropertyField(SelectionSpeed, new GUIContent("Selection Speed", "Speed between the selection among the objects")); EditorGUILayout.PropertyField(DragSpeed, new GUIContent("Drag Speed", "Swipe speed when swiping duh!! :)")); EditorGUILayout.PropertyField(LockMaterial, new GUIContent("Lock Material", "Material choosed for the locked objects")); EditorGUILayout.PropertyField(FrameCamera, new GUIContent("FrameCamera", " Auto Adjust the camera position by the size of the object")); EditorGUILayout.PropertyField(RotateItem, new GUIContent("Rotate Object", "Turning table for the focused object")); if (RotateItem.boolValue) { EditorGUILayout.PropertyField(RotationItem, new GUIContent("Velocity", "How fast the focused object will rotate")); EditorGUILayout.PropertyField(RotationVector, new GUIContent("Rotation Vector", "Choose your desire vector to rotate around")); } EditorGUILayout.Separator(); SelectorManager.ActionOnCLick Action = (SelectorManager.ActionOnCLick)Onclick.enumValueIndex; EditorGUILayout.PropertyField(Onclick, new GUIContent("On Click/Touch", "Choose your Action when Click/Touch the object")); if (Action == SelectorManager.ActionOnCLick.PlayAnimation) { EditorGUILayout.PropertyField(AnimToPlay, new GUIContent("Anim to Play", "It will play for all the Objects the named State on its Animator Controller")); } if (MySelectorManager.GlobalVariables == null) { EditorGUILayout.HelpBox("No Game Manager found, please link the Game Manager Script", MessageType.Warning); } if (MySelectorManager.Menu == null) { EditorGUILayout.HelpBox("No Main Menu Canvas found, please link the Main Menu Canvas", MessageType.Warning); } if (MySelectorManager.LockMaterial == null) { EditorGUILayout.HelpBox("No Lock material found, please add a material for locked objects", MessageType.Warning); } serObj.ApplyModifiedProperties(); }
SearchValue GetValue(SearchItem item, string selector) { var v = SelectorManager.SelectValue(item, m_Context.search, selector); return(new SearchValue(v)); }