コード例 #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());
        }
コード例 #2
0
ファイル: Drawer.cs プロジェクト: JinOptimist/Labirinth2019
        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);
        }
コード例 #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;
        }
コード例 #4
0
ファイル: LabGenerator.cs プロジェクト: JinOptimist/UnTowerV2
    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;
    }
コード例 #5
0
 public void ReplaceToGround(BaseCellObject cellToStep)
 {
     CurrentLevel[cellToStep.X, cellToStep.Y] = new Ground(cellToStep.X, cellToStep.Y);
 }