コード例 #1
0
        private void OnPossibleMoveFound(GemController sender, GemController[] participants, GemController key, Line direction)
        {
            foreach (PossibleMove pm in PossibleMoves)
            {
                if (pm.GetHashCode() == MatchUtils.CalculateHash(new int[] { key.Position.x, key.Position.y, sender.Position.x, sender.Position.y }))
                {
                    return;
                }
            }
            List <GemController> participantsList = new List <GemController>();

            foreach (GemController participant in participants)
            {
                PossibleMatch participantPossibleMatch = participant.GetPossibleMatchByDirection(direction);
                if (participantPossibleMatch != null && !participantPossibleMatch.IsMatch())
                {
                    participantsList.AddRange(participantPossibleMatch.MatchedGems);
                }
                else
                {
                    participantsList.Add(participant);
                }
            }
            PossibleMove possibleMove = new PossibleMove(participantsList, key, sender.Position, direction);

            possibleMove.OnOver += PossibleMove_OnOver;
            possibleMoves.Add(possibleMove);

            if (OnPossibleMoveCreate != null)
            {
                OnPossibleMoveCreate(possibleMove);
            }
        }
コード例 #2
0
 private void PossibleMove_OnOver(PossibleMove sender)
 {
     possibleMoves.Remove(sender);
 }
コード例 #3
0
ファイル: GemController.cs プロジェクト: prides/match3-core
 internal void RemovePossibleMove(PossibleMove possibleMove, PossibleMove.Role role)
 {
     possibleMoves[role].Remove(possibleMove);
 }
コード例 #4
0
ファイル: GemController.cs プロジェクト: prides/match3-core
 internal void AddPossibleMove(PossibleMove possibleMove, PossibleMove.Role role)
 {
     possibleMoves[role].Add(possibleMove);
 }