Beispiel #1
0
 public void FlipTile() //When you press A after opening the flip grid
 {
     if (selectedTile)
     {
         playerControlsManager.ToggleOnGenericUI();
         currentTile = groundTilemap.GetTile(new Vector3Int((int)(selectedTile.transform.position.x - 0.5f), (int)(selectedTile.transform.position.y - 0.5f), (int)selectedTile.transform.position.z)) as GroundTile;
         if (currentTile)
         {
             //darkOverlayObject = Instantiate(darkOverlayPrefab, transform);
             encounterManager.TestGroundType(currentTile.groundType, selectedTile, false);
         }
         else
         {
             GameObject colliding = testTrigger.GetCollidingGameObject();
             if (testTrigger.GetCollidingTileableStatus())
             {
                 if (colliding.GetComponent <IInteractable>() != null)
                 {
                     colliding.GetComponent <IInteractable>().Interact();
                 }
                 GroundType tmpType = colliding.GetComponent <TTileable>().GetTileType();
                 //darkOverlayObject = Instantiate(darkOverlayPrefab, transform);
                 encounterManager.TestGroundType(tmpType, selectedTile, false);
             }
         }
     }
 }
    public void StartCleansing()
    {
        if (inFrontOfPlayerTrigger.GetCollidingTileableStatus())
        {
            GameObject colliding = inFrontOfPlayerTrigger.GetCollidingGameObject();

            if (colliding.GetComponent <CorruptionSource>() != null)
            {
                currentSource = colliding.GetComponent <CorruptionSource>();

                if (currentSource.GetNumberOfCheckpoints() == 3)
                {
                    checkpoints = currentSource.GetCheckpoints();

                    threeCheckpointBox = Instantiate(threeCheckpointBoxPrefab, overWorldCanvas.transform);

                    threeCheckpointBox.GetComponent <CorruptionBar>().onWaitForCheckpointAnimCallback += CheckpointEvent;
                    recentBackground = currentSource.GetBattleBackground();
                    threeCheckpointBox.GetComponent <CorruptionBar>().SetNrOfCheckpoints(checkpoints.Count);

                    for (int i = 0; i < checkpoints.Count; i++)
                    {
                        if (checkpoints[i].cleansed)
                        {
                            bool isLast = false;

                            if (i == checkpoints.Count - 1)
                            {
                                isLast = true;
                            }
                            threeCheckpointBox.GetComponent <CorruptionBar>().SetCheckpoints(i, GetOptionString(checkpoints[i].option), isLast);
                        }
                    }
                }

                else if (currentSource.GetNumberOfCheckpoints() == 5)
                {
                    checkpoints = currentSource.GetCheckpoints();

                    fiveCheckpointBox = Instantiate(fiveCheckpointBoxPrefab, overWorldCanvas.transform);

                    fiveCheckpointBox.GetComponent <CorruptionBar>().onWaitForCheckpointAnimCallback += CheckpointEvent;
                    recentBackground = currentSource.GetBattleBackground();
                    fiveCheckpointBox.GetComponent <CorruptionBar>().SetNrOfCheckpoints(checkpoints.Count);

                    for (int i = 0; i < checkpoints.Count; i++)
                    {
                        if (checkpoints[i].cleansed)
                        {
                            bool isLast = false;

                            if (i == checkpoints.Count - 1)
                            {
                                isLast = true;
                            }
                            fiveCheckpointBox.GetComponent <CorruptionBar>().SetCheckpoints(i, GetOptionString(checkpoints[i].option), isLast);
                        }
                    }
                }
            }
            else if (colliding.GetComponent <TileTreasure>() != null)
            {
                colliding.GetComponent <IInteractable>().Interact();
                StartCoroutine(WaitForFlipAnimGaia(colliding));
            }
            else if (colliding.GetComponent <MonsterTile>() != null)
            {
                StartCoroutine(WaitForFlipAnimMonster(colliding));
            }
        }
    }