void Targeting() { if (villians.Count == 3) { if (Input.GetKeyUp(KeyCode.A)) { if (selectedVillian == villians[0]) { selectedVillian = villians[2]; } else if (selectedVillian == villians[1]) { selectedVillian = villians[0]; } else if (selectedVillian == villians[2]) { selectedVillian = villians[1]; } TargetingArrow(); } if (Input.GetKeyUp(KeyCode.D)) { if (selectedVillian == villians[0]) { selectedVillian = villians[1]; } else if (selectedVillian == villians[2]) { selectedVillian = villians[0]; } else if (selectedVillian == villians[1]) { selectedVillian = villians[2]; } TargetingArrow(); } } if (villians.Count == 2) { if (Input.GetKeyUp(KeyCode.D) || Input.GetKeyUp(KeyCode.A)) { if (selectedVillian == villians[1]) { selectedVillian = villians[0]; } else if (selectedVillian == villians[0]) { selectedVillian = villians[1]; } TargetingArrow(); } } }
public static void InterfaceExample() { Villian villian = new Villian { HasFace = false, NumberOfMinions = 17, HairColor = "Pink", Name = "OctoCat", Age = 2 }; BendingUnit bender = new BendingUnit { Name = "Bender", InsertGirder = true, NumberOfLight = 5 }; Cat cat = new Cat { Age = 7, Name = "Josie", Monologue = "Meow meow meow" }; Student student = new Student(); student.Name = "Rhiannon"; Student student2 = new Student(); student2.Name = "Jermaine"; Villian jackie = new Villian(); jackie.Name = "Jackie"; jackie.HasFace = false; Villian max = new Villian(); max.Name = "Mad Max"; max.HasFace = true; IConquer ic = bender; Person[] myPeeps = { student, student2, jackie, max }; for (int i = 0; i < myPeeps.Length; i++) { if (myPeeps[i] is IConquer) { Console.WriteLine(myPeeps[i].Name); } } }
// Use this for initialization void Start() { Debug.Log ("Searching for player"); player = GameObject.FindGameObjectsWithTag ("Player") [0].transform; Debug.Log ("Acquriing villiany"); v = player.gameObject.GetComponentsInChildren<Villian> () [0]; Debug.Log (v != null); bt = GetComponent<BehaviorTree> (); ui = GameObject.FindGameObjectWithTag ("GlobalVar").GetComponent<UIStuff> (); }
public void placeEnemy(Villian v, GameObject enemy, int i) { v.enemy.enemyGO = enemy; GameObject clone = Instantiate(enemy, battlePositions[i].position, transform.rotation) as GameObject; clone.name = v.enemy.enemyGO.name; clone.layer = 9; clone.transform.GetChild(1).gameObject.layer = 9; v.enemy.enemyGO = clone; v.position = i; }
public void EnterBattle(GameObject enemy) { Menu.GAME_PAUSED = true; spawnCharacter(1, false); //!frontrow placeEnemy(villians[0], enemy, 7); selectedVillian = villians[0]; if (villians[0].enemy.supportEnemies) { GameObject support1 = new GameObject(); support1 = Resources.Load("Enemies/Support/" + enemy.name + " support 1") as GameObject; Enemies escript = support1.GetComponent <Enemies>(); escript.SetEnemyStats(); AddEnemies(escript.thisVillian); placeEnemy(villians[1], support1, 9); GameObject support2 = new GameObject(); support2 = Resources.Load("Enemies/Support/" + enemy.name + " support 2") as GameObject; Enemies escript2 = support2.GetComponent <Enemies>(); escript2.SetEnemyStats(); AddEnemies(escript2.thisVillian); placeEnemy(villians[2], support2, 11); } mainChar.player = pscript.player; unalteredJobStats.Attack = pscript.player.job.Attack; unalteredJobStats.Ranged = pscript.player.job.Ranged; unalteredJobStats.Magic = pscript.player.job.Magic; unalteredJobStats.Defense = pscript.player.job.Defense; unalteredJobStats.Speed = pscript.player.job.Speed; inBattle = true; cam.cullingMask = (1 << LayerMask.NameToLayer("Battle")); GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMove>().enabled = false; cam.GetComponent <CameraScript>().enabled = false; //SET CAMERA POSITION FOR BATTLE cam.transform.position = new Vector3(-16f, 8.071196f, 0f); cam.transform.localEulerAngles = new Vector3(22.89324f, 90f, 0f); if (Enemies.BATTLING_BOSS1 || Enemies.BATTLING_BOSS2) { audscript.BossMusic(); } else { audscript.BattleMusic(); } TargetingArrow(); }
// Use this for initialization void Start() { player=GameObject.FindGameObjectsWithTag("Player")[0].transform; v=player.gameObject.GetComponentsInChildren<Villian>()[0]; }
// Use this for initialization void Start() { m_Animator = GetComponent<Animator> (); detection = this.GetComponentsInChildren<DetectorScript> () [0]; v = GetComponentInChildren<Villian> (); }
// Use this for initialization void Start() { v=this.GetComponentsInChildren<Villian>()[0]; targetIndicator=v.cursor.transform; scanLines = Camera.main.GetComponent<VHSPostProcessEffect> (); }
//will return 0 if player wins, 1 if villian wins and 2 if player retreats public static int VisitPlanet(Hero player, Villian villian) { bool playerWins = false; bool villianWins = false; bool retreat = false; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\n" + villian.Story); Console.ResetColor(); do { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\n" + player); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\n" + villian + "\n"); Console.ResetColor(); //display options DisplayMenuOptions.DisplayFightOptions(); string userInputOption = Console.ReadLine(); int userOption; if (Int32.TryParse(userInputOption, out userOption)) { if (userOption == 1 || userOption == 2) { if (userOption == 1) //attack { //hero attacts villian int villianDamage = player.Attack(villian); if (villian.Life > 0) //if villian isn't defeated { Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine($"\n{villian.Name} was struck by {player.Name} for {villianDamage} points."); Console.ResetColor(); } else //if villian is defeated { System.Threading.Thread.Sleep(800); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"\nYou have defeated {villian.Name}!"); Console.WriteLine("You have been awarded 10 points of health, 10 points of max life and 10 points of armour and 300 credits!\n"); Console.ResetColor(); PlayerUpgrades.AddHealth(player, 10); PlayerUpgrades.AddMaxHealth(player, 10); PlayerUpgrades.AddCredits(player, 300); PlayerUpgrades.AddArmour(player, 10); PlayerUpgrades.AddScore(player, 500); playerWins = true; } //villian attacts hero if villian hasn't been defeated if (!playerWins) { int heroDamage = villian.Attack(player); if (player.Life > 0) { System.Threading.Thread.Sleep(800); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine($"{player.Name} was struck by {villian.Name} for {heroDamage} points."); Console.ResetColor(); } else { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"You have been defeated by {villian.Name}\n"); Console.ResetColor(); villianWins = true; } } } else //player retreats { retreat = true; } } else { Console.WriteLine("Invalid choice!"); } } else { Console.WriteLine("Invalid choice!"); } } while (!playerWins && !villianWins && !retreat); //return values based on whats true if (playerWins) { return(0); } else if (villianWins) { return(1); } else { return(2); } }
// Use this for initialization void Start() { v = GameObject.FindGameObjectWithTag ("Player").GetComponentInChildren<Villian> (); }
public void MakeTurn( long targetPosition, TicketType ticket, bool useDoubleTicket = false) { if (MatchState != MatchState.Running) { throw new DomainException("Invalid state"); } CurrentPlayer.MakeTurn( targetPosition, ticket, useDoubleTicket); if (CurrentPlayer.Role == PlayerRole.Detective) { Villian.Tickets.AddTicket(ticket); if (CurrentPlayer.Position() == Villian.Position()) { MatchState = MatchState.DetectivesWon; AddGameEvent(new MatchOverGameEvent(this)); } } else { // it should not be possible to move onto a detective Debug.Assert(!Detectives.Any(p => p.Position() == CurrentPlayer.Position())); ++Round; AddGameEvent(new MatchRoundGameEvent()); if (IsVillianRevealRound) { lastStationVillianReveal = Villian.Position().Position; AddGameEvent(new MatchVillianRevealedGameEvent()); } if (Round >= Settings.Rounds) { MatchState = MatchState.VillianWon; AddGameEvent(new MatchOverGameEvent(this)); } } if (!useDoubleTicket) { Player player = Players .OrderBy(p => p.Order) .FirstOrDefault(p => CurrentPlayer.Order < p.Order); if (player == null) { player = FirstPlayer; } CurrentPlayer = player; CurrentPlayerId = CurrentPlayer.Id; } // ensure next player has any valid moves if (CurrentPlayer.ValidRoutes().Count == 0) { MatchState = CurrentPlayer.Role == PlayerRole.Detective ? MatchState.VillianWon : MatchState.DetectivesWon; AddGameEvent(new MatchOverGameEvent(this)); } AddGameEvent(new MatchTurnGameEvent(this)); }
private void btnMakeCitizens_Click(object sender, RoutedEventArgs e) { Citizen c = new Citizen("Billy", "Bo"); SuperHero s1 = new SuperHero("Bat", "Man") { Height = 74 }; SuperHero s2 = new SuperHero("Squirrel", "Girl") { Height = 54 }; SuperHero s3 = new SuperHero("Cat", "Woman") { Height = 58 }; SuperHero s4 = new SuperHero("The", "Flash") { Height = 66 }; SuperHero s5 = new SuperHero("Ant", "Man") { Height = 64 }; SuperHero s6 = new SuperHero("Aqua", "Man") { Height = 72 }; SuperHero s7 = new SuperHero("Wonder", "Woman") { Height = 76 }; SuperHero s8 = new SuperHero("Spider", "Man") { Height = 62 }; List <int> lst = new List <int>(); HideOut <SuperHero> hallOfJustice = new HideOut <SuperHero>(); hallOfJustice.Members.Add(s1); hallOfJustice.Members.Add(s2); hallOfJustice.Members.Add(s3); hallOfJustice.Members.Add(s4); hallOfJustice.Members.Add(s5); hallOfJustice.Members.Add(s6); hallOfJustice.Members.Add(s7); hallOfJustice.Members.Add(s8); Villian v1 = new Villian(); v1.FirstName = "Joker"; Villian v2 = new Villian { FirstName = "Lex", LastName = "Luther" }; HideOut <Villian> hallOfDoom = new HideOut <Villian>(); hallOfDoom.Members.Add(v1); hallOfDoom.Members.Add(v2); HideOut <Person> cityHall = new HideOut <Person>(); cityHall.Members.Add(s1); cityHall.Members.Add(v1); cityHall.Members.Add(c); Prison <Villian, SuperHero> arkhamAsylum = new Prison <Villian, SuperHero>(); arkhamAsylum.Jailor = s1; arkhamAsylum.Inmates.Add(v1); Prison <SuperHero, Villian> hallOfDoomPrison = new Prison <SuperHero, Villian>(); hallOfDoomPrison.Jailor = v2; hallOfDoomPrison.Inmates.Add(s4); Prison <Person, Citizen> alcatraz = new Prison <Person, Citizen>(); var listOfMans = hallOfJustice.Members.Where(m => m.LastName == "Man"); List <SuperHero> mans = new List <SuperHero>(); foreach (SuperHero m in hallOfJustice.Members) { if (m.LastName == "Man") { mans.Add(m); } } double mxHeight = hallOfJustice.Members.Max(m => m.Height); MessageBox.Show(mxHeight.ToString()); SuperHero shorty = hallOfJustice.Members.FirstOrDefault(sup => sup.Height == 54); MessageBox.Show(shorty.FullName); string s = ""; foreach (SuperHero sup in listOfMans) { s += sup.FullName + ", "; } MessageBox.Show(s); //Button b = (Button)this.FindName("btnMakeCitizens"); //for (int i = 0; i < 9; i++) { // Button btn = (Button)this.FindName("btn_" + i); //} }
int RowDamageModifier(bool enemyAttack, Villian v) { int i = 1; if (enemyAttack) { if (v.enemy.etype == Enemy.type.Melee) { if (!mainChar.frontRow && !v.frontRow) { i = 3; } else if (!mainChar.frontRow || !v.frontRow) { i = 2; } else { i = 1; } } if (v.enemy.etype == Enemy.type.Ranged) { if (!mainChar.frontRow && !v.frontRow) { i = 1; } else if (!mainChar.frontRow || !v.frontRow) { i = 2; } else { i = 3; } } if (v.enemy.etype == Enemy.type.Magic) { if (!mainChar.frontRow && !v.frontRow) { i = 2; } else if (!mainChar.frontRow || !v.frontRow) { i = 1; } else { i = 2; } } } else { if (iscript.equipedWeapon.wtype == Weapon.type.Melee) { if (!mainChar.frontRow && !v.frontRow) { i = 3; } else if (!mainChar.frontRow || !v.frontRow) { i = 2; } else { i = 1; } } if (iscript.equipedWeapon.wtype == Weapon.type.Ranged) { if (!mainChar.frontRow && !v.frontRow) { i = 1; } else if (!mainChar.frontRow || !v.frontRow) { i = 2; } else { i = 3; } } if (iscript.equipedWeapon.wtype == Weapon.type.Magic) { if (!mainChar.frontRow && !v.frontRow) { i = 2; } else if (!mainChar.frontRow || !v.frontRow) { i = 1; } else { i = 2; } } } return(i); }
void Update() { DontDestroyOnLoad(gameObject); if (pscript == null) { findScripts(); setBattle(); } if (inBattle && GameState.STATE != GameState.gameState.gameover) { InitiativeCheck(); Targeting(); //Villians Attack foreach (Villian v in villians) { if (v.turnGuage < 100) { v.turnGuage += v.enemy.Speed * Time.deltaTime * battleSpeed; } if (v.turnGuage >= 100) { if (v.enemy.enemyStatus == Status.Paralyzed && v.paralyzeCounter == 0) { v.enemy.enemyStatus = Status.Normal; v.turnGuage = 0; } else if (v.enemy.enemyStatus == Status.Blind) { int blindroll = Random.Range(0, 10); if (blindroll < 5) { Debug.Log("Blind Attack"); v.turn = true; bool ea = true; int i = RowDamageModifier(ea, v); //Enemy Actions mainChar.player.job.Health -= ascript.Attack.Attack(v.enemy.Damage, mainChar.player.job.Defense) / i; v.turnGuage = 0; if (defending) { attacked = true; Destroy(TempDefMesh); } } else { Debug.Log("Blind Miss"); v.turnGuage = 0; } } else if (v.enemy.enemyStatus == Status.Sleep) { int sleeproll = Random.Range(0, 10); if (sleeproll < 4) { v.enemy.enemyStatus = Status.Normal; } v.turnGuage = 0; } if (v.paralyzeCounter == 0 && v.enemy.enemyStatus == Status.Normal) { v.turn = true; bool ea = true; int i = RowDamageModifier(ea, v); //Enemy Actions mainChar.player.job.Health -= ascript.Attack.Attack(v.enemy.Damage, mainChar.player.job.Defense) / i; v.turnGuage = 0; if (defending) { attacked = true; Destroy(TempDefMesh); } } if (v.enemy.enemyStatus == Status.Paralyzed && v.paralyzeCounter > 0) { v.paralyzeCounter -= 1; v.turnGuage = 0; } } v.enemy.enemyGO.transform.LookAt(mainChar.heroGameObject.transform); } //Main Character Initiative if (defending) { PDefend(); } if (mainChar.turnGuage < 100 && mainChar.initiative < mainChar.maxInitiative) { mainChar.turnGuage += pscript.player.job.Speed * Time.deltaTime * battleSpeed; } if (mainChar.turnGuage >= 100) { if (mainChar.initiative < mainChar.maxInitiative) { mainChar.turn = true; mainChar.initiative++; mainChar.turnGuage = 0; } } //Player health if (mainChar.player.job.Health <= 0 && GameState.STATE != GameState.gameState.gameover) { if (!Enemies.BATTLING_BOSS2) { battleSpeed = 0.0f; audscript.GameOverMusic(); GameState.STATE = GameState.gameState.gameover; } else if (Enemies.BATTLING_BOSS2) { Battle.inBattle = false; ScreenFade.FADING = true; GameState.STATE = GameState.gameState.ending2; AudioManager.ENDING_MUSIC_CHANGE = true; } } //Vilian health List <Villian> villiansToRemove = new List <Villian>(); foreach (Villian v in villians) { if (v.enemy.Health <= 0) { v.enemy.Health = 0; defeatedVillians.Add(v); villiansToRemove.Add(v); TempKnockOut_X = Instantiate(KnockOut_X) as GameObject; TempKO_X.Add(TempKnockOut_X); TempKnockOut_X.transform.position = new Vector3(v.enemy.enemyGO.transform.position.x, v.enemy.enemyGO.transform.position.y + 5, v.enemy.enemyGO.transform.position.z); } } foreach (Villian v in villiansToRemove) { villians.Remove(v); if (villians.Count >= 1) { selectedVillian = villians[0]; TargetingArrow(); } } if (villians.Count > 0 && selectedVillian == null) { selectedVillian = villians[0]; TargetingArrow(); } if (villians.Count == 0) { foreach (Villian v in defeatedVillians) { v.enemy.battled = true; } Reward(); ExitBattle(); } mainChar.heroGameObject.transform.LookAt(selectedVillian.enemy.enemyGO.transform); } }
public void AddEnemies(Villian v) { enemies.Add(v.enemy); v.enemy.index = enemies.IndexOf(v.enemy); villians.Add(v); }