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; } }); }
public void AddBuildingTemplate(IBuildable template) { if (BuildingTemplates.FirstOrDefault(t => t.SystemName == template.SystemName) == null) { BuildingTemplates.Add(template.Clone()); } }
/// <summary> /// Schedule code for execution in the main-thread. /// </summary> /// <param name="fn">The Action to be executed</param> public void Enqueue(Action fn) { if (ActionQueue == null) { return; // defensive programming } ActionQueue.Add(fn); }
// public void Ctor(HandModel handModel) // { // _model = handModel; // } public void Init() { _cards = new ReactiveCollection <CardPresenter>(); RandomSetter.interactable = true; RandomSetter .OnClickAsObservable() .Subscribe(_ => _cards[_id++ % _cards.Count].SetRandomValue()) .AddTo(this); _cards .ObserveAdd() .Throttle(TimeSpan.FromMilliseconds(250)) .Subscribe(c => RebuildCardPosition()) .AddTo(this); _cards .ObserveRemove() .Throttle(TimeSpan.FromMilliseconds(50)) .Subscribe(c => RebuildCardPosition()) .AddTo(this); _cards .ObserveAdd() .Subscribe(c => AddDragDrop(c.Value)) .AddTo(this); foreach (var cc in FindObjectsOfType <CardPresenter>()) { var cardModel = new CardModel(_assetDbService); cc.Ctor(cardModel); _cards.Add(cc); } _arc = new Arc3() { p0 = Arc3Root.gameObject.transform.InverseTransformPoint(Arc3Root.GetChild(0).transform.position), p1 = Arc3Root.gameObject.transform.InverseTransformPoint(Arc3Root.GetChild(1).transform.position), p2 = Arc3Root.gameObject.transform.InverseTransformPoint(Arc3Root.GetChild(2).transform.position), }; // _model.IsDead // .Where(isDead => isDead) // .Subscribe(_ => // { // _model = null; // Destroy(gameObject); // }) // .AddTo(this);; // // AddDragDrop(this); }
private void ReturnCard(CardPresenter cardPresenter) { _cards.Add(cardPresenter); //_id++; }
public void AddNode(Node node) { Nodes.Add(node); }