// Update is called once per frame
    void Update()
    {
        if (!background)
        {
            background = FindObjectOfType <backgroundManager>();
        }

        if (phase != phases.None)
        {
            if (button.boss)
            {
                boss.EnableBossSpecific(false);
            }

            if (monsterSpot.transform.localPosition.x != 448)
            {
                monsterSpot.transform.localPosition = new Vector3(448, monsterSpot.transform.localPosition.y, monsterSpot.transform.localPosition.z);
            }

            timer += Time.deltaTime;

            objectSpot += (movementIncrement * Time.deltaTime);
            movingObject.transform.localPosition = new Vector3(objectSpot, 0, 0);
            CheckTransitionEnd();
        }
    }
    void EndMovement()
    {
        if (!background)
        {
            background = FindObjectOfType <backgroundManager>();
        }
        if (background.currentScroll)
        {
            background.currentScroll.ScrollAll(false);
        }

        phase = phases.None;
        SetMovementStartAndSpeed(phase);

        textDisplay.gameObject.SetActive(false);
        textBackground.SetActive(false);

        if (button.boss)
        {
            boss.EnableBossSpecific(true);
        }


        calculator.AbleCalculator(true);
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1;

        list = FindObjectOfType <equipmentList>();
        if (list == null)
        {
            GameObject adding = Instantiate(prefabbedList, null, false);
            list        = adding.GetComponent <equipmentList>();
            adding.name = "List";

            StateManager check = gameObject.GetComponent <StateManager>();

            if (!check)
            {
                list.startGame("Guest", true);
            }
        }

        GameObject can = GameObject.Find("Canvas");

        backs = Instantiate(backPrefab, can.transform, false);

        backgrounds = backs.GetComponent <backgroundManager>();

        backgrounds.startBack(playStatus.subjectSelect);


        SetStep(1);
    }
    public void Find()
    {
        list = FindObjectOfType <equipmentList>();
        if (list == null)
        {
            GameObject adding = Instantiate(prefabbedList, null, false);
            list        = adding.GetComponent <equipmentList>();
            adding.name = "List";

            StateManager check = gameObject.GetComponent <StateManager>();

            if (!check)
            {
                list.startGame("Guest", true);
            }
        }

        GameObject can = GameObject.Find("Canvas");

        backs = Instantiate(backPrefab, can.transform, false);

        backgrounds = backs.GetComponent <backgroundManager>();
    }
    void SetMovementStartAndSpeed(phases position)
    {
        if (!background)
        {
            background = FindObjectOfType <backgroundManager>();
        }

        if (position == phases.enemy || position == phases.None)
        {
            if (background.currentScroll)
            {
                background.currentScroll.ScrollAll(false);
            }

            objectSpot = 0;
            movingObject.transform.localPosition = new Vector3(0, 0, 0);
            movementIncrement = 0;
            monsterSpot.gameObject.SetActive(true);

            calculatorParent.SetActive(true);
            //transitionManager.TransitionContainers(TransitioningObjects.SwapToCalculator);
        }
        if (position == phases.None)
        {
            foreach (Button item in calcButtons)
            {
                item.interactable = true;
            }
        }
        else
        {
            foreach (Button item in calcButtons)
            {
                item.interactable = false;
            }
        }

        if (position == phases.previous)
        {
            if (background.currentScroll)
            {
                background.currentScroll.ScrollAll(true);
            }

            if (previousTime == 0)
            {
                movementIncrement = 0;
                return;
            }
            monsterSpot.gameObject.SetActive(false);

            objectSpot = 0;
            movingObject.transform.localPosition = new Vector3(objectSpot, 0, 0);
            movementIncrement = -(1200 / previousTime);
            textDisplay.text  = previousLevelWords;

            calculatorParent.SetActive(false);
        }
        else if (position == phases.next)
        {
            if (background.currentScroll)
            {
                background.currentScroll.ScrollAll(true);
            }

            if (nextime == 0)
            {
                movementIncrement = 0;
                return;
            }

            monsterSpot.gameObject.SetActive(true);

            objectSpot = 1200;
            movingObject.transform.localPosition = new Vector3(1200, 0, 0);
            movementIncrement = -(1200 / nextime);
            textDisplay.text  = nextLevelWords;

            calculatorParent.SetActive(false);
        }
    }