private List <BaseCellObject> GetNearCells(BaseCellObject cell) { var near = new List <BaseCellObject>(); near.Add(LabLevel[cell.X + 1, cell.Y]); near.Add(LabLevel[cell.X - 1, cell.Y]); near.Add(LabLevel[cell.X, cell.Y + 1]); near.Add(LabLevel[cell.X, cell.Y - 1]); return(near.Where(x => x != null).ToList()); }
private static bool HeroCanSeeThis(BaseCellObject cellObject) { if (cellObject is StairsDown || cellObject is StairsUp) { return(true); } var hero = Hero.GetHero; var distance = Math.Sqrt(Math.Pow(hero.X - cellObject.X, 2) + Math.Pow(hero.Y - cellObject.Y, 2)); //return distance < 4; return(true); }
private void ApplyCellAction(BaseCellObject cellToStep) { var hero = Hero.GetHero; if (cellToStep?.TryToStepHere(this) ?? false) { hero.X = cellToStep.X; hero.Y = cellToStep.Y; } if (cellToStep?.CallAfterStep != null) { cellToStep.CallAfterStep(); } DescLastAction = cellToStep?.DescAction; }
private void GrowWall(BaseCellObject wall, Vector3 heroPosition) { wall.Height = 0.01f; var distance = Mathf.RoundToInt(Vector3.Distance(heroPosition, new Vector3(wall.X, 0, wall.Y))); Thread.Sleep(100 * distance); while (wall.Height < 1) { wall.Height += 1 / (float)CountOfStepForGrowWall; var waitSecond = Mathf.RoundToInt(1000 * SpeedOfDrawLab / CountOfStepForGrowWall); Thread.Sleep(waitSecond); } wall.Height = 1; }
public void ReplaceToGround(BaseCellObject cellToStep) { CurrentLevel[cellToStep.X, cellToStep.Y] = new Ground(cellToStep.X, cellToStep.Y); }