Ejemplo n.º 1
0
    public void OnFocused(Transform playerTransform)
    {
        isFocus     = true;
        player      = playerTransform;
        hasInteract = false;

        Debug.Log("Focused");

        if (!hasOptions)
        {
            foreach (myEventOdin evento in events)
            {
                myEventOdin act = evento;

                //GameObject temp = Instantiate(act.actionButton, OptionsPanel.instance.getTransform()) as GameObject;
                GameObject temp = Instantiate(act.actionButton, OptionsPanel.instance.getTransform()) as GameObject;
                temp.name = "Buttom " + act.name;
                temp.GetComponentInChildren <TextMeshProUGUI>().text = act.name;
                //temp.GetComponent<Button>().onClick.AddListener(() => destroyObj());
                SetSelectedListner(temp.GetComponent <Button>(), act);
            }

            hasOptions = true;
        }
    }
Ejemplo n.º 2
0
    public void destroyObj(myEventOdin act)
    {
        Debug.Log("Destruiu!");

        //TestExtras(act);
        OnDefocused();
        Destroy(gameObject);
    }
Ejemplo n.º 3
0
    public void moverObj(myEventOdin act)
    {
        Debug.Log("Moveu!");
        transform.position = act.finalPosition.position;

        player.GetComponent <PlayerController>().RemoveFocus();

        if (!act.continueToMove)
        {
            events.Remove(act);
        }
    }
Ejemplo n.º 4
0
    public void addEvents(myEventOdin act)
    {
        foreach (InteractableOdin objAddEvent in act.objToAddEvents)
        {
            foreach (myEventOdin eventOdin in act.eventsToadd)
            {
                objAddEvent.events.Add(eventOdin);
            }
        }

        //TestExtras(act);
    }
Ejemplo n.º 5
0
    public void startUnityEvent(myEventOdin act)
    {
        // if (!act.playEventAfterConversation || act.reachEndConversation)
        // {
        if (act.destroyAfterClick)
        {
            events.Remove(act);
        }


        act.unityEvents.Invoke();
        // }

        //TestExtras(act);
    }
Ejemplo n.º 6
0
    public void hideAndSHow(myEventOdin act)
    {
        //if (!act.playEventAfterConversation || act.reachEndConversation)
        //{
        foreach (GameObject obj in act.objetosToEnable)
        {
            obj.SetActive(true);
        }

        foreach (GameObject obj in act.objetosToDisable)
        {
            obj.SetActive(false);
        }
        // }


        //TestExtras(act);
    }
Ejemplo n.º 7
0
    private void SetSelectedListner(Button btn, myEventOdin act)
    {
        Actions actSelected = act.action;

        switch (actSelected)
        {
        case Actions.Nothing:
            btn.onClick.AddListener(() => doNothing(act));
            break;

        case Actions.Destroy:
            btn.onClick.AddListener(() => destroyObj(act));
            break;

        case Actions.Mover:
            btn.onClick.AddListener(() => moverObj(act));
            break;

        case Actions.Pegar:
            btn.onClick.AddListener(() => pegarObj(act));
            break;

        case Actions.ShowHIde:
            btn.onClick.AddListener(() => hideAndSHow(act));
            break;

        case Actions.addEvents:
            btn.onClick.AddListener(() => addEvents(act));
            break;

        case Actions.UnityEvents:
            btn.onClick.AddListener(() => startUnityEvent(act));
            break;

        default:
            break;
        }
    }
Ejemplo n.º 8
0
 public void doNothing(myEventOdin act)
 {
     // TestExtras(act);
 }
Ejemplo n.º 9
0
 public void pegarObj(myEventOdin act)
 {
     // TestExtras(act);
 }