Esempio n. 1
0
 private void OnMouseUp()
 {
     anim.Play("GoAway");
     if (!MessageSystemPlayingScene.IsStart)
     {
         menuPanel.SetActive(false);
         MessageSystemPlayingScene.StartGame();
         if (Conecting.Management == 0)
         {
             screen.SetActive(true);
         }
         else
         {
             StartCoroutine(EnButtons());
         }
         MessageSystemGameBlock.DisableAllBlock();
         Score.increeze();
     }
     else
     {
         MessageSystemGameBlock.StartAfterHit();
         MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 1;
         EnableButtons();
     }
     if (PlayerPrefs.HasKey("FirstStart"))
     {
         PauseGame.IsPause = false;
         pause.SetActive(true);
     }
     else
     {
         FirstStart.SetActiveStopCollider(true);
     }
     source.Play();
 }
Esempio n. 2
0
 public static void Resume()
 {
     MessageSystemPlayingScene.EnableCollider();
     StopCollider.IsCollision        = false;
     MessageSystemPlayingScene.IsHit = false;
     MessageSystemGameBlock.StartAfterHit();
     MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 1;
     StopCollider.RestoreConstraints();
     StopCollider.PlayAnimation();
     StopCollider.SetDefaultSortingLayer();
     StopCollider.SetActiveImageButtons(false);
     panel.SetActive(false);
 }
Esempio n. 3
0
    IEnumerator CloseAfterPlay()
    {
        MessageSystemGameBlock.ChangeLayerRight(1);
        blockForMenu.SetActive(false);
        Animation anim = menu.GetComponent <Animation>();

        anim["OpenMenuDuringPlay"].time  = anim["OpenMenuDuringPlay"].length;
        anim["OpenMenuDuringPlay"].speed = -1;
        anim.Play("OpenMenuDuringPlay");
        yield return(new WaitForSeconds(anim["OpenMenuDuringPlay"].length));

        menu.SetActive(false);
        numberOperation           = 2;
        CloseMenu.NumberOperation = 0;
        if (!PauseGame.IsPause)
        {
            MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 1;
            MessageSystemGameBlock.StartAfterHit();
            PauseGame.SetActivePause(true);
        }
        question.SetActive(true);
    }
Esempio n. 4
0
 void Start()
 {
     menu         = GameObject.Find("DisableScreen/Menu/Enter");
     question     = GameObject.Find("DisableScreen/Question/Question");
     education[0] = () =>
     {
         if (MessageSystemPlayingScene.IsStart && !PauseGame.IsPause)
         {
             MessageSystemGameBlock.SaveSpeed();
             MessageSystemGameBlock.StopGame();
             MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 0;
         }
         DisableButtons();
         menu.SetActive(false);
         question.SetActive(false);
         PauseGame.SetActivePause(false);
         parentPanel.SetActive(true);
         numberOperation = 1;
     };
     education[1] = () =>
     {
         if (MessageSystemPlayingScene.IsStart && !PauseGame.IsPause)
         {
             MessageSystemGameBlock.StartAfterHit();
             MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 1;
         }
         EnableButtons();
         numberOperation = 0;
         parentPanel.SetActive(false);
         if (!PauseGame.IsPause)
         {
             PauseGame.SetActivePause(true);
         }
         menu.SetActive(true);
         question.SetActive(true);
     };
 }
Esempio n. 5
0
 public void StartGame()
 {
     MessageSystemPlayingScene.IsHit = false;
     MessageSystemGameBlock.StartAfterHit();
 }
