public void OnPlayerMovementClick(int x, int y) { if (State != FightState.PlayerTurn) { return; } _gridBhv.ResetAllCellsDisplay(); PlayerBhv.MoveToPosition(x, y, true); }
public override void Activate(int x, int y) { base.Activate(x, y); CharacterBhv.StartCoroutine(Helper.ExecuteAfterDelay(PlayerPrefsHelper.GetSpeed(), () => { CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[x, y].transform.position, null, EffectId, Constants.GridMax - y); CharacterBhv.MoveToPosition(x, y, false); return(true); })); }
public bool Grap(CharacterBhv grabbedOpponentBhv) { _grabbedOpponentBhv = grabbedOpponentBhv; if (_grabbedOpponentBhv == null) { return(false); } _grabbedOpponentBhv.AfterMouvementDelegate = AfterGrap; int x = CharacterBhv.X - _grabbedOpponentBhv.X; int y = CharacterBhv.Y - _grabbedOpponentBhv.Y; if (x != 0) { x = x < 0 ? ++x : --x; } if (y != 0) { y = y < 0 ? ++y : --y; } while (x != 0) { if (GridBhv.Cells[_grabbedOpponentBhv.X + x, _grabbedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.On) { _grabbedOpponentBhv.MoveToPosition(_grabbedOpponentBhv.X + x, _grabbedOpponentBhv.Y + y, false); break; } x = x < 0 ? ++x : --x; } while (y != 0) { if (GridBhv.Cells[_grabbedOpponentBhv.X + x, _grabbedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.On) { _grabbedOpponentBhv.MoveToPosition(_grabbedOpponentBhv.X + x, _grabbedOpponentBhv.Y + y, false); break; } y = y < 0 ? ++y : --y; } CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[_grabbedOpponentBhv.X + x, _grabbedOpponentBhv.Y + y].transform.position, null, EffectId, Constants.GridMax - (_grabbedOpponentBhv.Y + y)); return(true); }
public override int OnTakeDamage(int damages) { if (IsApplyingEffect()) { if (Helper.IsPosValid(_currentTargetX, _currentTargetX) && !GridBhv.IsOpponentOnCell(_currentTargetX, _currentTargetY, true, true)) { CharacterBhv.MoveToPosition(_currentTargetX, _currentTargetY, false); CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[_currentTargetX, _currentTargetY].transform.position, null, EffectId, Constants.GridMax - _currentTargetY); } EffectDuration = 0; CharacterBhv.LoseSkillEffect(Effect); return(0); } return(damages); }
public bool Push(CharacterBhv pushedOpponentBhv) { _pushedOpponentBhv = pushedOpponentBhv; if (_pushedOpponentBhv == null) { return(false); } int x = _pushedOpponentBhv.X - CharacterBhv.X; int y = _pushedOpponentBhv.Y - CharacterBhv.Y; if (!Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) || GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type != CellType.On || GridBhv.IsOpponentOnCell(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, true)) { if ((Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) && GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.Off) || GridBhv.IsOpponentOnCell(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, true)) { var floatAmount = 30.0f * CharacterBhv.Character.GetDamageMultiplier(); //pushedOpponentBhv.TakeDamages(new Damage((int)floatAmount)); var damage = new Damage((int)floatAmount); CharacterBhv.Instantiator.PopText("-" + pushedOpponentBhv.Character.TakeDamages(damage.Amount).ToString(), pushedOpponentBhv.transform.position, damage.Critical ? TextType.HpCritical : TextType.Hp); pushedOpponentBhv.SkinContainer.OnHit(); } else if (!Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) || GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.Impracticable) { pushedOpponentBhv.LosePm(1); } return(false); } _pushedOpponentBhv.AfterMouvementDelegate = AfterPush; _pushedOpponentBhv.MoveToPosition(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, false); CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].transform.position, null, EffectId, Constants.GridMax - (_pushedOpponentBhv.Y + y)); return(true); }