public bool Applies(Unit target, Tile source, Tile targetLocation) { distance = TileGrid.GetDelta(startPosition, target); _stats.critBonus = (float)distance / 20f; return(true); }
public void NotifyHealth(Unit unit, int change) { if (change < 0) { if (!UnitManager.Instance.IsItMyTurn(user) && TileGrid.GetDelta(unit, user) <= Distance) { Particle.ExlamationPoint(new Vector3(transform.position.x, transform.position.y + 0.3f)); stacks++; } } }
public void Animate(Unit source, Tile target, Action <Tile> tile, bool hit = true) { if (TileGrid.GetDelta(source, target) == 2) { arrow.Animate(source, target, tile, hit); } else { tackle.Animate(source, target, tile, hit); } }
void FinishedAttackSequence(Unit u) { if (active && UnitManager.Instance.IsItMyTurn(owner) & !threw) { if (TileGrid.GetDelta(this, u) == 2) { storedRetaliations = owner.Retaliations; owner.Retaliations = 0; threw = true; } } }
public bool Includes(Unit u, Tile t) { if (!Active) { return(false); } if (_user != null && !_affectsEnemies && _user.isHostile(u)) { return(false); } return(TileGrid.GetDelta(t, this) <= radius); }
public HashSet <Tile> GetAvailableTargets(Tile tile) { HashSet <Tile> ret = new HashSet <Tile>(); foreach (Unit u in UnitManager.Instance.GetUnits()) { int d = TileGrid.GetDelta(this, u); if (d > 0 && d <= range) { ret.Add(u.Tile); } } return(ret); }
public HashSet <Tile> GetAvailableTargets(Tile tile) { Unit u = GetComponent <Unit>(); HashSet <Unit> units = UnitManager.Instance.GetUnitsByHostility(u); HashSet <Tile> ret = new HashSet <Tile>(); foreach (Unit e in units) { if (TileGrid.GetDelta(u, e) < 5) { ret.Add(e.Tile); } } return(ret); }
void OnDodgeAttack(Unit attacker) { // Debug.Log("I dodged!"); if (TileGrid.GetDelta(this, attacker) == 1) { // Debug.Log("And were in melee!"); Unit user = GetComponent <Unit>(); Tile moveTo = null; if (user.Tile.North && user.Tile.North.Unit == attacker) { moveTo = user.Tile.South; } else if (user.Tile.South && user.Tile.South.Unit == attacker) { moveTo = user.Tile.North; } else if (user.Tile.West && user.Tile.West.Unit == attacker) { moveTo = user.Tile.East; } else if (user.Tile.East && user.Tile.East.Unit == attacker) { moveTo = user.Tile.West; } Vector3 pos = transform.position; if (moveTo && moveTo.Type != TileType.wall && user.MoveTo(moveTo)) { // Debug.Log("We has dodged!"); tweento = transform.position; transform.position = pos; tweenfrom = pos; tween = true; tweenduration = 0f; //StateManager.Instance.DebugPush(GameState.unitAttack); } } }
bool WithinRange(Component location) { return(TileGrid.GetDelta(location, artist) < 4); }