コード例 #1
0
ファイル: MultiControl.cs プロジェクト: awall/bpc
 private void AddControls()
 {
     _addButton = new Button();
     Controls.Add(_addButton);
     _addButton.Text     = "+";
     _addButton.Size     = new Size(BUTTON_WIDTH, BUTTON_WIDTH);
     _addButton.Location = new Point(Width - _addButton.Width, 0);
     _addButton.Anchor   = AnchorStyles.Top | AnchorStyles.Right;
     _addButton.Click   += (o, e) => AddPortal?.Invoke();
 }
コード例 #2
0
ファイル: StartMenu.cs プロジェクト: StoRRica/Sn-c-ake
    // Use this for initialization
    void Start()
    {
        quitDialog      = quitDialog.GetComponent <Canvas>(); //assigned actual game object to variable
        aboutCanvas     = aboutCanvas.GetComponent <Canvas>();
        levelsCanvas    = levelsCanvas.GetComponent <Canvas>();
        controlsCanvas  = controlsCanvas.GetComponent <Canvas>();
        controls1Canvas = controls1Canvas.GetComponent <Canvas>();
        optionsCanvas   = optionsCanvas.GetComponent <Canvas>();
        menuCanvas      = menuCanvas.GetComponent <Canvas>();
        uiCanvas        = uiCanvas.GetComponent <Canvas>();
        gameOver        = gameOver.GetComponent <Canvas>();
        playButton      = playButton.GetComponent <Button>();
        continueButton  = continueButton.GetComponent <Button>();
        continueText    = continueText.GetComponent <Text>();
        exitButton      = exitButton.GetComponent <Button>();
        controlsButton  = controlsButton.GetComponent <Button>();
        optionsButton   = optionsButton.GetComponent <Button>();
        aboutButton     = aboutButton.GetComponent <Button>();
        levelsButton    = levelsButton.GetComponent <Button>();
        audioSource     = GetComponents <AudioSource>();
        musicSlider     = musicSlider.GetComponent <Slider>();
        soundSlider     = soundSlider.GetComponent <Slider>();

        snakeObject      = GameObject.FindGameObjectWithTag("Snake");
        snakeScript      = snakeObject.GetComponent <Snake>();
        backgroundObject = GameObject.FindGameObjectWithTag("Background");
        addPortalScript  = backgroundObject.GetComponent <AddPortal>();

        lock1  = lock1.GetComponent <Text>();
        level1 = level1.GetComponent <Button>();
        lock2  = lock2.GetComponent <Text>();
        level2 = level2.GetComponent <Button>();
        lock3  = lock3.GetComponent <Text>();
        level3 = level3.GetComponent <Button>();
        lock4  = lock4.GetComponent <Text>();
        level4 = level4.GetComponent <Button>();

        continueText.enabled    = false;
        continueButton.enabled  = false;
        quitDialog.enabled      = false;
        aboutCanvas.enabled     = false;
        controlsCanvas.enabled  = false;
        controls1Canvas.enabled = false;
        optionsCanvas.enabled   = false;
        uiCanvas.enabled        = false;
        gameOver.enabled        = false;
        levelsCanvas.enabled    = false;
    }
