示例#1
0
    void Start()
    {
        _placeGeneration   = GameObject.Find("GenerationManager").GetComponent <PlaceGeneration>();
        _locationGenerator = GameObject.Find("GenerationManager").GetComponent <LocationGenerator>();

        XCoordsOfGreenMob = new int[_placeGeneration.XCoordsOfGreenMobs.Length];
        YCoordsOfGreenMob = new int[_placeGeneration.YCoordsOfGreenMobs.Length];

        XCoordsOfRedMob = new int[_placeGeneration.XCoordsOfRedMobs.Length];
        YCoordsOfRedMob = new int[_placeGeneration.YCoordsOfRedMobs.Length];

        for (int i = 0; i < _placeGeneration.XCoordsOfGreenMobs.Length; i++)
        {
            XCoordsOfGreenMob[i] = _placeGeneration.XCoordsOfGreenMobs[i];
            YCoordsOfGreenMob[i] = _placeGeneration.YCoordsOfGreenMobs[i];
        }

        for (int i = 0; i < _placeGeneration.XCoordsOfRedMobs.Length; i++)
        {
            XCoordsOfRedMob[i] = _placeGeneration.XCoordsOfRedMobs[i];
            YCoordsOfRedMob[i] = _placeGeneration.YCoordsOfRedMobs[i];
        }

        Creation();
    }
示例#2
0
    void Start()
    {
        _locationGenerator = GameObject.Find("GenerationManager").GetComponent <LocationGenerator>();
        _seeker            = GetComponent <Seeker>();

        _timeManager = GameObject.Find(NameOfTimeManager).GetComponent <TimeManager>();

        _timeToBreeding = 15f;

        _waters    = GameObject.FindGameObjectsWithTag("Water");
        _foods     = GameObject.FindGameObjectsWithTag("Food");
        _greenMobs = GameObject.FindGameObjectsWithTag("GreenMob");

        for (int i = 0; i < _greenMobs.Length; i++)
        {
            if (_greenMobs[i].name == gameObject.name)
            {
                _greenMobs[i] = null;
                _greenMobs    = _greenMobs.Where(x => x != null).ToArray();
            }
        }

        _waterNeeds = GetComponent <WaterNeeds>();
        _foodNeeds  = GetComponent <FoodNeeds>();

        _timeToStuck = 0f;
        _changePlace = new Vector3(0f, 0f, 0f);

        _way = WayPoint.Choose;
    }
        public void Process_CreatesLocationWithCorrectWaterDepth(int shoreLineAggression, double expected)
        {
            //Arrange
            _dataProcessingParams.GpsRoundPrecision = 4;
            _dataProcessingParams.LocGeneratorRuns  = 1;
            _dataProcessingParams.LocGeneratorShoreLineAggression = shoreLineAggression;
            var locationGenerator = new LocationGenerator(_dataProcessingParams, CreateLogger());

            _data.LocationSettings.Shoreline1 = new List <Shoreline>()
            {
                new Shoreline()
                {
                    GpsLat = 66.84595M, GpsLng = 23.9710M
                }, new Shoreline()
                {
                    GpsLat = 66.84590M, GpsLng = 23.9710M
                }
            };
            var createdLat = 66.84595M;
            var createdLng = 23.9710M;

            //Act
            locationGenerator.Process(_data);
            var actual = _data.Rows.First(x => x.GpsLat == createdLat && x.GpsLng == createdLng).WaterDepth;

            //Assert
            actual.Should().Be(expected);
        }
    void Start()
    {
        _locationGenerator = GameObject.Find("GenerationManager").GetComponent <LocationGenerator>();
        _path = GetComponent <AstarPath>();

        AstarData data = _path.data;
        GridGraph gg   = data.gridGraph;

        gg.center =
            new Vector3((-(_locationGenerator.LongOfGrassBlock) / 2 + ((_locationGenerator.LongOfGrassBlock * _locationGenerator.Size) / 2)),
                        +(_locationGenerator.HeightOfGrassBlock) / 2 - ((_locationGenerator.HeightOfGrassBlock * _locationGenerator.Size) / 2),
                        0);

//        gg.width = _locationGenerator.Size * (int) _locationGenerator.HeightOfGrassBlock / 2 * 10;
//        gg.depth = _locationGenerator.Size * (int)_locationGenerator.LongOfGrassBlock / 2 * 10;
//        gg.nodeSize = 0.5f;

        float _long        = _locationGenerator.LongOfGrassBlock * 10;
        float _height      = _locationGenerator.HeightOfGrassBlock * 10;
        float constitution = 1 / NodeSize;


        gg.SetDimensions(
            _locationGenerator.Size * (int)_long / 10 * (int)constitution, //TODO реализовать через nodeSize
            _locationGenerator.Size * (int)_height / 10 * (int)constitution,
            NodeSize);

        _path.Scan();
    }
