public GameRunning() { isGameOver = false; player = new Player(new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)), new Image(Path.Combine("Assets", "Images", "Player.png"))); score = new Score(new Vec2F(0.02f, 0.7f), new Vec2F(0.3f, 0.3f)); enemyStrides = ImageStride.CreateStrides(4, Path.Combine("Assets", "Images", "BlueMonster.png")); squiggleSquadron = new SquiggleSquadron(6); AddEnemies(); noMove = new NoMove(); down = new Down(); zigZagDown = new ZigZagDown(); playerShots = new List <PlayerShot>(); // Preloads the bullet image bullet = new Image(Path.Combine("Assets", "Images", "BulletRed2.png")); explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png")); // Here the constructor is given the argument 6 since that is the total amount of enemies. explosions = new AnimationContainer(6); //backGroundImage = new Entity(new StationaryShape(new Vec2F(0.2f, 0.2f), new Vec2F(0.5f, 0.5f)), new Image("Assets/Images/TitleImage.png")); GalagaBus.GetBus().Subscribe(GameEventType.MovementEvent, player); }
public void InitializeGameState() { stateMachine = new StateMachine(); player = new Player(this, shape: new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)), image: new Image(Path.Combine("Assets", "Images", "Player.png"))); GalagaBus.GetBus().InitializeEventBus(new List <GameEventType>() { GameEventType.PlayerEvent }); GalagaBus.GetBus().Subscribe(GameEventType.PlayerEvent, player); enemyStrides = ImageStride.CreateStrides(4, Path.Combine("Assets", "Images", "BlueMonster.png")); enemies = new EntityContainer <Enemy>(); PlayerShot = new Image(Path.Combine("Assets", "Images", "BlueMonster.png")); playerShots = new EntityContainer <PlayerShot>(); explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png")); explosions = new AnimationContainer(40); score = new Score(new Vec2F(0.43f, -0.12f), new Vec2F(0.2f, 0.2f)); v_Formation = new V_Formation(); v_Formation.CreateEnemies(enemyStrides); enemies = v_Formation.Enemies; down = new Down(); zigzagdown = new ZigZagDown(); noMove = new NoMove(); }
void Update() { if (WinCondition.win == true) //Jika total jawaban benar sementara mencapai total jawaban benar { finished = true; //variabel finish diset bernilai true WinNotif.SetActive(true); //menampilkan winnotif & nomove NoMove.SetActive(true); } }
public void timeout() { LoseNotif.SetActive(true); //menampilkan LoseNotif NoMove.SetActive(true); //menampilkan NoMove GameObject cam = GameObject.Find("Main Camera"); SwipeCamera swipe = cam.GetComponent <SwipeCamera> (); swipe.enabled = false; }
public EnemyBehavior SetStrategyMove(int i) { if (i == 0) { _moveStrategy = new NoMove(); } else { _moveStrategy = new MoveHorizontalLookDirection(); } return(this); }
void Update() { if (WinConditionSwipe.win == true) //Jika total jawaban benar sementara mencapai total jawaban benar { finished = true; //variabel finish diset bernilai true WinNotif.SetActive(true); //menampilkan winnotif & nomove NoMove.SetActive(true); GameObject cam = GameObject.Find("Main Camera"); SwipeCamera swipe = cam.GetComponent <SwipeCamera> (); swipe.enabled = false; } }
public void AddSpecialObject(GridPos p, byte value) { Vector2 v = gridInfo.GetGridVector(p); GameObject go; switch (value) { case FOUNTAIN: //fountain go = Instantiate(roomPrefabs.fountain); go.transform.position = v; winbox = new Box(v, 2f, 2f); GameController.Main.player.checkWin = true; removeOnLoad.Add(go); break; case DOOR: //door if (!unlockedDoors.Contains(GameController.Main.roomName)) { doors.Add(p); doorBoxes.Add(new Box(v, 1f, 1f)); GameController.Main.player.checkDoor = true; } else { sprites[p.GetIndex(width)].sprite = tileSet[0]; } break; case KEY: //key if (!pickedUpKeys.Contains(GameController.Main.roomName)) { go = Instantiate(roomPrefabs.key); keyObj = go; go.transform.position = v; keyBox = new Box(v, 1f, 0.5f); removeOnLoad.Add(go); GameController.Main.player.checkKey = true; } break; case ARMSHROOM: //armShroom go = Instantiate(roomPrefabs.armShroom, v, Quaternion.identity); Enemy armShroom = go.GetComponent <Enemy>(); armShroom.box.Center = v; removeOnLoad.Add(go); break; case GEBLIN: //temp placeholder clone of shroom go = Instantiate(roomPrefabs.geblin, v, Quaternion.identity); Enemy geblin = go.GetComponent <Enemy>(); geblin.box.Center = v; removeOnLoad.Add(go); break; case NOMOVEU: NoMove u = new NoMove(); u.box = new Box(v, 1f, 1f); u.direction = Direction.Up; noMoves.Add(u); break; case NOMOVED: NoMove d = new NoMove(); d.box = new Box(v, 1f, 1f); d.direction = Direction.Down; noMoves.Add(d); break; case NOMOVEL: NoMove l = new NoMove(); l.box = new Box(v, 1f, 1f); l.direction = Direction.Left; noMoves.Add(l); break; case NOMOVER: NoMove r = new NoMove(); r.box = new Box(v, 1f, 1f); r.direction = Direction.Right; noMoves.Add(r); break; } }
public void timeout() { LoseNotif.SetActive(true); //menampilkan LoseNotif NoMove.SetActive(true); //menampilkan NoMove }