コード例 #3
0
ファイル: Snake.cs プロジェクト: StoRRica/Sn-c-ake
    void Start()
    {
        AddPortalSript.ForgetPortals();
        Loading.LoadLevels();
        background             = GameObject.FindGameObjectWithTag("Background");
        gamePausedText         = gamePausedText.GetComponent <Canvas>();
        gamePausedText.enabled = false;
        scoreText          = scoreText.GetComponent <Text>();
        gameOverScoreText  = gameOverScoreText.GetComponent <Text>();
        gameOverScreen     = gameOverScreen.GetComponent <Canvas>();
        AddPortalSript     = background.GetComponent <AddPortal>();
        eatSound           = eatSound.GetComponent <AudioSource>();
        eatSound.volume    = 0;
        fixedUpdateCounter = 0;
        obstacle           = new bool[numOfRows][];
        for (int i = 0; i < numOfRows; i++)
        {
            obstacle[i] = new bool[numOfColls];

            /*for (int j = 0; j < numOfColls;j++) {
             *  Debug.Log(i + "," + j + ":" + obstacle[i][j]);
             * }*/
        }
        forgetObstacles();
        tail.Add(initialBody.transform);
        tail.Add(initialTail.transform);
        initialBodyRotation = initialBody.transform.rotation;
        initialBodyPosition = initialBody.transform.position;
        initialTailPosition = initialTail.transform.position;
        initialTailRotation = initialTail.transform.rotation;
        initialHeadPosition = transform.position;
        initialHeadRotation = transform.rotation;
        //SpawnFood();
        ToggleAnimation(true);

        /*for (int xC = 0; xC < numOfRows; xC++)
         * {
         *  for (int yC = 0; yC < numOfColls; yC++)
         *  {
         *      Debug.Log("IS SAFE X = " + yC + " Y = " + xC + " ?: " + isSafeFoodPlant(yC, xC));
         *  }
         * }*/
    }
コード例 #4
0
ファイル: UserInterface.cs プロジェクト: StoRRica/Sn-c-ake
    void Start()
    {
        exitButton = exitButton.GetComponent<Button>();
        menuCanvas = menuCanvas.GetComponent<Canvas>();
        uiCanvas = uiCanvas.GetComponent<Canvas>();
        gamePausedCanvas = gamePausedCanvas.GetComponent<Canvas>();
        playButton = playButton.GetComponent<Button>();
        continueButton = continueButton.GetComponent<Button>();
        continueText = continueText.GetComponent<Text>();
        playText = playText.GetComponent<Text>();

        snakeObject = GameObject.FindGameObjectWithTag("Snake");
        snakeScript = snakeObject.GetComponent<Snake>();
        backgroundObject = GameObject.FindGameObjectWithTag("Background");
        addPortalScript = backgroundObject.GetComponent<AddPortal>();
        GameObject startmenu = GameObject.FindGameObjectWithTag("Startmenu");
        startMenuScript = startmenu.GetComponent<StartMenu>();

        uiCanvas.enabled = false;
    }
コード例 #5
0
ファイル: UserInterface.cs プロジェクト: StoRRica/Sn-c-ake
    void Start()
    {
        exitButton       = exitButton.GetComponent <Button>();
        menuCanvas       = menuCanvas.GetComponent <Canvas>();
        uiCanvas         = uiCanvas.GetComponent <Canvas>();
        gamePausedCanvas = gamePausedCanvas.GetComponent <Canvas>();
        playButton       = playButton.GetComponent <Button>();
        continueButton   = continueButton.GetComponent <Button>();
        continueText     = continueText.GetComponent <Text>();
        playText         = playText.GetComponent <Text>();

        snakeObject      = GameObject.FindGameObjectWithTag("Snake");
        snakeScript      = snakeObject.GetComponent <Snake>();
        backgroundObject = GameObject.FindGameObjectWithTag("Background");
        addPortalScript  = backgroundObject.GetComponent <AddPortal>();
        GameObject startmenu = GameObject.FindGameObjectWithTag("Startmenu");

        startMenuScript = startmenu.GetComponent <StartMenu>();

        uiCanvas.enabled = false;
    }
