public override bool canAttack(GameObject attackee) { if (DistUtility.distCategorizer(this.pos, attackee.GetComponent <characters>().pos, this.range) != 0) { return(true); } return(false); }
public override bool canAttack(GameObject attackee) { if (DistUtility.isImmediateDiagonal(this.pos, attackee.GetComponent <characters>().pos)) { return(true); } return(false); }
public override bool canAttack(GameObject attackee) { characters a = attackee.GetComponent <characters> (); if (DistUtility.isInRange(this.pos, a.pos, this.range)) { return(true); } return(false); }
public bool collisionCheck(GameObject obj) { position pos = DistUtility.getPos(obj); foreach (characters c in this.gameObject.GetComponentsInChildren <characters>()) { if (c.pos.Equals(pos)) { return(true); } } return(false); }
/* * Returns the number of entities that are * next to (only vertically and horizontally) * this character. */ public int numHelpers(List <GameObject> attackingTeam) { int numHelper = 0; foreach (GameObject helper in attackingTeam) { if (DistUtility.isNextTo(this.pos, helper.GetComponent <characters>().pos)) { ++numHelper; } } return(numHelper); }
private List <GameObject> checkForHelpers(List <GameObject> helpingEntities, GameObject defendingPlayer) { characters helperAtr; List <GameObject> helpers = new List <GameObject>(); position defenderPos = defendingPlayer.GetComponent <characters> ().pos; foreach (GameObject helpingEntity in helpingEntities) { helperAtr = helpingEntity.GetComponent <characters>(); if (helpingEntity != this.gameObject && helperAtr.entityType == "attacker") { if (DistUtility.isInbetween(this.pos, defenderPos, helperAtr.pos)) { if (helperAtr.canAttack(defendingPlayer)) { helpers.Add(helpingEntity); } } } } return(helpers); }