public void assignSurroundingBlocks(MapBlock north, MapBlock south, MapBlock west, MapBlock east)
 {
     this.north = copyIfNotNull(north);
     this.south = copyIfNotNull(south);
     this.west  = copyIfNotNull(west);
     this.east  = copyIfNotNull(east);
 }
        private MapBlock copyIfNotNull(MapBlock mapBlock)
        {
            if (mapBlock == null)
            {
                return(null);
            }

            return(mapBlock.getUnbuildedCopy());
        }
Esempio n. 3
0
        public MapBlock getUnbuildedCopy()
        {
            var result = new MapBlock(mapSymbol, (int)location.x, (int)location.y);

            var inputAttributes = new string[Attributes.Length];

            Array.Copy(Attributes, 0, inputAttributes, 0, Attributes.Length);

            result.updateInputAttributes(inputAttributes);
            result.ObjectsConfig = ObjectsConfig;

            return(result);
        }
        protected void AssignObjectConfigByType(GameObject gameObject, string type, MapBlock mapBlock)
        {
            mapBlock.Initialize();

            var components = gameObject.GetComponents <AbstractGameObjectController>();

            foreach (var component in components)
            {
                if (component == null)
                {
                    continue;
                }
                component.ObjectConfig = mapBlock.getObjectConfigForType(type);
            }
        }
 abstract public void createGameObject(MapBlock mapBlock, Dictionary <string, GameObject> prefabList, ref GameObject MapObject);
 private MapBlock GetEastBlock(MapBlock mapBlock)
 {
     return(GetBlockAtLocation(MapUtils.GetEastLocation(mapBlock.Location)));
 }