void PerformPlayerVsDoorCollision() { if (door != null && door.IsOpen && player.Intersects(door)) { CCSimpleAudioEngine.SharedEngine.PlayEffect("EnteringDoor"); try { bool isLastLevel = (LevelManager.Self.CurrentLevel + 1 == LevelManager.Self.NumberOfLevels); if (isLastLevel) { GameDelegate.GoToLevelSelectScene(); } else { DestroyLevel(); LevelManager.Self.CurrentLevel++; GoToLevel(LevelManager.Self.CurrentLevel); } } catch (Exception e) { int m = 3; } } }
public Program() { Console.Title = "Ascii Demon Attack"; inputBuffer = JConsole.GetInputBuffer(); screenBuffer = JConsole.GetActiveScreenBuffer(); screenBuffer.SetWindowSize(80, 50); screenBuffer.SetBufferSize(80, 50); screenBuffer.CursorVisible = false; screenBuffer.Clear(); hiddenBuffer = new ConsoleCharInfo[50, 80]; GameEngine gameEngine = new GameEngine(hiddenBuffer, inputBuffer); updateModelDelegate = gameEngine.UpdateModel; renderFrameDelegate = gameEngine.RenderFrame; for (int y = 0; y < 50; y++) { for (int x = 0; x < 80; x++) { hiddenBuffer[y, x].AsciiChar = (byte)0xdd; } } stopwatch.Start(); nextFrameStart = stopwatch.ElapsedTicks; while (true) { do { UpdateModel(); nextFrameStart += TICKS_PER_FRAME; } while (nextFrameStart < stopwatch.ElapsedTicks); RenderFrame(); long remainingTicks = nextFrameStart - stopwatch.ElapsedTicks; if (remainingTicks > 0) { Thread.Sleep((int)(1000 * remainingTicks / FREQUENCY)); } } }
public PlayerPanel(PlayerType playerType, PanelPos panelPos, GameDelegate turn, GameDelegate over, GameDelegate check) { this.playerType = playerType; this.panelPos = panelPos; this.turn = turn; cellSize = 25; switch (panelPos) { case PanelPos.left: Name = "player1"; break; case PanelPos.right: Name = "player2"; break; } CreateBtns(); brain = new Brain(DrawBtns, over, check, RedrawBtns, playerType); if (playerType == PlayerType.human) { CreateSwitchBtn(); } if (playerType == PlayerType.bot) { BotPlacement(); } }
protected override void OnPresent(IDelegate coordinatorDelegate = null) { _delegate = coordinatorDelegate as GameDelegate; ViewProvider.Instance.Preloader.SetActive(true); StartTimer(); }
public Brain(DrawCells draw, GameDelegate over, GameDelegate check, Btns Redraw, PlayerType playerType) { this.draw = draw; this.playerType = playerType; this.over = over; this.check = check; this.ReDraw = Redraw; state = State.construction; ships = new List <Ship>(); alives = 0; direction = new Point(1, 0); isWinner = false; for (int i = 0; i < 10; ++i) { for (int j = 0; j < 10; ++j) { map[i, j] = CellState.empty; notShooted.Add(10 * i + j); } } draw.Invoke(map); }
void CallbackMethod(IAsyncResult ar) { GameDelegate del = (GameDelegate)ar.AsyncState; if (del != null) { List <Car> cars = del.EndInvoke(ar); Console.WriteLine(cars[0].Place.ToString()); Console.WriteLine(cars[1].Place.ToString()); Console.WriteLine(cars[2].Place.ToString()); if (cars[rateNum - 1].Place == 1) { money += rateMoney; } else { money -= rateMoney; } label.Dispatcher.Invoke(mainWindow.moneyChangeDelegate, null); gameProc = false; colorNum = 0; currentPlace = 1; } }
private void OnGameFinished() { this.timerCurrentMove.Stop(); GameDelegate showGameFinished = new GameDelegate(this.ShowGameFinished); this.Invoke(showGameFinished); }
private void OnPlayerMoveStarted() { if (!this.Game.IsStopped) { GameDelegate refreshControl = new GameDelegate(this.RefreshCurrentMoveInfo); this.Invoke(refreshControl); } }
private void HandleButtonClicked(object sender, EventArgs args) { // levelNumber is 1-based, so subtract 1: var levelIndex = (sender as Button).LevelNumber - 1; LevelManager.Self.CurrentLevel = levelIndex; GameDelegate.GoToGameScene(); }
protected override void OnPresent(IDelegate coordinatorDelegate = null) { _parentDelegate = coordinatorDelegate as GameDelegate; _delegate.OnPlay += OnPlay; var go = ViewProvider.Instance.MainScreen; go.SetActive(true); go.GetComponent <MainScreenView>().Delegate = _delegate; }
private void UpdateSlot(GameDelegate gameDelegate) { int[, ] array = gameDelegate(); for (int i = 0; i < array.GetLength(1); i++) { column1[i].sprite = classes[array[0, i]]; column2[i].sprite = classes[array[1, i]]; column3[i].sprite = classes[array[2, i]]; } }
public void OnPlayButton() { if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android) { Debug.Log("OnPlayButton call SkillzCrossPlatform.LaunchSkillz"); GameDelegate gameDelegate = GameDelegate.getInstance(); SkillzCrossPlatform.LaunchSkillz(gameDelegate); } else { SceneManager.LoadScene("GameScene"); } }
public Game(GameDelegate gameDelegate, float gameTime, GameObject player, GameObject enemy1, GameObject enemy2, GameObject enemy3) { this.gameDelegate = gameDelegate; this.gameTime = gameTime; playerBall = player.GetComponent <Ball> (); enemy1Ball = enemy1.GetComponent <Ball> (); enemy2Ball = enemy2.GetComponent <Ball> (); enemy3Ball = enemy3.GetComponent <Ball> (); balls.Add(playerBall); balls.Add(enemy1Ball); balls.Add(enemy2Ball); balls.Add(enemy3Ball); }
public static GameDelegate getInstance() { lock (Lock) { if (delegateInstance != null) { return(delegateInstance); } else { delegateInstance = (GameDelegate)ScriptableObject.CreateInstance("GameDelegate"); return(delegateInstance); } } }
private void ApplyInput(float seconds) { if (controller != null && controller.IsConnected) { controller.UpdateInputValues(); player.ApplyInput(controller.HorizontalRatio, controller.JumpPressed); if (controller.BackPressed) { GameDelegate.GoToLevelSelectScene(); } } else { touchScreen.UpdateInputValues(); player.ApplyInput(touchScreen.HorizontalRatio, touchScreen.WasJumpPressed); } }
public MainWindow() { InitializeComponent(); cBox.Items.Add("1"); cBox.Items.Add("2"); cBox.Items.Add("3"); gameDelegate = Game; myDelegate = ChangeValueProgressBar; finishColorDelegate = FinishColor; moneyChangeDelegate = MoneyChange; label.Content = money.ToString(); mainWindow = this; brushes[0] = Brushes.Green; brushes[1] = Brushes.Yellow; brushes[2] = Brushes.Red; }
void Start() { samurai = GameObject.Find("samurai"); gameDelegate = Camera.main.GetComponent<GameDelegate>(); }
// Use this for initialization void Start() { movingPersonController = gameObject.GetComponent<MovingPersonController>(); Camera.main.transform.parent = gameObject.transform; Vector3 localPos = Camera.main.transform.localPosition; localPos.y = 10/gameObject.transform.localScale.y; localPos.z = -10/gameObject.transform.localScale.y; localPos.x = 0; Vector3 localAngles = Camera.main.transform.localEulerAngles; localAngles.x = 30; Camera.main.transform.localPosition = localPos; Camera.main.transform.localEulerAngles = localAngles; gameDelegate = Camera.main.GetComponent<GameDelegate>(); }
private void HandleHelpClicked(object sender, EventArgs args) { GameDelegate.GoToHowToScene(); }
private void HandleBackClicked(object sender, EventArgs args) { GameDelegate.GoToLevelSelectScene(); }
public void Play(GameDelegate move) { move(this.CurrentGame); }
void Start() { if (movingPerson == null) { movingPerson = GameObject.Find("MainCharacter"); transformDruid(); } Camera.main.transform.parent = gameObject.transform; Vector3 localPos = Camera.main.transform.localPosition; localPos.y = 5/gameObject.transform.localScale.y; localPos.z = -5/gameObject.transform.localScale.y; localPos.x = 0; Vector3 localAngles = Camera.main.transform.localEulerAngles; localAngles.x = 25; Camera.main.transform.localPosition = localPos; Camera.main.transform.localEulerAngles = localAngles; gameDelegate = Camera.main.GetComponent<GameDelegate>(); //testObject = GameObject.CreatePrimitive(PrimitiveType.Cube) as GameObject ; //testObject.collider.enabled = false; }
void Start() { print("terrain manager start"); samurai = GameObject.Find ("samurai"); samurai.transform.position = new Vector3(0, 100, 0); MovingPersonController movingPersonController = samurai.AddComponent("MovingPersonController") as MovingPersonController; InputSamurai inputSamurai = samurai.AddComponent("InputSamurai") as InputSamurai; movingPersonController.move = true; gameDelegate = gameObject.GetComponent<GameDelegate>(); for(int i = 0;i<2;i++) { createTerrainObject(); } }