Esempio n. 6
0
    private void Start()
    {
        typeAnimation = 0;
        isCollision   = false;
        saveConstr    = RigidbodyConstraints2D.FreezeAll;
        int j = 0;

        foreach (Image img in adviceButton.GetComponentsInChildren <Image>())
        {
            imageButtons[j++] = img.gameObject;
        }
        panel.SetActive(false);
        imageButtons[0].SetActive(false);
        imageButtons[2].SetActive(false);
        for (int i = 0; i < 2; i++)
        {
            message[i] = new string[10];
        }
        txt = panel.GetComponentInChildren <Text>();
        hashtable.Add("Robot", 0);
        hashtable.Add("Cube", 1);
        hashtable.Add("Barrier_Grey", 2);
        hashtable.Add("Portal_Grey", 3);
        hashtable.Add("Abyss", 4);
        hashtable.Add("Blade", 5);
        hashtable.Add("Speedy", 6);
        hashtable.Add("Saw", 7);
        hashtable.Add("Needles", 8);
        hashtable.Add("Enemy#1", 9);

        education[0] = (obj) => // Robot
        {
            currentObj    = obj.GetComponentInChildren <Animator>().gameObject;
            typeAnimation = 2;
            obj.GetComponentInChildren <Animator>().speed = 0;
            SetMessage(message[Conecting.Language][0]);
            SetButtonImage(sprites[1]);
        };
        education[1] = (obj) =>// Cube
        {
            typeAnimation = 0;
            SetMessage(message[Conecting.Language][1]);
            SetButtonImage(sprites[2]);
        };
        education[2] = (obj) =>// Barrier
        {
            sortingLayerObj = FindBarrier(obj);
            sortingLayerObj.GetComponent <SpriteRenderer>().sortingOrder = 0;
            typeAnimation = 0;
            SetMessage(message[Conecting.Language][2]);
            SetButtonImage(sprites[0]);
            SetActiveImageButtons(true);
        };
        education[3] = (obj) =>//Portal
        {
            sortingLayerObj = FindPortal(obj);
            sortingLayerObj.GetComponent <SpriteRenderer>().sortingOrder = 0;
            typeAnimation = 0;
            SetMessage(message[Conecting.Language][3]);
            SetButtonImage(sprites[0]);
            SetActiveImageButtons(true);
            PlayerPrefs.SetInt("FirstStart", 1);
        };
        education[4] = (obj) =>//Abyss
        {
            typeAnimation = 0;
            SetMessage(message[Conecting.Language][4]);
            SetButtonImage(sprites[2]);
        };
        education[5] = (obj) =>//Blade
        {
            currentObj = obj.GetComponentInChildren <Animator>().gameObject;
            obj.GetComponentInChildren <Animator>().speed = 0;
            typeAnimation = 2;
            SetMessage(message[Conecting.Language][5]);
            SetButtonImage(sprites[3]);
        };
        education[6] = (obj) =>//Speedy
        {
            SetFontMaxSize(78);
            typeAnimation = 0;
            SetMessage(message[Conecting.Language][6]);
            imageButtons[1].SetActive(false);
        };
        education[7] = (obj) =>//Saw
        {
            SetFontMaxSize(56);
            imageButtons[1].SetActive(true);
            currentObj = obj;
            currentObj.GetComponent <Animation>()["Saw"].speed = 0;
            typeAnimation = 1;
            SetMessage(message[Conecting.Language][7]);
            SetButtonImage(sprites[4]);
        };
        education[8] = (obj) =>//Needles
        {
            currentObj = obj;
            currentObj.GetComponent <Animator>().speed = 0;
            typeAnimation = 2;
            SetMessage(message[Conecting.Language][8]);
            SetButtonImage(sprites[2]);
        };
        education[9] = (obj) =>//Enemy #1
        {
            currentObj = obj.GetComponentInChildren <Animator>().gameObject;
            if (currentObj)
            {
                currentObj.GetComponent <Animator>().speed = 0;
                typeAnimation = 2;
                SetMessage(message[Conecting.Language][9]);
                SetButtonImage(sprites[1]);
                FirstStart.EnableMenuAndQuestion();
                gameObject.SetActive(false);
            }
            else
            {
                MessageSystemPlayingScene.EnableCollider();
                IsCollision = false;
                MessageSystemPlayingScene.IsHit = false;
                MessageSystemGameBlock.StartAfterHit();
                MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 1;
                RestoreConstraints();
                SetDefaultSortingLayer();
                SetActiveImageButtons(false);
                panel.SetActive(false);
                FirstStart.EnableMenuAndQuestion();
                gameObject.SetActive(false);
            }
        };

        anim[0] = () => { };
        anim[1] = () => currentObj.GetComponent <Animation>()["Saw"].speed = 1;
        anim[2] = () => currentObj.GetComponent <Animator>().speed = 1;

        InicializedMessage();
        gameObject.SetActive(false);
    }