예제 #1
0
    //make sure that all the canvase are in the correct state and transparency setting
    private void Awake()
    {
        Manager = GameObject.FindGameObjectWithTag("manager");
        if (Manager != null)
        {
            movingManager = Manager.GetComponent <MovingManager>();
            swiping       = Manager.GetComponent <SwipeEventManager>();
        }

        swiping.enabled = false;

        if (Play != null)
        {
            PlayCG = Play.GetComponent <CanvasGroup>();
            if (PlayCG.alpha != 1)
            {
                PlayCG.alpha = 1;
            }

            Play.SetActive(true);
            PlayCG.interactable   = true;
            PlayCG.blocksRaycasts = true;
        }

        if (Resume != null)
        {
            ResumeCG = Resume.GetComponent <CanvasGroup>();
            if (ResumeCG.alpha != 0)
            {
                ResumeCG.alpha = 0;
            }

            Resume.SetActive(true);
            ResumeCG.interactable   = false;
            ResumeCG.blocksRaycasts = false;
        }

        if (YouLose != null)
        {
            YouLoseCG = YouLose.GetComponent <CanvasGroup>();
            if (YouLoseCG.alpha != 0)
            {
                YouLoseCG.alpha = 0;
            }

            YouLose.SetActive(false);
        }

        if (YouWin != null)
        {
            YouWinCG = YouWin.GetComponent <CanvasGroup>();
            if (YouWinCG.alpha != 0)
            {
                YouWinCG.alpha = 0;
            }

            YouWin.SetActive(false);
        }
    }
예제 #2
0
    private void Awake()
    {
        Manager = GameObject.FindGameObjectWithTag("manager");
        if (Manager != null)
        {
            swipeEventManager = Manager.GetComponent <SwipeEventManager>();
        }

        SwipeSpeed = swipeEventManager.swipeDist;

        SpawnLocation = this.transform;
    }
예제 #3
0
    private void Awake()
    {
        //check that the manager exists
        Manager = GameObject.FindGameObjectWithTag("manager");
        if (Manager != null)
        {
            playerAnimation   = Manager.GetComponent <PlayerAnimation>();
            uiManager         = Manager.GetComponent <UIManager>();
            swipeEventManager = Manager.GetComponent <SwipeEventManager>();
        }

        //find all tiles and order them alphabetically
        Tiles = GameObject.FindGameObjectsWithTag("tile").OrderBy(go => go.name).ToArray();
        if (GameObject.FindGameObjectsWithTag("tile").Length == 0)
        {
            Debug.LogError(Tiles + " " + "were not found");
        }

        //find player & cpu
        PlayerOne = GameObject.FindGameObjectWithTag("Player");
        PlayerTwo = GameObject.FindGameObjectWithTag("cpu");

        //move the players to the start
        if (PlayerOne != null)
        {
            PlayerOne.transform.DOMove(Tiles[0].transform.position, 0);
        }
        else
        {
            return;
        }

        if (PlayerTwo != null)
        {
            PlayerTwo.transform.DOMove(Tiles[0].transform.position, 0);
        }
        else
        {
            return;
        }

        //check if the text exist and grab the CG reference
        if (YourTurn != null)
        {
            YourTurnCG = YourTurn.GetComponent <CanvasGroup>();
        }
    }