Allows you set safe zones in the world.
- Still in early development.
//player is attackable & checks minimum level
if(entity is Player && IsAttackable()) {
if (level < MinLevel || target.level < MinLevel) {
return;
}
//player is in safe zone
} else if (entity is Player && IsSafeZone()) {
Debug.Log("You cannot attack a player in safe zone.");
return;
}
- Create the safe zone.
public bool InZoneName_Example()
{
return (transform.position.x > StartPos && transform.position.x < EndPos && transform.position.z > StartPos && transform.position.z < EndPos);
}
- Add the safe zone to.
public bool IsSafeZone()
{
return (InZoneName_Example());
}