Пример #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!turnManager.combatActive && planetState && collision.gameObject.tag == "Planet" && movementController.ClickCellPosition == gridLayout.WorldToCell(transform.position))
        {
            currentPlanet = collision.gameObject;
            uiController.ActivateLandOnPlanet(); //When over a planet, display the "Land" contextutal prompt
            if (mapManager.saveName == "TutorialFile")
            {
                tutorialManager.ExplainMining(collision.name);
            }
            switch (collision.name) //Determine what planet scene to load based on the name of the game object returned from the collision
            {
            case "Planet1(Clone)":
                Debug.Log("Planet1");
                planetName           = "Planet1";
                planetResourceAmount = Random.Range(100, 200);
                //loadingIndex = 2;
                break;

            case "Planet2(Clone)":
                Debug.Log("Planet2");
                planetName           = "Planet2";
                planetResourceAmount = Random.Range(150, 250);
                //loadingIndex = 3;
                break;

            case "Planet3(Clone)":
                Debug.Log("Planet3");
                planetName           = "Planet3";
                planetResourceAmount = Random.Range(150, 300);
                //loadingIndex = 4;
                break;

            case "Planet4(Clone)":
                Debug.Log("Planet4");
                planetName           = "Planet4";
                planetResourceAmount = Random.Range(200, 400);
                //loadingIndex = 4;
                break;

            case "Planet5(Clone)":
                Debug.Log("Planet5");
                planetName           = "Planet5";
                planetResourceAmount = Random.Range(250, 500);
                //loadingIndex = 4;
                break;

            case "Planet6(Clone)":
                Debug.Log("Planet6");
                planetName           = "Planet6";
                planetResourceAmount = Random.Range(250, 550);
                //loadingIndex = 4;
                break;

            case "Planet7(Clone)":
                Debug.Log("Planet7");
                planetName           = "Planet7";
                planetResourceAmount = Random.Range(350, 600);
                //loadingIndex = 4;
                break;

            case "Planet8(Clone)":
                Debug.Log("Planet8");
                planetName           = "Planet8";
                planetResourceAmount = Random.Range(350, 800);
                //loadingIndex = 4;
                break;

            case "Planet9(Clone)":
                Debug.Log("Planet9");
                planetName           = "Planet9";
                planetResourceAmount = Random.Range(350, 850);
                //loadingIndex = 4;
                break;

            case "Planet10(Clone)":
                Debug.Log("Planet10");
                planetName           = "Planet10";
                planetResourceAmount = Random.Range(800, 1000);
                //loadingIndex = 4;
                break;

            case "Planet0(Clone)":
                Debug.Log("Planet0");
                planetName           = "Planet0";
                planetResourceAmount = Random.Range(100, 800);
                //loadingIndex = 4;
                break;
            }
        }
        //gameController.levelIndex = loadingIndex; //load the correct scene based on the index of the given planet
    }