public U9Transition CreateOnScoreTransition(List <Block> blocks, int layer, int tScore) { int layerMask = 1 << layer; layerMask = ~layerMask; Proj.ignoreLayers = layerMask; U9Transition onScoreTransition = null; transform.parent = blocks[blocks.Count / 2].transform; transform.localScale = Vector3.one; //onScoreTransition = U9T.T (iTween.MoveTo, this.gameObject, iTween.Hash("position", new Vector3(0, 0, -1000), "time", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); //onScoreTransition.Ended += (transition) => //{ float staggerTime = 0f; //0.45f; List <U9Transition> transitions = new List <U9Transition> (); foreach (Block m in blocks) { transitions.Add(m.CreateDisappearTransition(tScore)); } staggerTime = staggerTime / transitions.Count; U9Transition t = U9T.Stagger(staggerTime, transitions.ToArray()); t.Begin(); Destroy(this.gameObject); //}; return(new InstantTransition(onScoreTransition)); }
public IEnumerator StartGameIE() { colorPalette = colorManager.getBlockColors(); foreach (Transform t in transform) { GameObject.Destroy(t.gameObject); } BackgroundBlocks = new List <Blocks>(); // Initialise space for the blocks in the grid blocks = new Block[gridSize, gridSize]; // Calculate the bottom left position of the grid gridBaseline = -0.5f * new Vector3(((blockPaddingSize + blockSize) * (gridSize - 1)), (blockPaddingSize + blockSize) * (gridSize - 1), 0f); gridBaseline.y += 60.0f; // Initialise Game Services GooglePlayGames.PlayGamesPlatform.Activate(); // Spawn the static background blocks for (int j = gridSize - 2, nj = 0; j > nj; j--) { for (int i = 1, ni = gridSize - 1; i < ni; i++) { Block backgroundBlockInstance = (Block)Instantiate(blockPrefab); backgroundBlockInstance.SquareSize = blockSize; backgroundBlockInstance.Color = HexColor.ColorFromHex("D2D2D2" /*"E9ECEE"*/); backgroundBlockInstance.transform.parent = transform; backgroundBlockInstance.transform.localPosition = GridPosTo3DPos(i, j, -10); backgroundBlockInstance.transform.localScale = Vector3.one; // * 0.001f; backgroundBlockInstance.IsBackground = true; backgroundBlockInstance.gameObject.layer = 8; Blocks sBlock = new Blocks(); sBlock.block = backgroundBlockInstance; BackgroundBlocks.Add(sBlock); //U9Transition transitions = U9T.HOT (HOTween.To, backgroundBlockInstance.gameObject.transform, 0.3f, new TweenParms().Prop("localScale", Vector3.one,false).Ease(EaseType.EaseOutExpo)); U9Transition transitions = U9T.LT(LeanTween.scale, backgroundBlockInstance.gameObject, Vector3.one, 0.3f, iTween.Hash("ease", LeanTweenType.easeOutExpo)); //U9Transition transitions = U9T.T (iTween.ScaleTo, backgroundBlockInstance.gameObject, iTween.Hash ("scale", new Vector3(1,1,1), "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo )); transitions.Begin(); yield return(new WaitForSeconds(0.05f)); } } GameObject intro = (GameObject)Instantiate(_IntroEffect); StartNewGame(); GameCreated = true; }
/// <summary> /// Restarts the game. /// </summary> /// <param name="displayIntro">If set to <c>true</c> display intro.</param> void RestartGame(bool displayIntro) { gameIsOver = false; U9Transition t; t = U9T.S(U9T.P(displayIntro ? introView.GetDisplayTransition() : null)); t.Begin(); }
public static void ValidateTransitionArray(U9Transition[] transitions) { for (int i = 0, ni = transitions.Length; i < ni; i++) { if (transitions[i] == null) { transitions[i] = U9T.Null(); } } }
public virtual U9Transition GetDisplayTransition(bool force = false) { if ((!force && IsDisplaying)) { // Debug.LogWarning( name + " already " + State ); return(U9T.Null()); } else { state = ViewState.Displaying; U9Transition t = CreateDisplayTransition(force); AddDisplayTransitionListeners(t); return(t); } }
public U9Transition FireEvent(string eventID, object source, params object[] args) { //Debug.Log ("FIRE EVENT: " + eventID); U9Event e; U9Transition transition = U9T.Null(); if (events.TryGetValue(eventID, out e)) { U9EventArgs eventArgs = e.OnFired(source, args); if (eventArgs != null && eventArgs.Transitions.Count > 0) { transition = U9T.P(eventArgs.Transitions.ToArray()); } } return(transition); }
/// <summary> /// Plays transitions in parallel, with a specified interval between each one. /// </summary> /// <param name='staggerOffset'> /// Start time offset. /// </param> /// <param name='ignoreTimescale'> /// Set to true to ignore timescale settings. /// </param> /// <param name='transitions'> /// Transitions to stagger. /// </param> public static U9ParallelTransition Stagger(float staggerOffset, bool ignoreTimescale, params U9Transition[] transitions) { U9ParallelTransition stagger = new U9ParallelTransition(); float currentOffset = 0f; foreach (U9Transition t in transitions) { if (t && !t.IsNull) { stagger.AddTransition(U9T.S(U9T.W(currentOffset, ignoreTimescale), t)); currentOffset += staggerOffset; } } return(stagger); }
U9Transition CreateCompositeTransition(U9Transition[] ts) { switch (compositionType) { case CompositionType.Parallel: return(U9T.P(ts)); case CompositionType.Serial: return(U9T.S(ts)); case CompositionType.Stagger: return(U9T.Stagger(0.1f, ts)); default: return(null); } }
public U9Transition GetPopViewTransition(int popCount = 1, bool force = false, bool displayFirst = false) { //PrintStack(); List <U9Transition> popTransitions = new List <U9Transition>(); while (viewStack.Count > 0 && popCount > 0) { popTransitions.Add(viewStack.Pop().GetHideTransition(force)); popCount--; } U9View newView = null; if (viewStack.Count > 0) { newView = viewStack.Peek(); } U9Transition displayNewView = null; if (newView) { if (!newView.IsDisplaying) { displayNewView = newView.GetDisplayTransition(force); } else { newView.EnableInteraction(); } } //PrintStack(); if (displayFirst) { return(U9T.S(displayNewView, U9T.S(popTransitions.ToArray()))); } else { return(U9T.S(U9T.S(popTransitions.ToArray()), displayNewView)); } }
public virtual U9Transition GetHideTransition(bool force = false) { // if ( !force && !gameObject.activeInHierarchy) { // Hide (); // return U9T.Null (); // } if ((!force && !IsDisplaying)) { //Debug.LogWarning( name + " already " + State ); return(U9T.Null()); } else { state = ViewState.Hiding; U9Transition t = CreateHideTransition(force); AddHideTransitionListeners(t); return(t); } }
/// <summary> /// Returns a transition that moves the block in the source position to the destination position /// </summary> /// <returns>The move block transition.</returns> /// <param name="sourceI">Source i.</param> /// <param name="sourceJ">Source j.</param> /// <param name="destI">Destination i.</param> /// <param name="destJ">Destination j.</param> U9Transition CreateMoveBlockTransition(int sourceI, int sourceJ, int destI, int destJ) { Block b = blocks [sourceI, sourceJ]; // If the source block does not exist then return a null transition. if (!b) { return(U9T.Null()); } //!! // If source and dest positions are the same then return a null transition if (sourceI == destI && sourceJ == destJ) { //return U9T.T (iTween.ShakePosition, b.gameObject, iTween.Hash ("x", 0.05f, "y", 0.05f, "time", 0.3f, "islocal", false)); return(U9T.Null()); } //!! // If the destination position is already occupied then return a null transition if (blocks [destI, destJ]) { Debug.LogError("Destination is already occupied by a block!"); return(U9T.Null()); } // Move the block in data blocks [sourceI, sourceJ] = null; blocks [destI, destJ] = b; // Update the blocks position b.I = destI; b.J = destJ; // Disable the fading on the block b.Ghost = false; // Return a tween to move the blocks gameObject //return U9T.HOT(HOTween.To, b.gameObject.transform, 0.3f, new TweenParms().Prop("localPosition", GridPosTo3DPos (destI, destJ, 0), false).Ease(EaseType.EaseOutCirc)); //return U9T.T (iTween.MoveTo, b.gameObject, iTween.Hash ("position", GridPosTo3DPos (destI, destJ, 0), "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutCirc )); return(U9T.LT(LeanTween.moveLocal, b.gameObject, GridPosTo3DPos(destI, destJ, 0), 0.3f, iTween.Hash("ease", LeanTweenType.easeOutCirc))); }
/// <summary> /// Causes all blocks to disappear /// </summary> /// <returns>The clear board transition.</returns> U9Transition CreateClearBoardTransition() { List <U9Transition> transitions = new List <U9Transition> (); for (int i = 0, ni = gridSize; i < ni; i++) { for (int j = 0, nj = gridSize; j < nj; j++) { Block b = blocks [i, j]; if (b) { transitions.Add(b.CreateDisappearTransition(0)); } } } // Randomises the order of the disappear transitions to make it more pretty! List <U9Transition> randomisedTransitions = GetRandomSubset(transitions, transitions.Count); float staggerTime = 0.025f; // 0.025f; return(U9T.Stagger(staggerTime, randomisedTransitions.ToArray())); }
/// <summary> /// Instantiates a block and returns a transition to move it into place /// </summary> /// <returns>The spawn transition.</returns> /// <param name="i">The index.</param> /// <param name="j">J.</param> U9Transition SpawnBlock(int i, int j) { Block b = (Block)Instantiate(blockPrefab); b.transform.parent = transform; b.transform.localPosition = GridPosTo3DPos(i, j, blockSize); b.transform.localScale = Vector3.one; b.Color = colorPalette [Random.Range(0, GetColourPalletteSize())]; Color temporaryColorHolder = b.Color; temporaryColorHolder.a *= 0.5f; b.Ghost = true; b.SquareSize = blockSize; b.I = i; b.J = j; blocks [i, j] = b; //return U9T.HOT(HOTween.To, b.gameObject.transform, 0.2f, new TweenParms().Prop("localPosition", GridPosTo3DPos (i, j, 0), false).Ease(EaseType.EaseOutQuad)); //return U9T.T (iTween.MoveTo, b.gameObject, iTween.Hash ("position", GridPosTo3DPos (i, j, 0), "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad )); return(U9T.LT(LeanTween.moveLocal, b.gameObject, GridPosTo3DPos(i, j, 0), 0.2f, iTween.Hash("ease", LeanTweenType.easeOutCirc))); }
public static U9SerialTransition PrioritySequence(U9Transition[] transitions, float staggerTime = 0f) { //Debug.Log ("START PRIORITY SEQUENCE -------------"); List <U9Transition> transList = new List <U9Transition>(transitions); //transList.Sort( CompareTransitionPriority ); IEnumerable enumerator = transList.OrderBy(t => t.Priority); int?currentPriority = null; U9SerialTransition serial = new U9SerialTransition(); List <U9Transition> parallelGroup = new List <U9Transition> (); foreach (U9Transition t in enumerator) { if (t != null) { if (t.Priority != currentPriority) { if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition(U9T.Stagger(staggerTime, parallelGroup.ToArray())); parallelGroup.Clear(); } currentPriority = t.Priority; } parallelGroup.Add(t); } } if (parallelGroup.Count > 0) { //Debug.Log ("Priority group: " + currentPriority + " = " + parallelGroup.Count ); serial.AddTransition(U9T.Stagger(staggerTime, parallelGroup.ToArray())); parallelGroup.Clear(); } return(serial); }
/// <summary> /// Creates a transition which disappears the block and spawns a score label in its place, which will itself disappear after some time. /// </summary> /// <returns>The disappear transition.</returns> /// <param name="score">Score.</param> public U9Transition CreateDisappearTransition(int score) { U9Transition scorePopupTransition = null; //U9Transition blockDisappearTransition = U9T.HOT (iTween.ScaleTo, squareSprite.gameObject, iTween.Hash ("scale", Vector3.zero, "time", 0.25f, "easetype", iTween.EaseType.easeInOutQuad )); //U9Transition bDT = U9T.HOT (HOTween.To, Scaling, 0.25f, new TweenParms().Prop("localScale", Vector3.zero, false).Ease(EaseType.EaseInOutQuad)); U9Transition bDLT = U9T.LT(LeanTween.scale, squareGO, Vector3.zero, 0.25f, iTween.Hash("ease", LeanTweenType.easeInOutQuad)); if (score > 0) { /*GameObject popupScoreInstance = (GameObject)Instantiate(scorePrefab[score-3], transform.position, Quaternion.identity); * popupScoreInstance.transform.parent = transform; * popupScoreInstance.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); * * int materialIn = 5*(score-3); * for(int i = materialIn; i < 5 + materialIn; i++) * { * if(scoreMaterial[i].color == color) * { * Color newColor = new Color(scoreMaterial[i].color.r, scoreMaterial[i].color.g, scoreMaterial[i].color.b, 0); * popupScoreInstance.renderer.material.color = newColor; * break; * } * } * * U9Transition ScaleIn = U9T.LT (LeanTween.scale, popupScoreInstance, new Vector3(53f, 53f, 53f), 1f, iTween.Hash("ease", LeanTweenType.linear)); * U9Transition FadeIn = U9T.HOT (HOTween.To, popupScoreInstance.renderer.material, 0.35f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 1), false).Ease(EaseType.EaseInOutQuad)); * U9Transition FadeOut = U9T.HOT (HOTween.To, popupScoreInstance.renderer.material, 0.55f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 0), false).Ease(EaseType.EaseInOutQuad).Delay(0.65f)); * * ScaleIn.Begin(); * FadeIn.Begin(); * FadeOut.Begin();*/ PopupScoreLabel popupScoreLabelInstance = (PopupScoreLabel)Instantiate(popupScoreLabelPrefab, transform.position, Quaternion.identity); popupScoreLabelInstance.transform.parent = transform; popupScoreLabelInstance.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); popupScoreLabelInstance.Score = score; Color c = new Color(color.r, color.g, color.b, 0); popupScoreLabelInstance.Color = c; U9Transition ScaleIn = U9T.LT(LeanTween.scale, popupScoreLabelInstance.gameObject, new Vector3(0.6f, 0.6f, 0.6f), 1f, iTween.Hash("ease", LeanTweenType.linear)); U9Transition FadeIn = U9T.HOT(HOTween.To, popupScoreLabelInstance.GetComponent <UILabel>(), 0.35f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 1), false).Ease(EaseType.EaseInOutQuad)); U9Transition FadeOut = U9T.HOT(HOTween.To, popupScoreLabelInstance.GetComponent <UILabel>(), 0.55f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 0), false).Ease(EaseType.EaseInOutQuad).Delay(0.65f)); ScaleIn.Begin(); FadeIn.Begin(); FadeOut.Begin(); //U9Transition FadeIn = U9T.LT (LeanTween.alpha, popupScoreLabelInstance, 1.0f, 0.35f, iTween.Hash("ease", LeanTweenType.easeInCubic)); Destroy(popupScoreLabelInstance, 5.0f); } bDLT.Ended += (transition) => { Destroy(gameObject, 4.0f); }; return(new InstantTransition(U9T.S(bDLT))); }
public void SetValue(T newValue) { U9Transition[] transitions; SetValue(newValue, out transitions); U9T.PrioritySequence(transitions).Begin(); }
/// <summary> /// Creates a transition that hifts all of the blocks on the board away from the given edge. /// Note that this must be done in a specific order - blocks that are furthest away from the /// given edge must be shifted first or blocks will be blocked by other blocks that have yet /// to move out of the way /// </summary> /// <returns>The shift blocks transition.</returns> /// <param name="edge">Edge.</param> U9Transition CreateShiftBlocksTransition(Edge edge) { List <U9Transition> transitions = new List <U9Transition> (); switch (edge) { case Edge.Top: for (int i = 1, ni = gridSize - 1; i < ni; i++) { for (int j = 1, nj = gridSize - 1; j < nj; j++) { transitions.Add(CreateShiftBlockTransition(i, j, edge)); } } for (int i = 1, ni = gridSize - 1; i < ni; i++) { transitions.Add(CreateShiftBlockTransition(i, gridSize - 1, edge)); } break; case Edge.Bottom: for (int i = 1, ni = gridSize - 1; i < ni; i++) { for (int j = gridSize - 2; j > 0; j--) { transitions.Add(CreateShiftBlockTransition(i, j, edge)); } } for (int i = 1, ni = gridSize - 1; i < ni; i++) { transitions.Add(CreateShiftBlockTransition(i, 0, edge)); } break; case Edge.Left: for (int i = gridSize - 2; i > 0; i--) { for (int j = 1, nj = gridSize - 1; j < nj; j++) { transitions.Add(CreateShiftBlockTransition(i, j, edge)); } } for (int i = 1, ni = gridSize - 1; i < ni; i++) { transitions.Add(CreateShiftBlockTransition(0, i, edge)); } break; case Edge.Right: for (int i = 1, ni = gridSize - 1; i < ni; i++) { for (int j = 1, nj = gridSize - 1; j < nj; j++) { transitions.Add(CreateShiftBlockTransition(i, j, edge)); } } for (int i = 1, ni = gridSize - 1; i < ni; i++) { transitions.Add(CreateShiftBlockTransition(gridSize - 1, i, edge)); } break; } float staggerTime = 0.001f; //0.5f; staggerTime = staggerTime / transitions.Count; return(U9T.Stagger(staggerTime, transitions.ToArray())); //return U9T.P (transitions.ToArray ()); }
/// <summary> /// Creates a transition which shifts blocks away from the given edge, checks for any matched blocks, and triggers game over if the board is full. /// </summary> /// <returns>The shift blocks transition.</returns> /// <param name="edge">Edge.</param> public U9Transition CreatePlayerMoveTransition(Edge edge) { if (_IntroLogo != null) { MoveIntro(edge); } for (int i = 1, ni = gridSize - 1; i < ni; i++) { for (int j = 1, nj = gridSize - 1; j < nj; j++) { Block b = blocks [i, j]; } } newScoreView.GetHideTransition().Begin(); highScoreView.GetHideTransition().Begin(); // If already gameover then ignore this request and return a null transition. if (gameIsOver) { RestartGame(false); } // If the intro is displaying then hide it. if (introView != null && introView.IsDisplaying) { introView.GetHideTransition().Begin(); } U9Transition t = U9T.P(CreateShiftBlocksTransition(edge)); // After the player move transition, if the game is over then start a new game, otherwise spawn blocks on the side that was just shifted t.Ended += (transition) => { U9Transition d = CreateMatchesTransition(); U9Transition gameOver = IsGameOver() ? CreateGameOverTransition() : null; if (gameOver != null) { gameOver.Ended += (transitionOver) => { if (gameIsOver) { if (Platform == Platform.Web) { Application.ExternalCall("SetHighScore", HighScore); Application.ExternalCall("GameOver"); } //!!! haxForSideBlocksNotSpawningInCorrectNumber = true; //!!! score = 0; scoresToAdd = 0; newScore = 0; _Timer = 0; StartGame(); currentScoreLabel.text = "0"; _ECurrentView = View.Game; } }; gameOver.Begin(); } else { if (d != null) { d.Begin(); } SpawnBlocks(edge); } }; return(t); }
/// <summary> /// Spawns new blocks on the specified side /// </summary> /// <param name="side">Side.</param> void SpawnBlocks(Edge edge) { // Create a list of possible spawn points List <int> possibleSpawnPoints = new List <int> (); int numEdgeSpawnsRequired = numberOfEdgeSpawns; if (haxForSideBlocksNotSpawningInCorrectNumber == false) { #region What should be done switch (edge) { case Edge.Top: for (int i = 1, ni = gridSize - 1; i < ni; i++) { if (blocks [i, gridSize - 1]) { numEdgeSpawnsRequired--; } else { possibleSpawnPoints.Add(i); } } break; case Edge.Bottom: for (int i = 1, ni = gridSize - 1; i < ni; i++) { if (blocks [i, 0]) { numEdgeSpawnsRequired--; } else { possibleSpawnPoints.Add(i); } } break; case Edge.Left: for (int i = 1, ni = gridSize - 1; i < ni; i++) { if (blocks [0, i]) { numEdgeSpawnsRequired--; } else { possibleSpawnPoints.Add(i); } } break; case Edge.Right: for (int i = 1, ni = gridSize - 1; i < ni; i++) { if (blocks [gridSize - 1, i]) { numEdgeSpawnsRequired--; } else { possibleSpawnPoints.Add(i); } } break; } #endregion } else { #region What i am forced to do... for (int i = 1, ni = gridSize - 1; i < ni; i++) { possibleSpawnPoints.Add(i); } #endregion } // Select a subset of spawn points from the list of possible spawns. List <int> spawnPoints = GetRandomSubset <int> (possibleSpawnPoints, numEdgeSpawnsRequired); // Create a list of transitions for each of the spawns List <U9Transition> transitions = new List <U9Transition> (); switch (edge) { case Edge.Top: for (int i = 0, ni = spawnPoints.Count; i < ni; i++) { transitions.Add(SpawnBlock(spawnPoints [i], gridSize - 1)); } break; case Edge.Bottom: for (int i = 0, ni = spawnPoints.Count; i < ni; i++) { transitions.Add(SpawnBlock(spawnPoints [i], 0)); } break; case Edge.Left: for (int i = 0, ni = spawnPoints.Count; i < ni; i++) { transitions.Add(SpawnBlock(0, spawnPoints [i])); } break; case Edge.Right: for (int i = 0, ni = spawnPoints.Count; i < ni; i++) { transitions.Add(SpawnBlock(gridSize - 1, spawnPoints [i])); } break; } U9T.P(transitions.ToArray()).Begin(); }
protected override U9Transition CreateHideTransition(bool force) { return(U9T.T(iTween.ScaleTo, gameObject, iTween.Hash("scale", hideScale, "time", transitionDuration, "easetype", transitionEaseType, "ignoretimescale", ignoreTimeScale))); }
protected override U9Transition CreateHideTransition(bool force) { return(U9T.T(iTween.MoveTo, gameObject, iTween.Hash("position", displayPosition + hideOffset, "isLocal", true, "easetype", transitionEaseType, "time", transitionDuration, "ignoretimescale", ignoreTimeScale))); }
/// <summary> /// Returns a transiton that animates and removes blocks, and grants a score for them /// </summary> /// <returns>The matches transition.</returns> U9Transition CreateMatchesTransition() { List <U9Transition> transitions = new List <U9Transition> (); newScore = Score; //layer (14-9) int layer = 14; // For every block in the grid that is not on an edge for (int i = 1, ni = gridSize - 1; i < ni; i++) { for (int j = 1, nj = gridSize - 1; j < nj; j++) { Block b = blocks [i, j]; if (b) { List <Block> matchingBlocks = FindAdjacentMatchingBlocks(b.Color, i, j); if (matchingBlocks.Count >= 3) { // The player receives score for each block, equal to the number of blocks matched int tScore = matchingBlocks.Count; newScore += tScore * tScore; GameObject onScore = (GameObject)Instantiate(_OnScore, matchingBlocks[matchingBlocks.Count / 2].transform.position, Quaternion.identity); OnScoreTransition onT = onScore.GetComponent <OnScoreTransition>(); //!! transitions.Add(onT.CreateOnScoreTransition(matchingBlocks, layer, tScore)); // Add transitions to dissapear all matching blocks and display the score per block in their place foreach (Block m in matchingBlocks) { blocks [m.I, m.J] = null; m.gameObject.layer = layer; GameObject BB = GetBackgroundBlock(m); if (BB != null) { BB.gameObject.layer = layer; } } layer--; } // Reset all blocks so that they can be checked again ResetCheckedForMatchesFlags(); } } } // Creates a stagger transition so that each subsequent match has a slight delay if (transitions.Count > 0) { U9Transition t = U9T.P(transitions.ToArray()); // Only update the score once all animations are completed t.Ended += (transition) => { Score = newScore; if (Platform == Platform.Web) { Application.ExternalCall("ScoreUpdate", Score); } }; return(t); } return(null); }