コード例 #1
0
    void CheckHexNextDestroyGem(GemController.Direction direction, Vector2 aroundGemPos, Color color)
    {
        Collider2D candidateNext;

        if (direction.Equals(GemController.Direction.UP))
        {
            candidateNext = Physics2D.OverlapBox(new Vector2(aroundGemPos.x, aroundGemPos.y + 0.7f), new Vector2(0.5f, 0.5f), 0);
            CandidateNextAddDestory(candidateNext, direction, color);
        }
        else if (direction.Equals(GemController.Direction.DOWN))
        {
            candidateNext = Physics2D.OverlapBox(new Vector2(aroundGemPos.x, aroundGemPos.y - 0.7f), new Vector2(0.5f, 0.5f), 0);
            CandidateNextAddDestory(candidateNext, direction, color);
        }
        else if (direction.Equals(GemController.Direction.LEFTDOWN))
        {
            candidateNext = Physics2D.OverlapBox(new Vector2(aroundGemPos.x - 0.6f, aroundGemPos.y - 0.3f), new Vector2(0.5f, 0.5f), 0);
            CandidateNextAddDestory(candidateNext, direction, color);
        }
        else if (direction.Equals(GemController.Direction.LEFTUP))
        {
            candidateNext = Physics2D.OverlapBox(new Vector2(aroundGemPos.x - 0.6f, aroundGemPos.y + 0.3f), new Vector2(0.5f, 0.5f), 0);
            CandidateNextAddDestory(candidateNext, direction, color);
        }
        else if (direction.Equals(GemController.Direction.RIGHTDOWN))
        {
            candidateNext = Physics2D.OverlapBox(new Vector2(aroundGemPos.x + 0.6f, aroundGemPos.y - 0.3f), new Vector2(0, 0), 0);
            CandidateNextAddDestory(candidateNext, direction, color);
        }
        else if (direction.Equals(GemController.Direction.RIGHTUP))
        {
            candidateNext = Physics2D.OverlapBox(new Vector2(aroundGemPos.x + 0.6f, aroundGemPos.y + 0.3f), new Vector2(0, 0), 0);
            CandidateNextAddDestory(candidateNext, direction, color);
        }
    }
コード例 #2
0
 void CheckHexDestroyGem(GemController.Direction direction, GemController candidatesEqualsColor)
 {
     if (direction.Equals(GemController.Direction.DOWN))
     {
         foreach (GemController candidatesEqualsColorNext in candidatesEqualsColors)
         {
             if (candidatesEqualsColorNext._Direction.Equals(GemController.Direction.UP))
             {
                 destroyGems.Add(candidatesEqualsColorNext);
                 destroyGems.Add(candidatesEqualsColor);
             }
         }
     }
     else if (direction.Equals(GemController.Direction.LEFTDOWN))
     {
         foreach (GemController candidatesEqualsColorNext in candidatesEqualsColors)
         {
             if (candidatesEqualsColorNext._Direction.Equals(GemController.Direction.RIGHTUP))
             {
                 destroyGems.Add(candidatesEqualsColorNext);
                 destroyGems.Add(candidatesEqualsColor);
             }
         }
     }
     else if (direction.Equals(GemController.Direction.LEFTUP))
     {
         foreach (GemController candidatesEqualsColorNext in candidatesEqualsColors)
         {
             if (candidatesEqualsColorNext._Direction.Equals(GemController.Direction.RIGHTDOWN))
             {
                 destroyGems.Add(candidatesEqualsColorNext);
                 destroyGems.Add(candidatesEqualsColor);
             }
         }
     }
 }