예제 #1
0
 private void OnMouseDown()
 {
     OkEducationPanel.Resume();
     PlayerPrefs.SetInt("FirstStart", 1);
     FirstStart.EnableMenuAndQuestion();
     FirstStart.SetActiveStopCollider(false);
 }
예제 #2
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);
    }