コード例 #1
0
    public static TypesBiomNPC GetBiomByTypeModel(SaveLoadData.TypePrefabs typeModel)
    {
        TypesBiomNPC resType = TypesBiomNPC.None;

        if (Enum.IsDefined(typeof(SaveLoadData.TypesBiomBlue), typeModel.ToString()))
        {
            return(TypesBiomNPC.Blue);
        }
        if (Enum.IsDefined(typeof(SaveLoadData.TypesBiomGreen), typeModel.ToString()))
        {
            return(TypesBiomNPC.Green);
        }
        if (Enum.IsDefined(typeof(SaveLoadData.TypesBiomRed), typeModel.ToString()))
        {
            return(TypesBiomNPC.Red);
        }
        if (Enum.IsDefined(typeof(SaveLoadData.TypesBiomViolet), typeModel.ToString()))
        {
            return(TypesBiomNPC.Violet);
        }
        if (Enum.IsDefined(typeof(SaveLoadData.TypesBiomGray), typeModel.ToString()))
        {
            return(TypesBiomNPC.Gray);
        }
        return(resType);
    }
コード例 #2
0
    public static void CreatePriorityFinderDataAsset()
    {
        SaveLoadData.TypePrefabs typeModel = SaveLoadData.TypePrefabs.PrefabField;

        var selectionPath = AssetDatabase.GetAssetPath(Selection.activeObject);

        if (string.IsNullOrEmpty(selectionPath))
        {
            selectionPath = Application.dataPath;
        }

        var path = EditorUtility.SaveFilePanelInProject(
            "Create Priority Finder Data",
            "PriorityFinder" + typeModel.ToString(),
            "Asset not create",
            string.Empty,
            selectionPath);

        if (path.Length > 0)
        {
            var asset = ScriptableObject.CreateInstance <ContainerPriorityFinder>();

            AssetDatabase.CreateAsset(asset, path);
            AssetDatabase.SaveAssets();
            EditorUtility.FocusProjectWindow();
            Selection.activeObject = asset;
        }
    }
コード例 #3
0
        //Clear location for portal
        public void ClearLocationAndCreateBiomFloor(int fieldX, int fieldY)
        {
            var          portal     = this;
            TypesBiomNPC typePortal = portal.TypeBiom;

            string            nameField    = string.Empty;
            List <Vector2Int> findedFileds = new List <Vector2Int>();

            Helper.GetSpiralFields(ref findedFileds, fieldX, fieldY, BuildSize);
            findedFileds.Add(new Vector2Int(fieldX, fieldY));
            foreach (Vector2Int fieldNext in findedFileds)
            {
                Helper.GetNameField_Cache(ref nameField, fieldNext.x, fieldNext.y);
                GenericWorldManager.ClearLayerForStructure(nameField, true);
                SaveLoadData.TypePrefabs portalFloorType = ManagerPortals.PortalBiomFloorsBase[typePortal];

                //Create object Biom Floor
                var    objDataSave = BilderGameDataObjects.BildObjectData(portalFloorType);
                string nameObject  = string.Empty;
                Helper.CreateName_Cache(ref nameObject, portalFloorType.ToString(), nameField, "-1");
                objDataSave.Position = Helper.NormalizFieldToWorld(fieldNext);
                Storage.Data.AddDataObjectInGrid(objDataSave, nameField, "GenericPortal");
                objDataSave.SetNameObject(nameObject, true);

                //%CLUSTER FILL
                //if (objDataSave.IsFloor())
                //{
                Vector2Int posField    = Helper.GetFieldPositByWorldPosit(objDataSave.Position);
                int        clusterSize = AlienJobsManager.GetClusterSize(posField.x, posField.y, objDataSave.TypePrefab);
                (objDataSave as ModelNPC.TerraData).ClusterFillSize = clusterSize;
                (objDataSave as ModelNPC.TerraData).DataCreate      = DateTime.Now;
                //}

                //... Check on Real
                bool isZonaReal = Helper.IsValidPiontInZona(objDataSave.Position.x, objDataSave.Position.y);
                if (!objDataSave.IsReality && isZonaReal)
                {
                    Storage.GenGrid.LoadObjectToReal(nameField);
                }
            }
        }
