// Use this for initialization void Awake() { if (instance == null) instance = this; else if (instance != this) Destroy(gameObject); cities = new MapObject[4]; labs = new MapObject[4]; }
/// <summary> /// ctor /// </summary> /// <param name="coordinates">coordinates class</param> /// <param name="map">mapobejct array</param> public MapObjectCoordinates(Coordinates coordinates, MapObject[] map) { _center = map[coordinates.Center]; _north = map[coordinates.North]; _south = map[coordinates.South]; _east = map[coordinates.East]; _west = map[coordinates.West]; _northWest = map[coordinates.NorthWest]; _northEast = map[coordinates.NorthEast]; _southWest = map[coordinates.SouthWest]; _southEast = map[coordinates.SouthEast]; List = new[] { _center, _north, _south, _east, _west, _northEast, _northWest, _southEast, _southWest }; }
///// <summary> ///// Class costructor ///// </summary> ///// <param name="map">map cached previusly</param> ///// <param name="alt">map altitude cached</param> ///// <param name="x">max x of the map</param> ///// <param name="y">max y of the map</param> ///// <param name="index">index of the map</param> //public MapMaker(Color[] map, Color[] alt, int x, int y, int index) //{ // _bitmap = map; // var x1 = x + 10; // var y1 = y + 10; // var lenght = x1 * y1; // #region InitArrays // _mapObjects = new MapObject[lenght]; // _bitmapZ = new sbyte[lenght]; // for (int i = 0; i < alt.Length; i++) // { // _bitmapZ[i] = CalculateHeightValue(alt[i]); // } // for (int i = 0; i < _mapObjects.Length; i++) // { // _mapObjects[i] = new MapObject(); // } // #endregion // _X = x; // _Y = y; // MulDirectory = ""; // mapIndex = index; // _stride = _X; // Random = new Random(DateTime.Now.Millisecond); // AutomaticZMode = true; //} public MapMaker(sbyte[] altitude, AreaColor[] colors, int x, int y, int index) { var x1 = x + 10; var y1 = y + 10; var lenght = x1*y1; #region Init Arrays _mapObjects = new MapObject[lenght]; _bitmapZ = new sbyte[lenght]; _bitmapAreaColor = new AreaColor[lenght]; for (int i = 0; i < altitude.Length; i++) { _bitmapZ[i] = altitude[i]; _bitmapAreaColor[i] = colors[i]; } for (int i = 0; i < lenght; i++) { _mapObjects[i] = new MapObject(); } #endregion //init arrays _X = x; _Y = y; MulDirectory = ""; mapIndex = index; _stride = _X; }
/// <summary> /// Class costructor /// </summary> /// <param name="map">map cached previusly</param> /// <param name="alt">map altitude cached</param> /// <param name="x">max x of the map</param> /// <param name="y">max y of the map</param> /// <param name="index">index of the map</param> public MapMaker(Color[] map, Color[] alt, int x, int y,int index) { BitmapMap = map; BitmapMapZ = alt; var x1 = x + 10; var y1 = y + 10; var lenght = x1*y1; #region InitArrays //_MapOcc = new int[lenght]; //_MapOcc.Initialize(); //_MapAlt = new int[lenght]; //_MapAlt.Initialize(); //_MapID = new int[x1*y1]; //_MapID.Initialize(); //_AddItemMap = new List<Item>[lenght]; //_AddItemMap.Initialize(); ////_Tmp = new Color[lenght]; ////_Tmp.Initialize(); _mapObjects = new MapObject[lenght]; for (int i = 0; i < _mapObjects.Length; i++) { _mapObjects[i] = new MapObject(); } #endregion _X = x; _Y = y; MulDirectory = ""; mapIndex = index; _stride = _X - 1; Random = new Random(DateTime.Now.Millisecond); AutomaticZMode = true; }