public GinormoCard( float slideWait, Vec2 start, Vec2 end, Team team, BoardMode mode, int idx) : base() { this.layer = GinormoBoard.boardLayer; this._start = start; this._end = end; this._slideWait = slideWait; this.position = this._start; this._team = team; this.depth = new Depth(0.98f); this.index = idx; this._font = new BitmapFont("biosFont", 8); this._smallFont = new BitmapFont("smallBiosFont", 7, 6); this._mode = mode; this._trophy = new Sprite("littleTrophy"); this._trophy.CenterOrigin(); this._faceTarget = new RenderTarget2D(104, 24); this._targetSprite = new Sprite(this._faceTarget, 0.0f, 0.0f); this._gradient = new Sprite("rockThrow/headGradient2"); this._edgeOverlay = new Sprite("rockThrow/edgeOverlay"); }
public void SetInfo(int _minNumber, int _maxNumber, int _removedValue, int _removedCount, BoardMode _mode) { minNumber = _minNumber; maxNumber = _maxNumber; removedCount = _removedCount; removedValue = _removedValue; mode = _mode; }
public Board(bool drawShips) { _drawShips = drawShips; _cells = new BoardCell[10, 10]; _ships = new List <Ship>(); _random = new Random(DateTime.Now.Millisecond); Mode = BoardMode.Design; Margin = Padding.Empty; CreateBoard(); }
public GinormoBoard(float xpos, float ypos, BoardMode mode) : base(xpos, ypos) { this._board = new Sprite("rockThrow/boardMiddle"); this._board.center = new Vec2((float)(this._board.w / 2), (float)(this._board.h / 2 - 30)); this._lighting = new SpriteMap("rockThrow/lighting", 191, 23); this._lighting.frame = 1; this.boardLightingLayer = new Layer("LIGHTING", -85); this.boardLightingLayer.blend = new BlendState() { ColorSourceBlend = Blend.Zero, ColorDestinationBlend = Blend.SourceColor, ColorBlendFunction = BlendFunction.Add, AlphaSourceBlend = Blend.Zero, AlphaDestinationBlend = Blend.SourceColor, AlphaBlendFunction = BlendFunction.Add }; Layer.Add(this.boardLightingLayer); BoardLighting boardLighting = new BoardLighting(this.x + 0.5f, this.y - 125f); boardLighting.layer = this.boardLightingLayer; Level.Add((Thing)boardLighting); if (RockWeather.weather == Weather.Snowing) { this._boardTop = new Sprite("rockThrow/boardTopSnow"); this._boardBottom = new Sprite("rockThrow/boardBottomSnow"); } else { this._boardTop = new Sprite("rockThrow/boardTop"); this._boardBottom = new Sprite("rockThrow/boardBottom"); } this._boardTop.center = new Vec2((float)(this._boardTop.w / 2), (float)(this._boardTop.h / 2 - 30)); this._boardBottom.center = new Vec2((float)(this._boardBottom.w / 2), (float)(this._boardBottom.h / 2 - 30)); this.layer = Layer.Background; this._pos = new Vec2(xpos, ypos); this._mode = mode; GinormoBoard.boardLayer = new Layer("BOARD", -85, targetLayer: true, targetSize: new Vec2(185f, 103f)); GinormoBoard.boardLayer.camera = new Camera(0.0f, 0.0f, 185f, 103f); GinormoBoard.boardLayer.targetOnly = true; GinormoBoard.boardLayer.targetClearColor = new Color(0.05f, 0.05f, 0.05f); Layer.Add(GinormoBoard.boardLayer); this.overlayLayer = new Layer("OVERLAY", 10); Layer.Add(this.overlayLayer); GinormoOverlay ginormoOverlay = new GinormoOverlay(this.x - 182f, this.y - 65f); ginormoOverlay.z = -130f; ginormoOverlay.position = this.position; ginormoOverlay.layer = this.overlayLayer; Level.Add((Thing)ginormoOverlay); }
/// <summary> /// Called when the script is loaded or a value is changed in the /// inspector (Called in the editor only). /// </summary> void OnValidate() { BoardMode = boardMode; Hex selectedHex = this.GetHexAt(x, y, z); if (selectedHex != null) { List <Hex> nearHexes = getAdjacentHexes(selectedHex); foreach (Hex hex in nearHexes) { } } }
public void StartGame(BoardMode mode) { if (mode == BoardMode.PlayerVsEngine) { StartPlayerVsEngine(); } else if (mode == BoardMode.EngineVsPlayer) { StartEngineVsPlayer(); } else if (mode == BoardMode.PlayerVsPlayer) { StartPlayerVsPlayer(); } }
private void ShowBoard(BoardMode mode) { if (mode == BoardMode.BoardWin) { //todo // if click button Level Up, then go to next level // if click main menu, then go to menu } if (mode == BoardMode.BoardLoose) { //todo: // if click button Restart, then reset the level // if click main menu, then go to menu } }
// Start is called before the first frame update void Start() { BoardMode boardMode = GameManager.Instance.boardMode; switch (boardMode) { case BoardMode.Random: this.rollNumber = getRandomRollNumber(); break; case BoardMode.RandomPooled: this.rollNumber = getRandomPooledNumber(); break; default: this.rollNumber = getRandomPooledNumber(); break; } setupText(); }
/// <summary> /// Start the game, with provided board. /// </summary> /// <param name="customBoard">The abstract board that we should match, if none specified we use existing one, if none exists we generate an 8x8 board</param> /// <param name="mode">Which mode the game is in, player vs player, player vs engine, engine vs engine etc.</param> public void start(cgBoard customBoard = null, BoardMode mode = BoardMode.Undefined) { if (customBoard == null) { if (this._abstractBoard != null) { customBoard = this._abstractBoard; } else { customBoard = new global::cgBoard(); } } if (displayAs3d) { Camera.main.transform.localPosition = new Vector3(0, -2.28f, -12.58f); Quaternion newQuat = Camera.main.transform.localRotation; newQuat = Quaternion.Euler(-23.46f, newQuat.eulerAngles.y, newQuat.eulerAngles.z); Camera.main.transform.localRotation = newQuat; } //customBoard = customBoard.revertToStart(); UnityEngine.Debug.Log("start: "); _squares = getSquares(); Mode = (mode != BoardMode.Undefined ? mode : Mode); _engine = new cgEngine(searchDepthWeak, searchDepthStrong); setBoardTo(customBoard); //_abstractBoard.readBoard(); // UnityEngine.Debug.Log(_abstractBoard.boardToString()); if (Mode == BoardMode.PlayerVsEngine && !whiteTurnToMove) { MakeEngineMove(_abstractBoard.duplicate(), false, _engineCallback); } else if (Mode == BoardMode.EngineVsPlayer && whiteTurnToMove) { MakeEngineMove(_abstractBoard.duplicate(), true, _engineCallback); } else if (Mode == BoardMode.EngineVsEngine) { MakeEngineMove(_abstractBoard.duplicate(), true, _engineCallback); } }
public void StartMonitoring(BoardMode mode) { if (board_404) { Log(new LogEntry() { Level = LogEntry.LogLevel.Fail, Message = "This board does not exist", Sender = "BoardWatcher", Title = string.Format("/{0}/", this.Board) }); return; } if (mode == BoardMode.None) { return; } //First we load the catalog data, then we start the RSS watcher. //The reason that we don't use the RSS watcher at first, because the RSS feed is limited to //20 thread. So the RSS watcher is used to check for new threads instead of re-downloading the catalog if (this.Mode == BoardMode.None /*|| this.Mode != mode*/) { this.Mode = mode; Task.Factory.StartNew((Action) delegate { //log("Starting board watcher"); load_catalog(); start_rss_watcher(); // log("Board watcher started"); }); } }
// The q, r, and s axes of the Hex indicate the cubic positions of the Hex itself // The coordinate invariant is q+r+s=0 // Start is called before the first frame update void Start() { BoardMode boardMode = GameManager.Instance.boardMode; switch (boardMode) { case BoardMode.Random: resource = getRandomResource(); break; case BoardMode.RandomPooled: resource = getRandomPooledResource(); break; default: resource = getRandomPooledResource(); break; } InstantiateHexWith(resource); displayedResource = resource; originalResource = resource; }
public GinormoScreen(float xpos, float ypos, BoardMode mode) : base(xpos, ypos) { this.layer = Layer.Foreground; this.depth = new Depth(0.0f); this._font = new BitmapFont("biosFont", 8); this._collisionSize = new Vec2(184f, 102f); List <Team> teamList = new List <Team>(); int idx = 0; foreach (Team team in Teams.all) { if (team.activeProfiles.Count > 0) { teamList.Add(team); } } teamList.Sort((Comparison <Team>)((a, b) => { if (a.score == b.score) { return(0); } return(a.score >= b.score ? -1 : 1); })); foreach (Team team in teamList) { float y = this.y + 2f + (float)(25 * idx); if ((double)Graphics.aspect > 0.589999973773956) { y += 10f; } Level.current.AddThing((Thing) new GinormoCard((float)idx * 1f, new Vec2(300f, y), new Vec2(this.x + (mode == BoardMode.Points ? 2f : 2f), y), team, mode, idx)); ++idx; } }
public void StartPlayerVsPlayer() { Mode = BoardMode.PlayerVsPlayer; _start(); }
public void StartEngineVsPlayer() { Mode = BoardMode.EngineVsPlayer; _start(); }
public void setBoardMode(BoardMode newMode) { mode = newMode; }
public void SetX2Mode() { mode = BoardMode.X2; }
public void SetD2Mode() { mode = BoardMode.D2; }
public void StartMonitoring(BoardMode mode) { if (board_404) { Log(new LogEntry() { Level = LogEntry.LogLevel.Fail, Message = "This board does not exist", Sender = "BoardWatcher", Title = string.Format("/{0}/", this.Board) }); return; } if (mode == BoardMode.None) { return; } //First we load the catalog data, then we start the RSS watcher. //The reason that we don't use the RSS watcher at first, because the RSS feed is limited to //20 thread. So the RSS watcher is used to check for new threads instead of re-downloading the catalog if (this.Mode == BoardMode.None /*|| this.Mode != mode*/) { this.Mode = mode; Task.Factory.StartNew((Action)delegate { //log("Starting board watcher"); load_catalog(); start_rss_watcher(); // log("Board watcher started"); }); } }
private void MoveElements(int dx, int dy) { _moveElements.Sort(new Comparison<Element>(delegate(Element a, Element b) { return a.Location.Y - b.Location.Y; })); List<Element> _moved = new List<Element>(_moveElements); for (int i = _moveElements.Count - 1; i >= 0; i--) { Element elem = _moveElements[i]; Debug.WriteLine(elem); elem.Move(dx, dy); if (LocationBlocked(elem.Location.X, elem.Location.Y + 1)) { //_checkElements.Add(elem); _elements.Add(elem); _moveElements.RemoveAt(i); } } if (OnElementsMoved != null && _moved.Count > 0) OnElementsMoved(_moved); if (_moveElements.Count == 0) { if (_mode == BoardMode.ElementMove) _mode = BoardMode.LinkChecking; //else if (_mode == BoardMode.CheckingMove) //{ // _mode = BoardMode.ElementMove; // GenerateNewTriple(); //} } }
/// <summary> /// Prüft, ob Verbindungen gleicher Elemente erzielt wurden /// </summary> private void CheckElementLinks() { List<Element> linked = new List<Element>(); List<int> checkCols = new List<int>(); int[] dx = new int[] { -1, 0, 1, 1 }; int[] dy = new int[] { 1, 1, 1, 0 }; foreach (Element elem in _elements) { // alle möglichen Richtungen ausgehen von diesem Element überprüfen for (int i = 0; i < dx.Length; i++) { List<Element> match = new List<Element>(); int count = RecursiveCheck(elem, dx[i], dy[i], ref match); if (count >= 2) { match.Add(elem); foreach (Element m in match) if (!linked.Contains(m)) linked.Add(m); } } } if (linked.Count > 0) { // verbundene Elemente eleminieren List<Element> moved = new List<Element>(); _linkChain++; if (OnElementsRemoved != null) OnElementsRemoved(linked); foreach (Element elem in linked) { _elements.Remove(elem); if (!checkCols.Contains(elem.Location.X)) checkCols.Add(elem.Location.X); } // darüber liegende Elemente nachrücken foreach (int x in checkCols) { for (int y = SIZEY - 1; y >= 0; y--) { Element elem = ElementAtLocation(x, y); if (elem != null) { int j = y; while (!LocationBlocked(elem.Location.X, elem.Location.Y + 1)) { elem.Move(0, 1); if (!moved.Contains(elem)) moved.Add(elem); } } } } if (moved.Count > 0 && OnElementsMoved != null) OnElementsMoved(moved); //Punktewertung int roundscore = (linked.Count - 2) * 30 * (_linkChain) * (_level + 1); _score += roundscore; if (_linkedCount / 50 < (_linkedCount + linked.Count) / 50) _level++; _linkedCount += linked.Count; if (OnScoreChanged != null) OnScoreChanged(roundscore, _score, _linkedCount, _level); } else { _mode = BoardMode.ElementMove; GenerateNewTriple(); } }
public void OnClick(int i, int j, int v) { if (mode == BoardMode.GAMEOVER) { return; } BoardStat boardStat = new BoardStat(minNumber, maxNumber); int removedCount = 0; if (mode == BoardMode.NORMAL) { Dictionary <int, Square> taken = new Dictionary <int, Square>(); NearSameSquares(ref taken, i, j); removedCount = taken.Count; if (removedCount > 1) { int sum = Mathf.FloorToInt(Mathf.Log(removedCount, 2)) + v; foreach (KeyValuePair <int, Square> keyValue in taken) { //Square s = keyValue.Value; //s.DestroyAfterMoveTo(dest).ParallelCoroutinesGroup(this, "DestroyAfterMoveTo"); //StartCoroutine(s.DestroyAfterMoveTo(dest)); squares[keyValue.Key / countX, keyValue.Key % countX] = null; } CreateSquare(i, j, sum); CheckFree(); CorrectMinMax(); int[] shifting = CreateSquaresForFree(); ActionAnimations(taken, i, j, shifting).ParallelCoroutinesGroup(this, "actionAnim" + actionAnimId + 1); } } else if (mode == BoardMode.X2) { removedCount = 1; DestroyImmediate(squares[i, j].gameObject); CreateSquare(i, j, v + 1); if (v + 1 > maxNumber) { maxNumber = v + 1; } } else if (mode == BoardMode.D2) { if (v != 1) { removedCount = 1; DestroyImmediate(squares[i, j].gameObject); CreateSquare(i, j, v - 1); if (v - 1 < minNumber) { maxNumber = v - 1; } } } else if (mode == BoardMode.DEL) { removedCount = 1; DestroyImmediate(squares[i, j].gameObject); CheckFree(); CorrectMinMax(); CreateSquaresForFree(); } boardStat.SetInfo(minNumber, maxNumber, v, removedCount, mode); mode = BoardMode.NORMAL; gameController.OnStepEnd(boardStat); }
public void SetDELMode() { mode = BoardMode.DEL; }
public void SetNormalMode() { mode = BoardMode.NORMAL; }
public void StartPlayerVsEngine() { Mode = BoardMode.PlayerVsEngine; _start(); }
/// <summary> /// Spielstart: Spielfeld initialisieren, Timer starten /// </summary> public void Init() { _mode = BoardMode.ElementMove; _previewTriple = Triple.GenerateRandomTriple(); GenerateNewTriple(); _timer = new Timer(new System.Threading.TimerCallback(TimerEvent), null, 0, 500); }