Ejemplo n.º 1
0
    //Draw Icon on Cell Map
    private void DrawIconCell(string nameField)
    {
        SaveLoadData.TypePrefabs        prefabType      = SaveLoadData.TypePrefabs.PrefabField;
        List <SaveLoadData.TypePrefabs> fieldListPrefbs = new List <SaveLoadData.TypePrefabs>();
        List <Texture2D> listPersonsMapTexture          = new List <Texture2D>();


        foreach (ModelNPC.ObjectData datObjItem in ReaderScene.GetObjectsDataFromGridTest(nameField))
        {
            if (datObjItem.TypePrefabName != SaveLoadData.TypePrefabs.PrefabUfo.ToString() &&
                datObjItem.TypePrefabName != SaveLoadData.TypePrefabs.PrefabBoss.ToString() &&
                datObjItem.TypePoolPrefab != PoolGameObjects.TypePoolPrefabs.PoolPerson)
            {
                prefabType = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), datObjItem.TypePrefabName);
                break;
            }
            //else
            //{
            //    ModelNPC.GameDataBoss bossObj = datObjItem as ModelNPC.GameDataBoss;
            //    if (bossObj != null)
            //    {
            //        prefabType = SaveLoadData.TypePrefabs.PrefabBoss;

            //        fieldListPrefbs.Add(prefabType);

            //        ////+++DRAW PERSON ---------------------------------
            //        Texture2D personMapTexture = TypeBoss.Instance.GetTextureMapForIndexLevel(bossObj.Level);
            //        if (personMapTexture == null)
            //        {
            //            Debug.Log("####### ShowSelectorCell Textute is Empty  TypeBoss.Instance.GetNameTextureMapForIndexLevel(" + bossObj.Level + ") ");
            //            break;
            //        }
            //        listPersonsMapTexture.Add(personMapTexture);
            //        //-----------------------------------------------------
            //    }
            //}
            //fieldListPrefbs.Add(prefabType);
        }


        //bool _isPerson = false;

        //for (int indMap2D = 0; indMap2D < listPersonsMapTexture.Count; indMap2D++)
        //{
        //    Texture2D texturePerson = listPersonsMapTexture[indMap2D];
        //    if (texturePerson == null)
        //    {
        //        Debug.Log("####### ShowSelectorCell Textute is Empty    listPersonsMapTexture[" + indMap2D + "] ");
        //        break;
        //    }

        //    // Draw Texture On Map
        //    //Storage.Map.DrawTextureTo(scaleCell, indErr, addSize, texture, y, x, texturePerson);

        //    int cellX = (int)SelectPointField.x;
        //    int cellY = (int)SelectPointField.y;
        //    Storage.Map.DrawMapCell(cellX, cellY, texturePerson);

        //    Sprite spriteCell = Sprite.Create(texturePerson, new Rect(0.0f, 0.0f, texturePerson.width, texturePerson.height), new Vector2(0.5f, 0.5f), 100.0f);
        //    MapIcon.GetComponent<SpriteRenderer>().sprite = spriteCell;
        //    _isPerson = true;
        //    //MapCellFrame.GetComponent<SpriteRenderer>().sprite.texture = texturePerson;
        //    break;
        //}

        //if (!_isPerson)
        //{
        Texture2D texturePrefab = Storage.Map.GetPrefabTexture(prefabType);

        if (texturePrefab == null)
        {
            Debug.Log("###### ShowSelectorCell  prefabType:" + prefabType + " texturePrefab Is NULL ");
            //continue;
        }
        else
        {
            Sprite spriteCell = Sprite.Create(texturePrefab, new Rect(0.0f, 0.0f, texturePrefab.width, texturePrefab.height), new Vector2(0.5f, 0.5f), 100.0f);
            MapIcon.GetComponent <SpriteRenderer>().sprite = spriteCell;
        }

        //}
    }