/// <summary> /// Call this to initialize the Act (GameObjects, ActSettings, etc). All interactable components should be disabled in this phase. /// </summary> public virtual void ActInit() { phase = ActPhase.INIT; canvas = GameObject.FindGameObjectWithTag("Canvas")?.GetComponent <Canvas>(); eventSystem = GameObject.FindGameObjectWithTag("EventSystem")?.GetComponent <EventSystem>(); }
/// <summary> /// Call this to cleanup all GameObjects created during the Init phase. /// </summary> public virtual void ActCleanup() { if (Phase != ActPhase.END) { Debug.LogWarningFormat("ActCleanup() was called during {0}", Phase); } phase = ActPhase.CLEANUP; }
/// <summary> /// Call this to disable once again all interactable components in the Act. It should be called when the Act is finished (time ran out, player reached submission limit, etc). /// </summary> public virtual void ActEnd() { if (Phase != ActPhase.START) { throw new InvalidPhaseException(phase); } phase = ActPhase.END; }
/// <summary> /// Call this to enable all interactable components in the Act. It should be called when the player is ready to play. /// </summary> public virtual void ActStart() { if (Phase != ActPhase.INIT) { throw new InvalidPhaseException(phase); } phase = ActPhase.START; }
/// <summary> /// Call this to initialize the Act (GameObjects, ActSettings, etc). All interactable components should be disabled in this phase. /// </summary> public virtual void ActInit() { phase = ActPhase.INIT; canvas = GameObject.FindGameObjectWithTag("Canvas")?.GetComponent <Canvas>(); eventSystem = GameObject.FindGameObjectWithTag("EventSystem")?.GetComponent <EventSystem>(); if (settings == null) { throw new MissingSettingsException(); } }
/// <summary> /// キャラクターが移動するCellを決定する /// </summary> private void DecideCharacterMove() { var x = Position.X; var y = Position.Y; if (Engine.Keyboard.GetKeyState(Key.D) == ButtonState.Push || Engine.Keyboard.GetKeyState(Key.Right) == ButtonState.Push) { Column++; Column = CheckColumn(Column); x += Texture.Size.X; } if (Engine.Keyboard.GetKeyState(Key.A) == ButtonState.Push || Engine.Keyboard.GetKeyState(Key.Left) == ButtonState.Push) { Column--; Column = CheckColumn(Column); x -= Texture.Size.X; } if (Engine.Keyboard.GetKeyState(Key.W) == ButtonState.Push || Engine.Keyboard.GetKeyState(Key.Up) == ButtonState.Push) { Row--; Row = CheckRow(Row); y -= Texture.Size.Y; } if (Engine.Keyboard.GetKeyState(Key.S) == ButtonState.Push || Engine.Keyboard.GetKeyState(Key.Down) == ButtonState.Push) { Row++; Row = CheckRow(Row); y += Texture.Size.Y; } x = MathHelper.Clamp(x, Texture.Size.X * (board.columnMax - 1) + 200, 200); y = MathHelper.Clamp(y, Texture.Size.Y * (board.rowMax - 1) + 100, 100); CellNumber = Row * board.columnMax + Column; Console.WriteLine(CellNumber); Position = new Vector2F(x, y); if (Engine.Keyboard.GetKeyState(Key.Enter) == ButtonState.Push) { var obj = board.Cells[fromCellNum].ObjectOnThisCell; var fromcell = board.Cells[fromCellNum]; var tocell = board.Cells[CellNumber]; obj.Position = new Vector2F(x, y); fromcell.RemoveObject(); tocell.AddObject(obj); actPhase = ActPhase.SelectingCellPhase; board.Cells[fromCellNum].Texture = Texture2D.LoadStrict(textureRsourcesPath + "cell.png"); } if (Engine.Keyboard.GetKeyState(Key.B) == ButtonState.Push) { var fromcell = board.Cells[fromCellNum]; fromcell.Texture = Texture2D.LoadStrict(textureRsourcesPath + "cell.png"); actPhase = ActPhase.SelectingCellPhase; } }
public Player(int cellNum, Board board) { CellNumber = cellNum; Row = 0; Column = 0; this.board = board; Texture = Texture2D.LoadStrict(textureRsourcesPath + "playersIcon.png"); float x = (cellNum % 6) * Texture.Size.X + 200; int y = (cellNum / 6) * Texture.Size.Y + 100; Position = new Vector2F(x, y); actPhase = ActPhase.SelectingCellPhase; }
public InvalidPhaseException(ActPhase currentPhase) { this.currentPhase = currentPhase; }