Beispiel #1
0
    private void Awake()
    {
        agent = agentCube;

        F_Btn.onClick.AddListener(() => ChangeKeyCode(KeyType.F));
        B_Btn.onClick.AddListener(() => ChangeKeyCode(KeyType.B));
        L_Btn.onClick.AddListener(() => ChangeKeyCode(KeyType.L));
        R_Btn.onClick.AddListener(() => ChangeKeyCode(KeyType.R));

        undoBtn.onClick.AddListener(Undo);
        redoBtn.onClick.AddListener(Redo);

        cubeBtn.onClick.AddListener(() => agent   = agentCube);
        sphereBtn.onClick.AddListener(() => agent = agentSphere);

        UndoStack.ObserveCountChanged().Subscribe(x => undoBtn.interactable = x > 0 ? true : false);
        UndoStack.ObserveRemove().Subscribe(x => RedoStack.Add(x.Value));

        RedoStack.ObserveCountChanged().Subscribe(x => redoBtn.interactable = x > 0 ? true : false);
        RedoStack.ObserveRemove().Subscribe(x => UndoStack.Add(x.Value));

        commandIndex.TakeUntilDestroy(gameObject).Subscribe(x =>
        {
            if (x > -1)
            {
                commandImagesDic[x].color = Color.red;
            }
        });
    }
Beispiel #2
0
 public BaseInputModule()
 {
     Constraints = new ReactiveCollection <IInputConstraint>();
     Constraints.ObserveCountChanged()
     .Subscribe(count => Debug.Log(count));
 }