Пример #1
0
    private void Start()
    {
        GameObject player = GameObject.Find("Player 2");

        audioSource = GetComponentInParent <AudioSource>();

        buttonScale = new Vector3(0.75f, 0.75f, 0.75f);
        TextMeshProUGUI[] tooltips = transform.parent.parent.GetComponentsInChildren <TextMeshProUGUI>();
        foreach (TextMeshProUGUI t in tooltips)
        {
            if (t.name == "Tooltip")
            {
                tooltip = t;
                tooltip.transform.SetAsLastSibling();
            }
        }
        es = GameObject.Find("EventSystem").GetComponent <EventSystem>();
        if (es.currentSelectedGameObject != null)
        {
            ChangeTooltip(es.currentSelectedGameObject.name);
        }

        cs = player.GetComponent <CastSpell>();
        pt = player.GetComponent <PlaceTrap>();
        controllerCursor = GameObject.Find("ControllerCursor").GetComponent <Image>();
        cursorMove       = player.GetComponent <MoveControllerCursor>();
    }
Пример #2
0
    void Start()
    {
        //Get references
        pause       = gameManager.GetComponent <PauseMenu>();
        cs          = GetComponent <CastSpell>();
        audioSource = GetComponent <AudioSource>();

        //Queue Initialization
        queue      = new List <GameObject>();
        cursorMove = GetComponent <MoveControllerCursor>();
        active     = true;
        CreateTrapQueue();
        trapQueue.transform.SetAsLastSibling();

        //Handle cursor or set buttons if controller connected
        checkControllers = gameManager.GetComponent <CheckControllers>();
        p2Controller     = checkControllers.GetControllerTwoState();
        placeEnabled     = true;

        if (p2Controller)
        {
            eventSystem.SetSelectedGameObject(queue[0].gameObject);
        }
    }