private Transform thisTransform; // the variable that will hold a cached reference to this Transform. // Use this for pre-initialization void Awake() { //assign this rigidbody to our thisRB variable. thisRb = GetComponent <Rigidbody>(); //assign this transform to our thisTransform variable. thisTransform = transform; //setup a reference to our main camera mainCamera = Camera.main; //make sure the static ref is set to This. currentSlicer = this; //give the initial swordSwipeCounter the value we decided on for "minimumTimeBetweenSwipes" swordSwipeCounter = minimumTimeBetweenSwipes; //make sure that we have the proper gameObject for our sliceColliderParent(one gameobjects below this gameObject is its parent, so we use GetChild(0)) sliceColliderParent = thisTransform.GetChild(0).gameObject; //then once we have the sliceColliderParent we set it inactive sliceColliderParent.SetActive(false); }
/// <summary> /// UpdateUIText does exactly what you would imagine. It updates UI Text. /// </summary> public void UpdateUIText() { //we update all the current scores. ClassicText.text = GameVariables.ClassicModeScore.ToString(); relaxText.text = GameVariables.RelaxModeScore.ToString(); //we update the highest scores. ClassicHighestText.text = GameVariables.ClassicModeHighestScore.ToString(); relaxHighestText.text = GameVariables.RelaxModeHighestScore.ToString(); if (!FNCTouchSlicer.trueWord) { wordText.text = FNCTouchSlicer.getSlice(); } if (!FNCTouchSlicer.trueLongerWord) { longerWord.text = GameVariables.longerWord; } antidot.text = numAntidot.ToString(); }