Example #1
0
        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());
        }
Example #2
0
        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);
        }
Example #3
0
        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;
        }
Example #4
0
    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;
    }
Example #5
0
 public void ReplaceToGround(BaseCellObject cellToStep)
 {
     CurrentLevel[cellToStep.X, cellToStep.Y] = new Ground(cellToStep.X, cellToStep.Y);
 }