コード例 #4
0
ファイル: ModelNPC.cs プロジェクト: TD6370/TheCell
 public GameDataUfo()
     : base()
 {
     TypePoolPrefabName = TypePoolPrefab.ToString();
     TypePrefabName     = TypePrefab.ToString();
 }
コード例 #5
0
ファイル: DataObjectInventory.cs プロジェクト: TD6370/TheCell
 public bool EqualsInv(SaveLoadData.TypePrefabs typeRes)
 {
     return(NameInventopyObject == typeRes.ToString());
     //return base.Equals(obj);
 }
コード例 #6
0
 public static bool IsFlore(this SaveLoadData.TypePrefabs model)
 {
     return(Storage.GridData.NamesPrefabFlore.Contains(model.ToString()));
 }
コード例 #7
0
 public static bool IsWood(this SaveLoadData.TypePrefabs model)
 {
     return(Storage.GridData.NamesPrefabObjects.Contains(model.ToString()));
 }
コード例 #8
0
ファイル: MapWorld.cs プロジェクト: TD6370/TheCell
    public Texture2D GetPrefabTexture(SaveLoadData.TypePrefabs typePredab)
    {
        //switch(typePredab)
        //{
        //    case SaveLoadData.TypePrefabs.PrefabElka:
        //        break;
        //    case SaveLoadData.TypePrefabs.PrefabRock:
        //        break;
        //    case SaveLoadData.TypePrefabs.PrefabVood:
        //        break;
        //    case SaveLoadData.TypePrefabs.PrefabWallRock:
        //        break;
        //    case SaveLoadData.TypePrefabs.PrefabWallWood:
        //        break;
        //}
        string strTypePref = typePredab.ToString();

        //if (Storage.Palette == null || Storage.Palette.TexturesPrefabs == null)
        if (Storage.Palette == null)
        {
            Debug.Log("############# GetPrefabTexture  Palette Or TexturesPrefabs is Empty !!!");
            return(null);
        }

        //Sprite[] _sprites = GetSpritesAtlasMapPrefab();

        if (!Storage.Palette.SpritesMaps.ContainsKey(strTypePref))
        //if (!Storage.Palette.TexturesMaps.ContainsKey(strTypePref))
        {
            //Debug.Log("############# GetPrefabTexture   TexturesPrefabs not found type: " + typePredab.ToString());
            Debug.Log("############# GetPrefabTexture   Palette.SpritesMaps not found type: " + typePredab.ToString());
            return(Storage.Palette.TexturesMaps["PrefabField"]); //fix
        }

        //------- test
        List <string> strFilter = new List <string>()
        {
            "PrefabVood",
            "PrefabElka",
            "PrefabRock",
            "PrefabWallRock",
            "PrefabWallWood",
            "PrefabField",
            "PrefabHero",
        };

        //------------------------------
        //Texture2D textureRes = Storage.Palette.TexturesMaps[strTypePref];
        Texture2D textureRes = Storage.Palette.SpritesMaps[strTypePref].texture;

        if (!strFilter.Contains(strTypePref))
        {
            if (test_textureType != strTypePref)
            {
                test_textureType = strTypePref;
                Debug.Log("---- DRAW ICON >> " + strTypePref);
            }
            //textureRes = Storage.Palette.SpritesMaps[strTypePref].texture;

            //var spriteRes = Storage.Palette.SpriteAtlasMapPrefab.GetSprite(strTypePref + "Map");
            //if (spriteRes == null)
            //    Debug.Log("---- DRAW ICON >> spriteRes = null");
            //else
            //    textureRes = spriteRes.texture;
        }

        //Texture2D textureRes = Storage.GridData.PrefabElka.GetComponent<SpriteRenderer>().sprite.texture;
        return(textureRes);
    }