void ProcessAns(char c, MainEnemy enemy) { if (enemy == null) { return; } string temp = enemy.GetText(); if (temp [0] == c) { GameObject obj = Instantiate(bullet, transform.position, Quaternion.identity); if (temp.Length > 1) { obj.GetComponent <Bullet> ().SettingTarget(enemy.transform, false); enemy.SetText(temp.Substring(1)); } else { score += enemy.score; obj.GetComponent <Bullet> ().SettingTarget(enemy.transform, true); _PlayerTarget = null; enemy.SetText(""); } score += bonus; bonus++; ad.Play(); } else { bonus = 0; Debug.Log("Wrong Ans"); } }
void Start() { Advertisement.Initialize("2648159"); _mainBoss = FindObjectOfType <MainEnemy>(); _hero = FindObjectOfType <Player>(); mainSound.clip = SoundManager.instance.clips[SoundsIDs.ID_FASE_1]; mainSound.Play(); }
private void Init() { mainPlane = Resources.Load <MainPlane>("Prefab/MainPlane"); mainEnemy = Resources.Load <MainEnemy>("Prefab/Enemys/Enemy"); bossPlane = Resources.Load <MainBoss>("Prefab/Enemys/Boss"); tankPrefab = Resources.Load <TankEnemy>("Prefab/Enemys/Tank"); dataVolume = Resources.Load <GameData>("GameData"); data = Resources.Load <PlayerData>("PlayerData"); maxScore = data.maxScore; }
public MainEnemy GetEnemy(char c) { for (int i = 0; i < listEnemy.Count; i++) { if (listEnemy [i].GetComponent <MainEnemy> ().GetChar() == c) { Debug.Log("ketemu"); MainEnemy me = listEnemy [i].GetComponent <MainEnemy> (); me.SetLocked(); return(me); } } return(null); }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { MainEnemy enemy = other.GetComponent <MainEnemy>(); enemy.health -= damage; enemy.Hurt(); Destroy(); } if (other.CompareTag("Ground")) { Destroy(); } }
public void Input(string a) { char c = a [0]; Debug.Log(_PlayerTarget != null); if (_PlayerTarget != null) { ProcessAns(c, _PlayerTarget.GetComponent <MainEnemy> ()); } else { MainEnemy me = GameObjManager.instance.GetEnemy(c); if (me != null) { _PlayerTarget = me.gameObject; } ProcessAns(c, me); } }
private void ChatService_CoordinatesMessageReceived(BoardCoordinates coordinates) { if (!gameHasEnded) { if (coordinates.messageType == MessageType.playerMovement) { if (StepsCount == 0) { board.State = new Darken(); } else if (StepsCount == SpawnRates.StepsCount / 2) { board.State = new Lighten(); } board.Request(); if (StepsCount >= SpawnRates.StepsCount) { StepsCount = -1; } //currByte -= 1; //BackgroundColor = Color.FromRgb(255, currByte, currByte).ToString(); //OnPropertyChanged(nameof(BackgroundColor)); if (coordinates.id == UniqueID) { MainPlayer.Score++; } if (BonusCount > SpawnRates.BonusCount) { //var a = new BonusFactory(); Random randNum = new Random(); int BonusNumber = randNum.Next(1, 4); //a.CreateBonus(BonusNumber, _chatService).SendBonus(); facade.CreateBonus(BonusNumber); BonusCount = 0; //MainPlayer.SetMemento(memento.Memento); } if (FreezeYourselfStepCount >= SpawnRates.FreezeYourselfStepCount) { facade.CreateDeBuff(TileType.DebuffFreezeYourself); FreezeYourselfStepCount = 0; } if (FreezeOthersStepCount >= SpawnRates.FreezeOthersStepCount) { facade.CreateBuff(TileType.BuffFreezeOthers); FreezeOthersStepCount = 0; } if (BlackSplashCount >= SpawnRates.BlackSplashCount) { facade.CreateDeBuff(TileType.DebuffBlackSplash); BlackSplashCount = 0; } if (ColorSplashCount >= SpawnRates.ColorSplashCount) { facade.CreateBuff(TileType.BuffColorSplash); ColorSplashCount = 0; } if (EnemyCount >= SpawnRates.EnemyCount) { MainEnemy.ChangePossition(); dazeEnemy.Operation(MainEnemy.PosX, MainEnemy.PosY, _connectionProxy); EnemyCount = 0; } if (MagicianCount > SpawnRates.MagicianCount) { Thief newThief = new Magician(); newThief.Run(_connectionProxy); MagicianCount = 0; } if (MasterThiefCount > SpawnRates.MasterThiefCount) { Thief newThief2 = new MasterThief(); newThief2.Run(_connectionProxy); MasterThiefCount = 0; } StepsCount++; BonusCount++; FreezeYourselfStepCount++; FreezeOthersStepCount++; EnemyCount++; BlackSplashCount++; ColorSplashCount++; MasterThiefCount++; MagicianCount++; //jei turi str count bet nedaro if (coordinates.id == UniqueID) { _message = coordinates.message; _x = coordinates.x; _y = coordinates.y; if (TilesSet.GetTile(_x, _y).TileType == TileType.BonusJackPot) { root.AddPoint(ComponentType.JackPot); MainPlayer.PlayerCalculateScore(Score.AddPoints(new BonusFactory().CreateBonus(1, _connectionProxy))); MessageBox.Show(TilesSet.GetTile(_x, _y).TileType.ToString() + MainPlayer.Score); } if (TilesSet.GetTile(_x, _y).TileType == TileType.BonusNormal) { root.AddPoint(ComponentType.Normal); MainPlayer.PlayerCalculateScore(Score.AddPoints(new BonusFactory().CreateBonus(3, _connectionProxy))); MessageBox.Show(TilesSet.GetTile(_x, _y).TileType.ToString() + MainPlayer.Score); } if (TilesSet.GetTile(_x, _y).TileType == TileType.BonusJoke) { root.AddPoint(ComponentType.Joke); MainPlayer.PlayerCalculateScore(Score.ReducePoints(new BonusFactory().CreateBonus(2, _connectionProxy))); MessageBox.Show(TilesSet.GetTile(_x, _y).TileType.ToString() + MainPlayer.Score); } if (TilesSet.GetTile(_x, _y).TileType == TileType.DebuffFreezeYourself) { IceDamageDealer.ProcessRequest(DamageDealerType.IceDamage, MainPlayer); root.AddPoint(ComponentType.FreezeYourself); MainPlayer.RequestStrategy(StrategyType.Frozen); } if (TilesSet.GetTile(_x, _y).TileType == TileType.BuffFreezeOthers) { root.AddPoint(ComponentType.FreezeOthers); MainPlayer.RequestStrategy(StrategyType.Frozen); } if (TilesSet.GetTile(_x, _y).TileType == TileType.BuffColorSplash) { root.AddPoint(ComponentType.ColorSplash); MainPlayer.SendSteppedOnColorSplash(_connectionProxy, _x, _y); MessageBox.Show(TilesSet.GetTile(_x, _y).TileType.ToString()); } if (TilesSet.GetTile(_x, _y).TileType == TileType.DebuffBlackSplash) { root.AddPoint(ComponentType.BlackSplash); MainPlayer.SendSteppedOnBlackSplash(_connectionProxy, _x, _y); MessageBox.Show(TilesSet.GetTile(_x, _y).TileType.ToString()); } if (TilesSet.GetTile(_x, _y).TileType == TileType.DarkHole) { MainPlayer.Score -= 3; } if (TilesSet.GetTile(_x, _y).TileType == TileType.LightHole) { MainPlayer.Score -= 2; } if (TilesSet.GetTile(_x, _y).TileType == TileType.Magician) { Random randNum = new Random(); int number = randNum.Next(1, 1000); string roman = ToRoman(number); ContextRoman context = new ContextRoman(roman); foreach (ExpressionRoman exp in tree) { exp.Interpret(context); } string message = "Does " + roman + " = " + context.Output + " ?"; string title = "Answer the question"; MessageBoxResult result = MessageBox.Show(message, title, MessageBoxButton.YesNo); if (result == MessageBoxResult.No) { IceDamageDealer.ProcessRequest(DamageDealerType.MagitianDamage, MainPlayer); } } if (TilesSet.GetTile(_x, _y).TileType == TileType.MasterThief) { IceDamageDealer.ProcessRequest(DamageDealerType.ThiefDamage, MainPlayer); } if (TilesSet.GetTile(_x, _y).TileType == TileType.Enemy) { IceDamageDealer.ProcessRequest(DamageDealerType.EnemyDamage, MainPlayer); MainPlayer.RequestStrategy(StrategyType.Confused); } TilesSet.AddTile(_x, _y, new Tile(true, true, TileType.Neutral, _x, _y)); OnPropertyChanged(nameof(Message)); OnPropertyChanged(nameof(x)); MainPlayer.PosX = x; MainPlayer.PosY = y; OnPropertyChanged(nameof(y)); OnPropertyChanged(nameof(CurrentPlayerScore)); } } if (coordinates.messageType == MessageType.gamePause || coordinates.messageType == MessageType.gamePauseUndo) { SetGamePause(); } if (MainPlayer.Score >= 100) { MessageBox.Show(root.Display(1)); MainPlayer.SendGameOverMessage(_connectionProxy, UniqueID); MainPlayer.Score = 0; } if (coordinates.messageType == MessageType.gameOver) { gameHasEnded = true; } if (coordinates.messageType == MessageType.reset) { MainPlayer.SetMemento(memento.Memento); x = MainPlayer.PosX; y = MainPlayer.PosY; OnPropertyChanged(nameof(x)); OnPropertyChanged(nameof(y)); OnPropertyChanged(nameof(CurrentPlayerScore)); } } }