public static void StealMessage(BadGuy badGuy, GoodGuy goodGuy, double amount) // parameters came from BadGuy class steal method { Show.Formatted(badGuy.Name + " stole " + amount + " from " + goodGuy.Name); // formatted writeLine Show.Money(badGuy); // uses the submethod to automatically grab badGuy.name and badGuy.money // to pass them as the string and double parameters in the main Money method. Show.Money(goodGuy); }
static void Main(string[] args) { Show.HorizontalDivider(); GoodGuy harry = new GoodGuy("Harry Potter", 999); GoodGuy hermione = new GoodGuy("Hermione Granger", 200); GoodGuy ron = new GoodGuy("Ron Weasley", 100); BadGuy voldemort = new BadGuy("Tom Riddle", 800); BadGuy bellatrix = new BadGuy("Bellatrix Lestrange", 600); BadGuy draco = new BadGuy("Draco Malfoy", 400); Show.HorizontalDivider(); voldemort.Steal(harry, 200); voldemort.Steal(draco, 200); bellatrix.Steal(draco, 200); harry.Capture(bellatrix); harry.Give(hermione, 400); harry.Give(ron, 400); Show.HorizontalDivider(); System.Console.ReadKey(); }
static void Main(string[] args) { Show.HorizontalDivider(); GoodGuy Harry = new GoodGuy("Harry Potter", 999); GoodGuy Hermione = new GoodGuy("Hermione Granger", 200); GoodGuy Ron = new GoodGuy("Ron Weasley", 100); BadGuy Voldemort = new BadGuy("Tom Riddle", 800); BadGuy Bellatrix = new BadGuy("Bellatrix Lestrange", 600); BadGuy Draco = new BadGuy("Draco Malfoy", 400); Show.HorizontalDivider(); Voldemort.steal(Harry, 200); Voldemort.steal(Draco, 200); Bellatrix.steal(Draco, 200); Harry.Capture(Bellatrix); Harry.give(Hermione, 400); Harry.give(Ron, 400); Show.HorizontalDivider(); System.Console.ReadKey(); }
void start() { battle.goodGuy.GetComponent<Button>().interactable = true; player = battle.goodGuy.GetComponent<GoodGuy>(); if(battle.heroCheck.hero1) hero1 = battle.hero1.GetComponent<GoodGuy>(); if(battle.heroCheck.hero2) hero2 = battle.hero2.GetComponent<GoodGuy>(); if (battle.playerTurn) { if (battle.playerTurnCount == 1) { player.RadialMenuCall(); } if (battle.playerTurnCount == 2) { hero1.RadialMenuCall(); } if (battle.playerTurnCount == 3) { hero2.RadialMenuCall(); } } if (battle.hasAttacked) { if (battle.badGuy.GetComponent<BadGuy>().currentHP <= 0) ToBattleWon(); else ToEnemyTurn(); } }
void Start() { if (null == _goodGuy) { _goodGuy = FindObjectOfType <GoodGuy>(); } Assert.IsNotNull <GoodGuy>(_goodGuy); }
private void HandleDamage() { switch (CurrentState) { case State.SearchingForVictim: target = GameManager.Instance.Player; CurrentState = State.Attacking; break; } }
private IEnumerator SearchingRoutine() { while (CurrentState == State.SearchingForVictim) { target = FindCloseEnoughTarget(); if (target != null) { CurrentState = State.Attacking; yield break; } yield return(null); } }
private void attack() { Collider[] hitEnemies = Physics.OverlapSphere(AttackPoint.position, AttackRange, EnemyLayers); Collider[] hitGoodGuy = Physics.OverlapSphere(AttackPoint.position, AttackRange, GoodGuyLayers); foreach (Collider enemy in hitEnemies) { shopSystem.SetMoneyAmount(6f); FindObjectOfType <AudioManager>().Play("Slap"); enemy.GetComponent <Enemy>().SetIsDead(); } foreach (Collider GoodGuy in hitGoodGuy) { FindObjectOfType <AudioManager>().Play("Slap"); GoodGuy.GetComponent <GoodGuy>().WrongHit(); } }
//recieves game object information from TargetSelection script and handles damage. public void AttackSystem(GameObject gg, GameObject bg, bool ggAttack = false, bool bgAttack = false) { //Grab scrips from objects GoodGuy ggScript = gg.GetComponent <GoodGuy>(); BadGuy bgScript = bg.GetComponent <BadGuy>(); if (ggAttack) { bgScript.currentHP -= ggScript.attk; battle.hasAttacked = true; } if (bgAttack) { ggScript.currentHP -= bgScript.attk; battle.hasAttacked = true; } }
private GoodGuy FindCloseEnoughTarget() { GoodGuy[] goodGuys = GameManager.Instance.TargetableGoodGuys.ToArray(); float closestDistance = float.PositiveInfinity; GoodGuy result = null; for (int i = 0; i < goodGuys.Length; i++) { GoodGuy goodGuy = goodGuys[i]; float distance; if (IsCloseEnough(goodGuy.transform.position, out distance)) { //Debug.Log(distance); if (checkRaycasts) { Vector3 direction = goodGuy.transform.position - transform.position; direction.Normalize(); Ray ray = new Ray(transform.position + transform.up * 3f, direction); Debug.DrawRay(ray.origin, ray.direction, Color.red); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100f, aiVisionMask)) { continue; } } if (distance < closestDistance) { closestDistance = distance; result = goodGuy; } } } return(result); }
void start() { battle.goodGuy.GetComponent <Button>().interactable = true; player = battle.goodGuy.GetComponent <GoodGuy>(); if (battle.heroCheck.hero1) { hero1 = battle.hero1.GetComponent <GoodGuy>(); } if (battle.heroCheck.hero2) { hero2 = battle.hero2.GetComponent <GoodGuy>(); } if (battle.playerTurn) { if (battle.playerTurnCount == 1) { player.RadialMenuCall(); } if (battle.playerTurnCount == 2) { hero1.RadialMenuCall(); } if (battle.playerTurnCount == 3) { hero2.RadialMenuCall(); } } if (battle.hasAttacked) { if (battle.badGuy.GetComponent <BadGuy>().currentHP <= 0) { ToBattleWon(); } else { ToEnemyTurn(); } } }
public static void CaptureMessage(GoodGuy goodGuy, BadGuy badGuy, double amount) { Show.Formatted(goodGuy.Name + " captured " + badGuy.Name + " and got " + amount); Show.Money(goodGuy); Show.Money(badGuy); }
// Use this for initialization void Start() { player = spawnGoodGuy.GetComponent<GoodGuy>(); enemy = SpawnBadGuy.GetComponent<BadGuy>(); heroCheck = GameObject.Find("GameController").GetComponent<HeroCheck>(); }
public static void StealMessage(BadGuy badGuy, GoodGuy goodGuy, double amount) { Show.Formatted(badGuy.Name + " stole " + amount + " from " + goodGuy.Name); Show.Money(badGuy); Show.Money(goodGuy); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// private static void Money(GoodGuy goodGuy) { Show.Money(goodGuy.Name, goodGuy.Money); }
public void steal(GoodGuy goodGuy, double amount) { this.money += amount; goodGuy.money -= amount; Show.StealMessage(this, goodGuy, amount); }
///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// public void Steal(GoodGuy goodGuy, double amount) // here's where the info enters { this.Money += amount; // money added goodGuy.Money -= amount; // money subtracted Show.StealMessage(this, goodGuy, amount); // parameters locked in for show class method }
///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// public void Give(GoodGuy otherGoodGuy, double amount) { otherGoodGuy.Money += amount; this.Money -= amount; Show.GiveMessage(this, otherGoodGuy, amount); }
// Update is called once per frame void Update() { player = goodGuy.GetComponent<GoodGuy>(); enemy = badGuy.GetComponent<BadGuy>(); }
public void CombatTimer() { player = goodGuy.GetComponent <GoodGuy>(); }
private void Start() { guy = GameObject.Find("skimo").GetComponent <GoodGuy>(); }
// Use this for initialization void Start() { player = spawnGoodGuy.GetComponent <GoodGuy>(); enemy = SpawnBadGuy.GetComponent <BadGuy>(); heroCheck = GameObject.Find("GameController").GetComponent <HeroCheck>(); }
private static void money(GoodGuy goodGuy) { Show.money(goodGuy.name, goodGuy.money); }
public void CombatTimer() { player = goodGuy.GetComponent<GoodGuy>(); }
public static void GiveMessage(GoodGuy giver, GoodGuy receiver, double amount) { Show.Formatted(giver.Name + " gave " + amount + " to " + receiver.Name); Show.Money(giver); Show.Money(receiver); }
public void AnimationSystem() { GoodGuy playerAniamtion = GameObject.Find("Player").GetComponent <GoodGuy>(); playerAniamtion.AttackAnimation(); }
private static void Money(GoodGuy goodGuy) { Show.Money(goodGuy.Name, goodGuy.Money); // run money method w/ these parameters that auto loaded object info }
// Use this for initialization void Start() { playerScript = player.GetComponentInParent <GoodGuy>(); HPBar.maxValue = playerScript.maxHP; }
// Use this for initialization void Start() { playerScript = player.GetComponentInParent<GoodGuy>(); HPBar.maxValue = playerScript.maxHP; }
///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// public void Steal(GoodGuy goodGuy, double amount) { this.Money += amount; goodGuy.Money -= amount; Show.StealMessage(this, goodGuy, amount); }
// Update is called once per frame void Update() { player = goodGuy.GetComponent <GoodGuy>(); enemy = badGuy.GetComponent <BadGuy>(); }