public void RequestStateChange(int RequestedState) { if (this.gameObject.transform.parent != null) { OwningDevice = this.gameObject.transform.parent.GetComponent <LogicInterface>(); OwningDevice.ReactToLogic(this.gameObject, RequestedState); } }
/// <summary> /// Checks if the user right clicked, asks owning device to take care of the Logic. /// </summary> private void OnMouseOver() { if (Input.GetMouseButtonDown(1)) { if (this.gameObject.transform.parent != null) { OwningDevice = this.gameObject.transform.parent.GetComponent <LogicInterface>(); OwningDevice.ReactToLogic(this.gameObject); } } }
/* * Logic Initalization */ protected override void Initialize() { base.Initialize(); // Set drawing positions wallpaperRectangle = new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height); rightButtonRectangle = new Rectangle(rightButtonX, rightButtonY, buttonSize, buttonSize); minusButtonRectangle = new Rectangle(minusButtonX, minusButtonY, buttonSize, buttonSize); leftButtonRectangle = new Rectangle(leftButtonX, leftButtonY, buttonSize, buttonSize); plusButtonRectangle = new Rectangle(plusButtonX, plusButtonY, buttonSize, buttonSize); // Create and initialize the Game Grid and between time logic = new LogicInterface(gridCells, cellSize); leftTurnFlag = false; rightTurnFlag = false; speedUpFlag = false; speedDownFlag = false; updateTimer = 0; logicPace = cellSize / logic.getMaxPace(); logicTimer = 0; }
public void SetOwningDevice(LogicInterface deviceInterface) { this.OwningDevice = deviceInterface; }