public void OnConnected(PuzzleCharacter character, PuzzleCharacter firstCharacter, List <Vector2Int> connectionPoints, string targetCharId) { Debug.Log("OnConnected: " + character.Position); var characterNode = this.FindCharacterNode(character); if (characterNode == null) { Debug.LogWarning("characterNode is null."); } var firstCharacterNode = this.FindCharacterNode(firstCharacter); if (firstCharacterNode == null) { Debug.LogWarning("firstCharacterNode is null."); } FormulaDefinition formula = this.StageDefinition.FindFormula(character.CharacterId, firstCharacter.CharacterId); if (formula == null) { return; } var activityManager = gameObject.GetComponentInParent <MainGameScene>().AquireActivityManager(); PlayAnimationMergeChars(activityManager, characterNode, firstCharacterNode, connectionPoints); if (poemInstance.GetCoveredCharIds().Contains(formula.Target)) { int charIndex = poemInstance.GetFirstCoveredIndex(formula.Target); } if (this.onReceivedCharacter != null) { activityManager.PushCallback(() => { this.onReceivedCharacter(this, new ReceivedCharEventArgs(formula.Target, activityManager)); }); } activityManager.PushCallback(() => { CheckAndMakeShuffle(); }); }
private void PuzzleBoardRenderer_onReceivedCharacter(object sender, ReceivedCharEventArgs e) { Debug.Log("PuzzleBoardRenderer_onReceivedCharacter"); var renderer = revealedChar.GetComponent <SpriteRenderer>(); var sprite = GlobalStorage.GetSpriteFromDictionary(e.CharacterId); if (sprite != null) { renderer.sprite = sprite; } var clr = revealedChar.GetComponent <SpriteRenderer>().color; revealedChar.GetComponent <SpriteRenderer>().color = new Color(clr.r, clr.g, clr.b, 0.0f); ShowRevealedCharActivity showRevealed = new ShowRevealedCharActivity(revealedChar, 1.0f); e.ActivityManager.PushActivity(showRevealed); if (poem.GetCoveredCharIds().Contains(e.CharacterId)) { int charIndex = poem.GetFirstCoveredIndex(e.CharacterId); if (charIndex < 0) { return; } var hintBoardRenderer = this.HintBoard.GetComponent <HintBoardRenderer>(); hintBoardRenderer.ReceiveCharacter(e.CharacterId, e.ActivityManager); } if (poem.IsAllCharactersUncovered()) { // Success e.ActivityManager.PushCallback(() => { this.OnGameWin(); }); } }