void OperateOnBox(NumberBox box) { switch (myPower) { case Power.MOVE: if (box.MoveBox(movement, wallObstacles)) { StartCoroutine(Move(moveToPosition)); } break; case Power.ADD3: box.SetNumberValue(box.GetNumberValue() + 3); currentRoom.UpdateEquation(); break; case Power.ADD5: box.SetNumberValue(box.GetNumberValue() + 5); currentRoom.UpdateEquation(); break; case Power.ADD7: box.SetNumberValue(box.GetNumberValue() + 7); currentRoom.UpdateEquation(); break; case Power.RESET: box.ResetOperations(); currentRoom.UpdateEquation(); break; default: break; } }
// Update is called once per frame // void Update() // { // // } void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.CompareTag("Box")) { boxOnTop = col.gameObject.GetComponent <NumberBox>(); boxOnTop.SetSlot(this); Debug.Log("[BoxSlot] Got box with value: " + boxOnTop.GetNumberValue(), this); foreach (var slotsObserver in observers) { slotsObserver.CalculateResult(); } } }