コード例 #6
0
ファイル: StartMenu.cs プロジェクト: StoRRica/Sn-c-ake
    // Use this for initialization
    void Start()
    {
        quitDialog = quitDialog.GetComponent<Canvas>(); //assigned actual game object to variable
        aboutCanvas = aboutCanvas.GetComponent<Canvas>();
        levelsCanvas = levelsCanvas.GetComponent<Canvas>();
        controlsCanvas = controlsCanvas.GetComponent<Canvas>();
        controls1Canvas = controls1Canvas.GetComponent<Canvas>();
        optionsCanvas = optionsCanvas.GetComponent<Canvas>();
        menuCanvas = menuCanvas.GetComponent<Canvas>();
        uiCanvas = uiCanvas.GetComponent<Canvas>();
        gameOver = gameOver.GetComponent<Canvas>();
        playButton = playButton.GetComponent<Button>();
        continueButton = continueButton.GetComponent<Button>();
        continueText = continueText.GetComponent<Text>();
        exitButton = exitButton.GetComponent<Button>();
        controlsButton = controlsButton.GetComponent<Button>();
        optionsButton = optionsButton.GetComponent<Button>();
        aboutButton = aboutButton.GetComponent<Button>();
        levelsButton = levelsButton.GetComponent<Button>();
        audioSource = GetComponents<AudioSource>();
        musicSlider = musicSlider.GetComponent<Slider>();
        soundSlider = soundSlider.GetComponent<Slider>();

        snakeObject = GameObject.FindGameObjectWithTag("Snake");
        snakeScript = snakeObject.GetComponent<Snake>();
        backgroundObject = GameObject.FindGameObjectWithTag("Background");
        addPortalScript = backgroundObject.GetComponent<AddPortal>();

        lock1 = lock1.GetComponent<Text>();
        level1 = level1.GetComponent<Button>();
        lock2 = lock2.GetComponent<Text>();
        level2 = level2.GetComponent<Button>();
        lock3 = lock3.GetComponent<Text>();
        level3 = level3.GetComponent<Button>();
        lock4 = lock4.GetComponent<Text>();
        level4 = level4.GetComponent<Button>();

        continueText.enabled = false;
        continueButton.enabled = false;
        quitDialog.enabled = false;
        aboutCanvas.enabled = false;
        controlsCanvas.enabled = false;
        controls1Canvas.enabled = false;
        optionsCanvas.enabled = false;
        uiCanvas.enabled = false;
        gameOver.enabled = false;
        levelsCanvas.enabled = false;
    }
コード例 #7
0
ファイル: Snake.cs プロジェクト: StoRRica/Sn-c-ake
    void Start()
    {
        AddPortalSript.ForgetPortals();
        Loading.LoadLevels();
        background = GameObject.FindGameObjectWithTag("Background");
        gamePausedText = gamePausedText.GetComponent<Canvas>();
        gamePausedText.enabled = false;
        scoreText = scoreText.GetComponent<Text>();
        gameOverScoreText = gameOverScoreText.GetComponent<Text>();
        gameOverScreen = gameOverScreen.GetComponent<Canvas>();
        AddPortalSript = background.GetComponent<AddPortal>();
        eatSound = eatSound.GetComponent<AudioSource>();
        eatSound.volume = 0;
        fixedUpdateCounter = 0;
        obstacle = new bool[numOfRows][];
        for (int i = 0; i < numOfRows; i++)
        {
            obstacle[i] = new bool[numOfColls];
            /*for (int j = 0; j < numOfColls;j++) {
                Debug.Log(i + "," + j + ":" + obstacle[i][j]);
            }*/
        }
        forgetObstacles();
        tail.Add(initialBody.transform);
        tail.Add(initialTail.transform);
        initialBodyRotation = initialBody.transform.rotation;
        initialBodyPosition = initialBody.transform.position;
        initialTailPosition = initialTail.transform.position;
        initialTailRotation = initialTail.transform.rotation;
        initialHeadPosition = transform.position;
        initialHeadRotation = transform.rotation;
        //SpawnFood();
        ToggleAnimation(true);

        /*for (int xC = 0; xC < numOfRows; xC++)
        {
            for (int yC = 0; yC < numOfColls; yC++)
            {
                Debug.Log("IS SAFE X = " + yC + " Y = " + xC + " ?: " + isSafeFoodPlant(yC, xC));
            }
        }*/
    }