Пример #1
0
 // Use this for initialization
 void Start()
 {
     sectorManager   = GameObject.FindGameObjectWithTag("Sector").GetComponent <SectorsManager>();
     carTransform    = gameObject.transform;
     allMapPoints    = sectorManager.getAllMapPoints();
     newSectorPoints = new List <Vector3>();
     currentIndex    = 0;
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     sectorManager =  GameObject.FindGameObjectWithTag("Sector").GetComponent<SectorsManager>();
     carTransform = gameObject.transform;
     allMapPoints = sectorManager.getAllMapPoints();
     newSectorPoints = new List<Vector3>();
     currentIndex = 0;
 }
Пример #3
0
 public void TestMethodReadSectors()
 {
     using (var input = File.OpenText(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..", "Data", "Sectors.yaml")))
     {
         var SectorsData    = YamlExtensions.YamlToObject <SectorsData>(input);
         var flattenSectors = SectorsManager.FlattenSectors(SectorsData);
         var origins        = SectorsManager.ReadOrigins(SectorsData);
     }
 }
Пример #4
0
            protected override void Dispose(bool isDisposing)
            {
                if (_isDisposed)
                {
                    return;
                }
                _isDisposed = true;

                if (isDisposing)
                {
                    _addedBlockEventQueue.Dispose();
                    _removedBlockEventQueue.Dispose();

                    if (_sectorsManager != null)
                    {
                        try
                        {
                            _sectorsManager.Dispose();
                        }
                        catch (Exception)
                        {
                        }

                        _sectorsManager = null;
                    }

                    if (_fileStream != null)
                    {
                        try
                        {
                            _fileStream.Dispose();
                        }
                        catch (Exception)
                        {
                        }

                        _fileStream = null;
                    }

                    if (_updateTimer != null)
                    {
                        try
                        {
                            _updateTimer.Dispose();
                        }
                        catch (Exception)
                        {
                        }

                        _updateTimer = null;
                    }
                }
            }
Пример #5
0
    void checkEnemies()
    {
        SectorsManager smScript    = GameObject.FindGameObjectWithTag("sectorManager").GetComponent <SectorsManager>();
        int            secExplored = smScript.getExploredSector();

        /*if(!relocating && enemies.Count > 2){
         *      int toRelocate = Random.Range(0,enemies.Count);
         *      if(enemies[toRelocate].GetComponent<KamikazeEnemyScript>() != null){
         *              return;
         *      }
         *      enemies[toRelocate].GetComponent<BaseEnemy>().relocate();
         *      enemies.RemoveAt(toRelocate);
         *      relocating = true;
         * }*/
    }
Пример #6
0
    public Food(HerdParameters herdParameters, Transform visualFoodTransform)
    {
        sectorManager =  GameObject.FindGameObjectWithTag("Sector").GetComponent<SectorsManager>();
        pointsCointainer = sectorManager.getContainerClone();

        List<Vector3> initialTrace = pointsCointainer.getAllMapPoints();

        positions = new Position[initialTrace.Count];
        visualFoodPosition = visualFoodTransform;
        this.herdParameters = herdParameters;

        for(int i = 0; i < initialTrace.Count; i++){
            positions[i] = new Position(initialTrace[i]);
        }

        initCenterPositions();
    }
Пример #7
0
    public Food(HerdParameters herdParameters, Transform visualFoodTransform)
    {
        sectorManager    = GameObject.FindGameObjectWithTag("Sector").GetComponent <SectorsManager>();
        pointsCointainer = sectorManager.getContainerClone();

        List <Vector3> initialTrace = pointsCointainer.getAllMapPoints();

        positions           = new Position[initialTrace.Count];
        visualFoodPosition  = visualFoodTransform;
        this.herdParameters = herdParameters;

        for (int i = 0; i < initialTrace.Count; i++)
        {
            positions[i] = new Position(initialTrace[i]);
        }

        initCenterPositions();
    }
Пример #8
0
/*	void checkExplored(){
 *              Vector3 playerPos = player.transform.position;
 *              int xVal = Mathf.FloorToInt((playerPos.x)/(unitSize)) + unitsValue/2;
 *              int yVal = Mathf.FloorToInt((playerPos.y)/(unitSize)) + unitsValue/2;
 *              if(explored[xVal,yVal] == false){
 *                      //Debug.Log("EXPLORED");
 *              }
 *              Destroy(fogs[xVal,yVal]);
 *              explored[xVal,yVal] = true;
 *      }*/
    void openMap()
    {
        if (!status)
        {
            status = true;

            Time.timeScale = 0;
            map.SetActive(true);

            Camera.main.orthographicSize = 6f;

            SectorsManager smScript     = GameObject.FindGameObjectWithTag("sectorManager").GetComponent <SectorsManager>();
            int            secExplored  = smScript.getExploredSector();
            Sector[]       sectorsArray = GameObject.FindGameObjectWithTag("sectorManager").GetComponentsInChildren <Sector>();
            float          val          = sectorsArray[secExplored].outerLimit;


            playerSprite.transform.localPosition = new Vector3(player.transform.position.x / mapWidth, player.transform.position.y / mapWidth, 1);
            playerSprite.transform.rotation      = player.transform.rotation;
        }
    }
Пример #9
0
            public static readonly int SectorSize = 1024 * 256; // 256 KB

            public BlocksManager(string configPath, string blocksPath, BufferManager bufferManager)
            {
                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    const FileOptions FileFlagNoBuffering = (FileOptions)0x20000000;
                    _fileStream = new FileStream(blocksPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, SectorSize, FileFlagNoBuffering);
                }
                else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    _fileStream = new FileStream(blocksPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, SectorSize);
                }
                else
                {
                    throw new NotSupportedException();
                }

                _bufferManager     = bufferManager;
                _sectorsManager    = new SectorsManager(_bufferManager);
                _protectionManager = new ProtectionManager();

                _settings = new Settings(configPath);

                _updateTimer = new WatchTimer(this.UpdateTimer);
            }
Пример #10
0
 void Start()
 {
     sectorManger =  GameObject.FindGameObjectWithTag("Sector").GetComponent<SectorsManager>();
     bestSectorTime = sectorManger.getBestSectorTime(id);
 }
Пример #11
0
 void Start()
 {
     sectorManger   = GameObject.FindGameObjectWithTag("Sector").GetComponent <SectorsManager>();
     bestLapTime    = sectorManger.getBestLapTime();
     bestSectorTime = sectorManger.getBestSectorTime(id);
 }