private void Start()
 {
     hearts         = new Image[transform.childCount];
     hearts         = FindHearts();
     matchManager   = transform.root.Find(GAME_MANAGER).GetComponent <MatchManagerScript>();
     winLoseManager = transform.root.Find(GAME_MANAGER).GetComponent <WinLoseManager>();
 }
 //In the beginning we will set up player with full health & update UI
 void Start()
 {
     myWinLoseManager = WinLoseManager.winLoseManager;
     myPlayerCanvasAnimationmanager = this.GetComponentInChildren<PlayerCanvasAnimationManager>();
     myPlayerAnimationmanager = this.GetComponent<PlayerAnimationManager>();
     mySprite = this.GetComponent<SpriteRenderer>();
     currentLife = maxLife;
     UpdateUI();
 }
Exemple #3
0
 //On awake, we make sure this is the only WinLose manager around.
 private void Awake()
 {
     if (winLoseManager == null)
     {
         winLoseManager = this;
         UnpauseGame();
     }
     else
         Destroy(this.gameObject);
 }
Exemple #4
0
 public virtual void Start()
 {
     //load the tokens, make the grid, and create references to the other scripts
     tokenTypes        = (UnityEngine.Object[])Resources.LoadAll("Tokens/");
     dummySprites      = Resources.LoadAll <Sprite>("Sprites/Dummy sprites");
     gridArray         = new GameObject[gridWidth, gridHeight];
     matchManager      = GetComponent <MatchManagerScript>();
     inputManager      = GetComponent <InputManagerScript>();
     repopulateManager = GetComponent <RepopulateScript>();
     moveTokenManager  = GetComponent <MoveTokensScript>();
     scoreManager      = transform.root.Find("Score canvas").Find("Score").GetComponent <ScoreManager>();
     stringGraphic     = Resources.Load("String") as GameObject;
     MakeGrid();
     ChangeGridDuplicates();
     SceneManager.LoadScene(INSTRUCTION_SCENE_NAME, LoadSceneMode.Additive);
     winLoseManager     = GetComponent <WinLoseManager>();
     chordsRemaining    = transform.root.Find(SCORE_CANVAS).Find(CHORDS_REMAINING).GetComponent <Text>();
     ChordsPlayed       = 0;   //set the text correctly at the start of the game
     scoreRequired      = transform.root.Find(SCORE_CANVAS).Find(SCORE_REQUIRED).GetComponent <Text>();
     scoreRequired.text = winLoseManager.ScoreToWin + " to win";
 }
 // Use this for initialization
 void Start()
 {
     HitPoints = BASE_HITPOINTS;
     winLoss = GameObject.FindGameObjectWithTag("WinLossManager").GetComponent<WinLoseManager>();
 }
Exemple #6
0
    public static int elementsCnt = 0;                  //overall useful generated elements

    void Start()
    {
        DataCenter.LoadData();

        ui      = GameObject.FindObjectOfType <UIController>();
        winlose = GameObject.FindObjectOfType <WinLoseManager>();

        ElementBehaviour.elementsUsed = 0;
        PowerElement.enabledSources   = 0;
        elementsCnt = 0;

        CreateInitialPowersource();
        CreateInitialPowersource();
        CreateInitialPowersource();

        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                if (elements[i, j] != null)
                {
                    elementsCnt++;
                    elements[i, j].transform.Rotate(0f, 0f, 90f * Random.Range(0, 4), Space.Self);                              //randomly rotate all elements
                }
                else
                {
                    //generate junk
                    GenerateElementAtPosition(i, j);
                    elements[i, j].transform.Rotate(0f, 0f, 90f * Random.Range(0, 4), Space.Self);                              //randomly rotate all elements
                }
            }
        }

        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                if (elements[i, j] != null)
                {
                    elements[i, j].FindConnectionPoints();
                    elements[i, j].winlose = winlose;
                    elements[i, j].ui      = ui;
                }
            }
        }

        ElementBehaviour.FindElements();
        ElementBehaviour.FindPowerElements();

        if (ui.isClassicMode)
        {
            DataCenter.classic.lvlnumber++;
        }
        else
        {
            DataCenter.timeattack.lvlnumber++;
        }
        DataCenter.SaveData();
        ui.LevelNumber();
        if (!ui.isClassicMode)
        {
            ui.TimeToPlay();
            ui.timerIsGoing = true;
        }
    }
Exemple #7
0
 private void Start()
 {
     myWinLoseManager = WinLoseManager.winLoseManager;
 }