public virtual List <Tile> GetSlimesInAttackRange(Slime slime) { List <Tile> canAttack = new List <Tile> (); Vector2 myPos = slime.GetActualTile().getPosition(); foreach (Player p in players) { if (p != slime.GetPlayer()) { foreach (Slime s in p.GetSlimes()) { Vector2 slPos = s.GetActualTile().getPosition(); if (Matrix.GetDistance(slPos, myPos) <= slime.GetAttackRange()) { canAttack.Add(s.actualTile); } } } } return(canAttack); }
public void UpdateInfo(Slime slime, Tile terrain) { if (slime != null) { health.GetComponent <Text>().text = slime.GetMass().ToString(); range.GetComponent <Text>().text = slime.GetAttackRange().ToString(); movement.GetComponent <Text>().text = slime.GetMovementRange().ToString(); attack.GetComponent <Text> ().text = slime.getDamage.ToString() + " (" + slime.selfDamage + ")"; defense.GetComponent <Text> ().text = Math.Round((slime.damageReduction * 100)).ToString(); } else { health.GetComponent <Text>().text = ""; range.GetComponent <Text>().text = ""; movement.GetComponent <Text>().text = ""; attack.GetComponent <Text>().text = ""; defense.GetComponent <Text>().text = ""; } if (terrain != null) { healthT.GetComponent <Text>().text = terrain.GetMass(); rangeT.GetComponent <Text>().text = terrain.GetAttackRange().ToString(); movementT.GetComponent <Text>().text = terrain.GetMovementRange().ToString(); attackT.GetComponent <Text>().text = terrain.GetDamage().ToString(); defenseT.GetComponent <Text>().text = terrain.GetDamageReduction().ToString(); } else { healthT.GetComponent <Text>().text = ""; rangeT.GetComponent <Text>().text = ""; movementT.GetComponent <Text>().text = ""; attackT.GetComponent <Text>().text = ""; defenseT.GetComponent <Text>().text = ""; } }