protected bool checkEncounter(PointBase unit) { bool findUnit = false; float distance = checkDistance(this, unit); string atackDirection = CheckAtackDirection(this, unit); if (distance <= intellect / 10 && unit.health > 0) { findUnit = true; if (unit.readyDirection == "") { unit.GetDamage(strength * Time.deltaTime); } else if (atackDirection == unit.readyDirection) { unit.MakeShot(this); } else { unit.GetDamage(2 * strength * Time.deltaTime); } selectTarget(unit.positionX, unit.positionY); } float distanceModificator = 1; if (atackDirection == unit.readyDirection) { distanceModificator = 2; } else if (unit.readyDirection != "") { distanceModificator = 0.5f; } if (distance <= distanceModificator * unit.intellect / 10 && unit.health > 0) { unit.MakeShot(this); selectTarget(unit.positionX, unit.positionY); } return(findUnit); }
protected bool checkEncounter(PointBase unit) { bool findUnit = false; float distance = checkDistance(this, unit); string atackDirection = CheckAtackDirection(this,unit); if(distance<=intellect/10 && unit.health>0) { findUnit = true; if(unit.readyDirection=="") { unit.GetDamage(strength*Time.deltaTime); } else if(atackDirection == unit.readyDirection) { unit.MakeShot(this); } else { unit.GetDamage(2*strength*Time.deltaTime); } selectTarget(unit.positionX, unit.positionY); } float distanceModificator = 1; if(atackDirection == unit.readyDirection) { distanceModificator = 2; } else if (unit.readyDirection!="") { distanceModificator = 0.5f; } if(distance<=distanceModificator*unit.intellect/10 && unit.health>0) { unit.MakeShot(this); selectTarget(unit.positionX, unit.positionY); } return findUnit; }
public void MakeShot(PointBase target) { target.GetDamage(strength*Time.deltaTime); game.playOneSound(game.snd_enemycontact,this); }
public void MakeShot(PointBase target) { target.GetDamage(strength * Time.deltaTime); game.playOneSound(game.snd_enemycontact, this); }