示例#1
0
    void Start()
    {
        myRenderer     = GameObject.Find("Canvas/PlayerOne(Clone)/GunBarrel");
        hideStarsPanel = levelCompletedPanel.transform.FindChild("IgnoreStarsPanel").gameObject;

        if (hideStarsPanel == null)
        {
            Debug.LogError("No ignore stars panel attached to the level complete panel.");
        }

        nextLevelButton = levelCompletedPanel.transform.FindChild("NextLevel").gameObject;

        levelCompletedPanel.SetActive(false);
        ionPlacement = GameObject.Find("GameManager").GetComponent <IonPlacement>();
        gameManager  = GameObject.Find("GameManager");
        if (gameManager == null)
        {
            Debug.LogError("No game manager found");
        }

        ionTracker = gameManager.GetComponent <IonTrackerScript>();

        triesText.text = "Attempts: " + tries;      //Change the text at the start to make sure it says the correct text.S

        if (LevelSelect.staticStarsNeeded != null)
        {
            int scene = SceneManager.GetActiveScene().buildIndex;
            starsNeededToCont = LevelSelect.staticStarsNeeded[scene];
        }
        availablePositiveIons = ionPlacement.availablePositiveIons;
        availableNegativeIons = ionPlacement.availableNegativeIons;
    }
    //Utilícelo para la inicialización
    void Start()
    {
        myIons = GameObject.Find("GameManager").GetComponent <IonPlacement>();

        if (myIons == null)
        {
            Debug.LogError("There are no \"ion placement\" attached to GameManager");
        }

        //encontrar todos los textos
        negatives = GameObject.Find("Canvas/IonTrackers/Negatives").GetComponent <Text>();
        positives = GameObject.Find("Canvas/IonTrackers/Positives").GetComponent <Text>();

        if (myIons.cannotPlaceNegative)
        {
            negatives.gameObject.SetActive(false);
        }

        if (myIons.cannotPlacePositive)
        {
            positives.gameObject.SetActive(false);
        }

        myScore = GameObject.Find("GameManager").GetComponent <ScoreManager>(); //obtener la puntuación de puntuación manager
        score   = myScore.levelCompletedPanel.transform.FindChild("Score").GetComponent <Text>();

        //  para evitar que el texto null
        negatives.text = "Negatives Ions: " + IonPlacement.activeNegativeIons.Count;
        positives.text = "Positives Ions: " + IonPlacement.activePositiveIons.Count;
        score.text     = "Points: " + points.ToString();

        ScoreTracker();
    }
示例#3
0
 // Use this for initialization
 void Start()
 {
     canvas = GameObject.Find("Canvas");
     // preplacedObj = canvas.transform.FindChild("PreplacedObj").gameObject;
     scoreManager = GameObject.Find("GameManager").GetComponent <ScoreManager>();
     ionPlacement = GameObject.Find("GameManager").GetComponent <IonPlacement>();
 }
示例#4
0
 void Start()
 {
     isFinished = false;
     canvas     = GameObject.Find("Canvas");
     if (PlayerManager.numberOfPlayers == 1)
     {
         attempts     = GameObject.Find("Attempts/Time").GetComponent <Attempts>(); //References the scoreManager
         ionPlacement = gameObject.GetComponentInChildren <IonPlacement>();
         origPosIon   = ionPlacement.cannotPlacePositive;                           // What is it set to originally?
         origNegIon   = ionPlacement.cannotPlaceNegative;
     }
     p1CanShoot = true;
     p2CanShoot = true;
     renderers  = new List <GameObject>();
 }