示例#5
0
 void Start()
 {
     _locationGenerator = GameObject.Find("GenerationManager").GetComponent <LocationGenerator>();
     CreateNumberOfCoords();
     CreateRandomPlaces(XCoordsOfWater, YCoordsOfWater);
     CreateRandomPlaces(XCoordsOfFood, YCoordsOfFood);
     CreateRandomPlaces(XCoordsOfPartsOfRadio, YCoordsOfPartsOfRadio);
     CreateRandomPlaces(XCoordsOfGreenMobs, YCoordsOfGreenMobs);
     CreateRandomPlaces(XCoordsOfRedMobs, YCoordsOfRedMobs);
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance == this)
     {
         Destroy(gameObject);
     }
 }
示例#7
0
        // Here are choosen the locations.
        private static Vector2[] GetLocations()
        {
            var locGenerator = new LocationGenerator(numberOfLocations, maxPos);

            var locations = locGenerator.CircularLocations();

            //var locations = locGenerator.TwoCirclesLocations(1f / 15);
            //var locations = locGenerator.RandomLocations();

            return(locations);
        }
示例#8
0
        public override void Launch()
        {
            Debug.Log(LogExtension.Bold("[UnitSystem][Launch]"));

            _groundPlane = LocationGenerator.Generate();

            _units        = new List <UnitBase>();
            _unitPoolSize = Defaults.UnitPoolSize;

            for (var i = 0; i < _unitPoolSize; i++)
            {
                SpawnUnit();
            }
        }
        public void Process_CreatesOnlyUniqueLocations()
        {
            //Arrange
            _dataProcessingParams.GpsRoundPrecision = 4;
            _dataProcessingParams.LocGeneratorRuns  = 4;
            _dataProcessingParams.LocGeneratorShoreLineAggression = 6;
            var locationGenerator = new LocationGenerator(_dataProcessingParams, CreateLogger());

            //Act
            locationGenerator.Process(_data);
            var actual = _data.Rows;

            //Assert
            actual.Should().OnlyHaveUniqueItems();
        }
示例#10
0
    void Start()
    {
        _sizeOfFoodBlock   = 1.3f;
        _placeGeneration   = GameObject.Find("GenerationManager").GetComponent <PlaceGeneration>();
        _locationGenerator = GameObject.Find("GenerationManager").GetComponent <LocationGenerator>();
        XCoordsOfFood      = new int[_placeGeneration.XCoordsOfFood.Length];
        YCoordsOfFood      = new int[_placeGeneration.YCoordsOfFood.Length];

        for (int i = 0; i < _placeGeneration.XCoordsOfFood.Length; i++)
        {
            XCoordsOfFood[i] = _placeGeneration.XCoordsOfFood[i];
            YCoordsOfFood[i] = _placeGeneration.YCoordsOfFood[i];
        }

        Creation();
    }
    // Use this for initialization
    void Start()
    {
        _placeGeneration   = GameObject.Find("GenerationManager").GetComponent <PlaceGeneration>();
        _locationGenerator = GameObject.Find("GenerationManager").GetComponent <LocationGenerator>();

        XCoordsOfPartsOfRadio = new int[_placeGeneration.XCoordsOfPartsOfRadio.Length];
        YCoordsOfPartsOfRadio = new int[_placeGeneration.YCoordsOfPartsOfRadio.Length];

        for (int i = 0; i < XCoordsOfPartsOfRadio.Length; i++)
        {
            XCoordsOfPartsOfRadio[i] = _placeGeneration.XCoordsOfPartsOfRadio[i];
            YCoordsOfPartsOfRadio[i] = _placeGeneration.YCoordsOfPartsOfRadio[i];
        }

        Creation();
    }
        public void Process_CreatesMissingLocation()
        {
            //Arrange
            _dataProcessingParams.GpsRoundPrecision = 4;
            _dataProcessingParams.LocGeneratorRuns  = 1;
            _dataProcessingParams.LocGeneratorShoreLineAggression = 6;
            var locationGenerator = new LocationGenerator(_dataProcessingParams, CreateLogger());

            var expectedLat   = 66.84595M;
            var expectedLng   = 23.9710M;
            var expectedDepth = 1.5;

            //Act
            locationGenerator.Process(_data);
            var actual = _data.Rows.Any(x => x.GpsLat == expectedLat && x.GpsLng == expectedLng && x.WaterDepth == expectedDepth);

            //Assert
            actual.Should().BeTrue();
        }
示例#13
0
 void Start()
 {
     _locationGenerator = GameObject.Find(NameOfGenerationManager).GetComponent <LocationGenerator>();
     _timeManager       = GameObject.Find(NameOfTimeManager).GetComponent <TimeManager>();
     _foodHave          = _locationGenerator.Rand.Next(StartFoodMin, StartFoodMax);
 }
示例#14
0
 void Start()
 {
     _locationGenerator = GameObject.Find(NameOfGenerationManager).GetComponent <LocationGenerator>();
     _waterHave         = _locationGenerator.Rand.Next(StartWaterMin, StartWaterMax);
 }