Exemple #1
0
        private void SetPath()
        {
            if (_Model.Path.Count < 1)
            {
                return;
            }

            List <IntVect2> path = PrunePath(_Model.Path);

            if (path.Count < 2)
            {
                Cell firstCell = _GridModelController.GetCell(_Model.Path[0]);
                _GridModelController.KillCell(firstCell);
                return;
            }

            Cell startCell = _GridModelController.GetCell(path[0]);
            Cell endCell   = _GridModelController.GetCell(path[path.Count - 1]);

            if (startCell.Source.PaintColour != endCell.Target.PaintColour)
            {
                Debug.LogError("This can't be happening!!!");
            }
            else
            {
                _Model.AddActiveMission(new ActiveMission(path, startCell.Source, endCell.Target));
            }
        }