Ejemplo n.º 1
0
    /* Is the currently loaded level valid? */
    public bool[] LevelIsValid()
    {
        bool[] validityCheck = { false, false, false, false };
        if (!metadata.isLoaded)
        {
            return(validityCheck);
        }
        Tile battlebusSpawn = null;
        Tile goonEntryDoor  = null;
        Tile goonExitDoor   = null;

        foreach (Tile thisTile in Grid.AllTiles)
        {
            if (thisTile.HasPropOrigin &&
                PropProperties.GetWaypointTarget(thisTile.Prop.Type) == PropWaypointUser.GOON_BATTLEBUS &&
                PropProperties.GetWaypointType(thisTile.Prop.Type) == PropWaypointType.MIDDLE)
            {
                battlebusSpawn   = thisTile;
                validityCheck[0] = true;
                if (validityCheck[1] && validityCheck[3])
                {
                    break;
                }
            }
            else if (thisTile.HasPropOrigin &&
                     PropProperties.GetWaypointTarget(thisTile.Prop.Type) == PropWaypointUser.GOONS &&
                     PropProperties.GetWaypointType(thisTile.Prop.Type) == PropWaypointType.START)
            {
                goonEntryDoor    = thisTile;
                validityCheck[3] = true;
                if (validityCheck[0] && validityCheck[1])
                {
                    break;
                }
            }
            else if (thisTile.HasPropOrigin &&
                     PropProperties.GetWaypointTarget(thisTile.Prop.Type) == PropWaypointUser.GOONS &&
                     PropProperties.GetWaypointType(thisTile.Prop.Type) == PropWaypointType.END)
            {
                goonExitDoor     = thisTile;
                validityCheck[1] = true;
                if (validityCheck[0] && validityCheck[3])
                {
                    break;
                }
            }
        }
        //TODO: This is where you'd implement your pathfinding check!
        if (battlebusSpawn != null && goonEntryDoor != null)
        {
            validityCheck[2] = true /*AStarPathfinding.IsPathValid(battlebusSpawn.Position, goonEntryDoor.Position)*/;
        }
        if (validityCheck[2] && goonEntryDoor != null && goonExitDoor != null)
        {
            validityCheck[2] = true /*AStarPathfinding.IsPathValid(goonEntryDoor.Position, goonExitDoor.Position)*/;
        }
        return(validityCheck);
    }
Ejemplo n.º 2
0
    /* Set the prop type for the rotation selector */
    public void SetPropType(PropTypes _type)
    {
        propDesc.text = PropProperties.GetDescription(_type);

        frontBrush.Initialise(_type, PropRotation.FACING_FRONT);
        leftBrush.Initialise(_type, PropRotation.FACING_LEFT);
        backBrush.Initialise(_type, PropRotation.FACING_BACK);
        rightBrush.Initialise(_type, PropRotation.FACING_RIGHT);
    }
Ejemplo n.º 3
0
 /* Set prop type & rotation */
 public void Initialise(PropTypes _type, PropRotation _rot)
 {
     rotationOverride = _rot;
     objectType       = _type;
     gameObject.GetComponent <Image>().sprite = PropProperties.GetSpriteSet(objectType).GetByRotation(rotationOverride).sprite;
     gameObject.SetActive((gameObject.GetComponent <Image>().sprite != null));
     if (draggableObject)
     {
         draggableObject.GetComponent <DraggableEditorComponent>().Initialise(_type, _rot);
     }
 }
Ejemplo n.º 4
0
    void OnDrawGizmosSelected()
    {
#if UNITY_EDITOR
        for (int i = 0; i < _tiles.Count; i++)
        {
            Gizmos.color = Color.red;
            Gizmos.DrawWireCube(_tiles[i].Position, _tiles[i].Dimensions);
            Vector2 drawPos = _tiles[i].Position + new Vector2(-0.25f, 0.25f);
            Handles.Label(drawPos, "X: " + _tiles[i].GridPos.x + "\nY: " + _tiles[i].GridPos.y);
            if (ShowExtraInfoInGizmo)
            {
                if (_tiles[i].IsOccupied)
                {
                    Handles.Label(drawPos, "\n\nOCCUPIED");
                }
                if (_tiles[i].HasPropOrigin)
                {
                    Handles.Label(drawPos, "\n\n\n\nHAS PROP ORIGIN");
                }
            }
            if (_tiles[i].HasProp)
            {
                Gizmos.color = Color.green;
                if (HighlightTilesWithPropsInGizmo && _tiles[i].HasPropOrigin)
                {
                    Gizmos.DrawCube(_tiles[i].Position, _tiles[i].Dimensions);
                }
                Gizmos.color = Color.yellow;
                if (HighlightTilesWithPropsInGizmo && !_tiles[i].HasPropOrigin)
                {
                    Gizmos.DrawCube(_tiles[i].Position, _tiles[i].Dimensions);
                }
                if (ShowExtraInfoInGizmo)
                {
                    Handles.Label(drawPos, "\n\n\nHAS PROP");
                }
            }
            if ((_tiles[i].HasProp && PropProperties.IsUnpathable(_tiles[i].Prop.Type)) ||
                (_tiles[i].IsOccupied && !TileProperties.IsPathable(_tiles[i].Occupier.Type)))
            {
                Gizmos.color = Color.red;
                if (HighlightUnpathableTilesInGizmo)
                {
                    Gizmos.DrawCube(_tiles[i].Position, _tiles[i].Dimensions);
                }
                if (ShowExtraInfoInGizmo)
                {
                    Handles.Label(drawPos, "\n\n\n\n\nTILE IS UNPATHABLE");
                }
            }
        }
#endif
    }
Ejemplo n.º 5
0
    void CheckIfViewIsBlocked()
    {
        Vector3 StartPoint     = transform.position;
        Vector3 Target         = PlayerTransform.position;
        Vector3 TargetLocation = Target - StartPoint;
        int     CamLayerMask   = 1 << 9;

        //CamLayerMask = ~CamLayerMask;
        RaycastHit[] hits;
        hits = Physics.RaycastAll(StartPoint, TargetLocation, DistanceFromPlayer, CamLayerMask);

        for (int i = 0; i < hits.Length; i++)
        {
            RaycastHit     hit = hits[i];
            Collider       ObjectBeingHitRightnow = hit.transform.GetComponent <Collider>();
            PropProperties PropScript             = hit.transform.GetComponent <PropProperties>();
            if (PropScript)
            {
                PropScript.PassValues(FadeSpeed, FadeTeaTime, ObjectTransparency);
                PropScript.BlockingView           = true;
                PropScript.IfRayIsStillThereCheck = 0.1f;
            }
        }
    }
Ejemplo n.º 6
0
    public IEnumerator Load(int level_guid)
    {
        loadedInDebug = false;

        AsyncPropAndTileSetup.Instance.LoadConfigs();
        while (!TileProperties.Loaded || !PropProperties.Loaded)
        {
            yield return(new WaitForEndOfFrame());
        }

        if (!didTriggerMetaUpdate)
        {
            StartCoroutine(RefreshLevelData());
        }
        while (!hasUpdatedMetas)
        {
            yield return(new WaitForEndOfFrame());
        }

        Unload();

        //Find our metadata
        LevelMetadata ourMeta = null;

        foreach (LevelMetadata meta in LevelMetadata)
        {
            if (meta.levelGUID == level_guid)
            {
                ourMeta = meta;
                break;
            }
        }
        if (ourMeta == null)
        {
            Debug.LogError("Cannot find requested level GUID!");
            yield break;
        }
        metadata = ourMeta;
        metadata.SetLoadState(false);
        Debug.Log("Loading level: " + metadata.levelName + " (GUID " + metadata.levelGUID + ")");
        int invisibleProps = 0;
        int invisibleTiles = 0;

        string configFile = Application.streamingAssetsPath + "/LEVELS/" + metadata.levelName + ".dwb";

#if !UNITY_WEBGL
        if (File.Exists(configFile)) //It's ok not to exist if we're in editor
        {
#endif
        //Load our level config
        levelData = null;
        StartCoroutine(FileLoader.Instance.LoadAsBytes(configFile, LoadCallback));
        while (levelData == null || !levelData.CanRead)
        {
            yield return(new WaitForEndOfFrame());
        }

        //Read our level config
        BinaryReader reader = new BinaryReader(levelData);
        int versionNum      = reader.ReadInt32();
        if (!(versionNum == LevelFileVersion.VERSION_NUM))     //This can allow through back-supported config versions
        {
            Debug.LogError("Tried to load an outdated level file!");
            reader.Close();
            yield break;
        }
        if (versionNum != LevelFileVersion.VERSION_NUM)
        {
            Debug.LogWarning("This level uses file version " + versionNum + " (latest is " + LevelFileVersion.VERSION_NUM + "). While this version is supported, please re-save the level in editor ASAP to keep updated with the latest features.");
        }
        int tileCount    = reader.ReadInt32();
        Vector2 gridDims = new Vector2(reader.ReadInt16(), reader.ReadInt16());
        if (gridDims != theGrid.GridTileDims)
        {
            Debug.LogError("Grid resizing is unsupported! This level is invalid.");
            reader.Close();
            yield break;
        }

        //Load occupiers
        int tileOccupierCount = reader.ReadInt32();
        for (int i = 0; i < tileOccupierCount; i++)
        {
            Tile parentTile = theGrid.AllTiles[reader.ReadInt32()];
            int  enumIndex  = reader.ReadInt16();

            if (!Enum.IsDefined(typeof(TileTypes), enumIndex))
            {
                Debug.LogError("ERROR! When loading, a tile's occupier was of a type that no longer exists.");
                continue;
            }

            //Populate the tile's occupier
            GameObject parentTileObject = null;
            parentTileObject = Instantiate(worldTileObject, parentTile.Position, Quaternion.identity) as GameObject;
            TileTypes tileType = (TileTypes)enumIndex;
#if UNITY_EDITOR
            if (!TileProperties.IsVisibleInEditor(tileType))
            {
                invisibleTiles++;
            }
#endif
            parentTileObject.GetComponent <LevelTileEntity>().Initialise(tileType, parentTile, false);
        }

        //Load props
        int tilePropCount = reader.ReadInt32();
        for (int i = 0; i < tilePropCount; i++)
        {
            if (versionNum == 13)
            {
                reader.BaseStream.Position += 4;
            }
            int          enumIndex = reader.ReadInt16();
            PropRotation rotation  = (PropRotation)reader.ReadInt16();

            int         propTileCount = reader.ReadInt32();
            List <Tile> propTiles     = new List <Tile>();
            for (int x = 0; x < propTileCount; x++)
            {
                propTiles.Add(theGrid.AllTiles[reader.ReadInt32()]);
            }

            if (!Enum.IsDefined(typeof(PropTypes), enumIndex))
            {
                Debug.LogError("ERROR! When loading, a tile's prop was of a type that no longer exists.");
                continue;
            }

            PropTypes  propType = (PropTypes)enumIndex;
            GameObject parentTileDecoratorObject = Instantiate(worldPropObject, propTiles[0].Position, Quaternion.identity) as GameObject;
#if UNITY_EDITOR
            if (!PropProperties.IsVisibleInEditor(propType))
            {
                invisibleProps++;
            }
#endif
            parentTileDecoratorObject.GetComponent <LevelPropEntity>().Initialise(propType, propTiles, rotation, false);
        }

        //Load some metadata
        metadata.SetGoonCount(reader.ReadInt32());
        metadata.SetHazardCount(reader.ReadInt32());

        reader.Close();

        //Refresh all sprites to get the right contexts
        for (int i = 0; i < Grid.AllTiles.Count; i++)
        {
            if (Grid.AllTiles[i].IsOccupied)
            {
                Grid.AllTiles[i].Occupier.RefreshSprite();
            }
        }

        metadata.SetLoadState(true);
#if !UNITY_WEBGL
    }

    else
    {
        //User is just starting to create this level
        metadata.SetLoadState(true);
        LevelEditor.Instance.SaveLevel();
    }
#endif

        //Show/hide grid depending on editor state
        GetComponent <SpriteRenderer>().enabled = IsInEditor;

        if (invisibleProps == 0 && invisibleTiles == 0)
        {
            Debug.Log("Level loaded without warnings!");
        }
        else
        {
            Debug.LogWarning("Level loaded successfully, but contains " + invisibleProps + " deprecated props and " + invisibleTiles + " deprecated tiles. Consider updating this content.");
        }
        LevelLoadCompleted?.Invoke();

        validateNextTick = true;
    }
Ejemplo n.º 7
0
    public void Initialise(PropTypes _type, List <Tile> _tiles, PropRotation _rotation = PropRotation.FACING_FRONT, bool doSpawnAnim = true)
    {
        if (_tiles.Count == 0)
        {
            Debug.LogError("Failed to init prop! No tiles have been passed for us to occupy!");
            Destroy(this.gameObject);
            return;
        }

        gridTile = _tiles; //_tiles[0] should be our origin. The others can be in any order!
        propType = _type;

        childObject = gameObject.transform.GetChild(0).gameObject;
        ourSprite   = childObject.GetComponent <SpriteRenderer>();
        ourCollider = GetComponent <PolygonCollider2D>();

        if (!doSpawnAnim)
        {
            GetComponent <Animator>().speed = 9999;
        }

        hasInitialised = true;
        spriteSet      = PropProperties.GetSpriteSet(propType);

        //Try and apply ourselves as the prop to our passed tile(s)
        for (int i = 0; i < gridTile.Count; i++)
        {
            gridTile[i].SetProp(null, true, false); //We have to force animations off, else the coroutine time throws off the execution order. TODO: nicer fix?
        }
        for (int i = 0; i < gridTile.Count; i++)
        {
            if (!gridTile[i].SetProp(this))
            {
                Debug.LogWarning("Failed to init prop! Most likely dumb user has tried to decorate an unoccupied tile.");
                foreach (Tile aTile in gridTile)
                {
                    aTile.SetProp(null);
                }
                Destroy(this.gameObject);
                return;
            }
            if (i == 0)
            {
                gridTile[i].SetPropOrigin();
            }
        }

        //Set rotation-based sprite/collider and sorting
        SetRotation(_rotation);
        int offset = (int)(LevelManager.Instance.Grid.GridTileDims.y - _tiles[0].GridPos.y);

        ourSprite.sortingOrder = (5 * offset) + offset + TileProperties.GetZOffset(_tiles[0].Occupier.Type) + PropProperties.GetZOffset(propType) + 3;

        //For neatness in the editor, parent to the grid
        this.gameObject.transform.parent = LevelManager.Instance.Grid.gameObject.transform;

        //Remove touchable layer if out of editor
        if (!LevelManager.Instance.IsInEditor)
        {
            gameObject.layer = 0;
            gameObject.transform.GetChild(0).gameObject.layer = 0;

            //If scriptable object, try to assign script
            if (PropProperties.IsScriptedObject(propType))
            {
                try
                {
                    string componentType = PropProperties.GetScriptClassName(propType);
                    gameObject.AddComponent(System.Type.GetType(componentType));
                }
                catch (System.Exception e)
                {
                    Debug.LogError("Failed to assign script to scripted object!");
                    Debug.LogError(e.Message);
                }
            }
        }
    }
Ejemplo n.º 8
0
    private void Update()
    {
        //Touch interaction
        if (uiElementInteraction.IsTouchDown())
        {
            draggableObject.transform.SetParent(EditorModeButtonControllers.Instance.gameObject.transform); //HACKY!
            uiElementInteraction.MoveToTouch();
            spawnedWorldObject = false;

            //Show validity markers
            if (!shownInvalidMarkers)
            {
                for (int i = 0; i < LevelManager.Instance.Grid.AllTiles.Count; i++)
                {
                    if (LevelManager.Instance.Grid.AllTiles[i].IsOccupied && !TileIsValidForUs(LevelManager.Instance.Grid.AllTiles[i]))
                    {
                        LevelManager.Instance.Grid.AllTiles[i].Occupier.ShowInvalidMarker(true);
                    }
                }
                shownInvalidMarkers = true;
            }
        }
        else
        {
            if (!spawnedWorldObject)
            {
                Vector3 inWorldPos = Camera.main.ScreenToWorldPoint(draggableObject.transform.position + new Vector3(uiElementInteraction.Rect.width / 2, uiElementInteraction.Rect.height / 2, 0));
                inWorldPos.z = 0;
                if (LevelManager.Instance.Grid.GetTileAtPosition(inWorldPos) == null)
                {
                    Destroy(this);
                }
                List <Tile> worldTileList = LevelManager.Instance.Grid.GetNeighboursFromBounds(LevelManager.Instance.Grid.GetTileAtPosition(inWorldPos), PropProperties.GetSpriteSet(objectType).GetByRotation(rotationOverride).bounds);

                //Validity check
                bool tilesAreValid = true;
                for (int i = 0; i < worldTileList.Count; i++)
                {
                    if (!(worldTileList[i].IsOccupied && TileIsValidForUs(worldTileList[i])))
                    {
                        tilesAreValid = false;
                        break;
                    }
                }

                //If the tiles are valid, spawn us in them
                if (tilesAreValid)
                {
                    GameObject inWorldObject = Instantiate(LevelManager.Instance.WorldPropObject, worldTileList[0].Position, Quaternion.identity) as GameObject;
                    inWorldObject.GetComponent <LevelPropEntity>().Initialise(objectType, worldTileList, rotationOverride);
                }
                //Otherwise, we can't occupy the tile - the user must delete the existing tile
                else
                {
                    Debug.LogWarning("Tile either isn't occupied or doesn't allow props!");
                    //TODO: nice animation here
                }
                spawnedWorldObject = true;

                //Hide the validity markers
                for (int i = 0; i < LevelManager.Instance.Grid.AllTiles.Count; i++)
                {
                    if (LevelManager.Instance.Grid.AllTiles[i].IsOccupied)
                    {
                        LevelManager.Instance.Grid.AllTiles[i].Occupier.ShowInvalidMarker(false);
                    }
                }
                shownInvalidMarkers = false;
            }

            //Hacky fix for new animated UI
            draggableObject.transform.SetParent(gameObject.transform);
            draggableObject.transform.position = gameObject.transform.position;
        }
    }
Ejemplo n.º 9
0
 private bool TileIsValidForUs(Tile worldTile)                                                                               //Assumes occupied tile
 {
     return(TileProperties.AllowsProps(worldTile.Occupier.Type) &&                                                           //That tile must allow props
            (int)TileProperties.GetUseage(worldTile.Occupier.Type) == (int)PropProperties.GetPlacementLocation(objectType)); //And it must match our intended location
 }
Ejemplo n.º 10
0
    /* Set initial editor UI states */
    private void Start()
    {
#if UNITY_WEBGL
        Debug.LogError("LEVEL EDITING IS NOT SUPPORTED IN WEBGL");
#else
        //Get animator and setup UI
        animatorComponent = GetComponent <Animator>();
        animatorComponent.SetBool("showLoadscreenTransition", true);
        SwapMainState(MAIN_UI_STATE.PRE_EDIT_STATE);

        //Setup dynamic content fields
        int tileCount = 0;
        foreach (TileTypes tileType in Enum.GetValues(typeof(TileTypes)))
        {
            if (!TileProperties.IsVisibleInEditor(tileType))
            {
                continue;
            }
            tileCount++;
        }
        float UI_SCALER = GetComponent <CanvasScaler>().referenceResolution.x / Screen.width;
        float x_offset  = BrushComponentUI_OFFSET.transform.position.x - BrushComponentUI.transform.position.x;
        float pos_x     = BrushComponentUI.transform.position.x;
        DynamicallyResizingContent_Tiles.GetComponent <RectTransform>().offsetMax =
            new Vector2(
                (tileCount * x_offset * UI_SCALER) - 1350,
                DynamicallyResizingContent_Tiles.GetComponent <RectTransform>().offsetMax.y
                );
        foreach (TileTypes tileType in Enum.GetValues(typeof(TileTypes)))
        {
            if (!TileProperties.IsVisibleInEditor(tileType))
            {
                continue;
            }
            GameObject newBrush = Instantiate(BrushComponentUI, new Vector3(pos_x, BrushComponentUI.transform.position.y), Quaternion.identity) as GameObject;
            newBrush.transform.SetParent(BrushComponentUI.transform.parent);
            newBrush.GetComponent <BrushEditorComponent>().objectType = tileType;
            newBrush.SetActive(true);
            newBrush.transform.localScale = new Vector3(1, 1, 1);
            pos_x += x_offset;
        }
        int propCount = 0;
        foreach (PropTypes propType in Enum.GetValues(typeof(PropTypes)))
        {
            if (!PropProperties.IsVisibleInEditor(propType))
            {
                continue;
            }
            propCount++;
        }
        pos_x = DraggableComponentUI.transform.position.x;
        DynamicallyResizingContent_Props.GetComponent <RectTransform>().offsetMax =
            new Vector2(
                (propCount * x_offset * UI_SCALER) - 1350,
                DynamicallyResizingContent_Props.GetComponent <RectTransform>().offsetMax.y
                );
        foreach (PropTypes propType in Enum.GetValues(typeof(PropTypes)))
        {
            if (!PropProperties.IsVisibleInEditor(propType))
            {
                continue;
            }
            GameObject newDraggable = Instantiate(PropButtonNEW, new Vector3(pos_x, DraggableComponentUI.transform.position.y), Quaternion.identity) as GameObject;
            newDraggable.transform.SetParent(DraggableComponentUI.transform.parent);
            newDraggable.GetComponent <PropButton>().SetPropType(propType);
            newDraggable.SetActive(true);
            newDraggable.transform.localScale = new Vector3(1, 1, 1);
            pos_x += x_offset;
        }
        PropRotationSelector.Instance.Hide();
#endif
    }
Ejemplo n.º 11
0
    private IEnumerator LoadPropConfigAsync(BinaryReader reader)
    {
        List <PropData> propData   = new List <PropData>();
        int             versionNum = reader.ReadInt32();
        int             entryCount = reader.ReadInt32();

        for (int i = 0; i < entryCount; i++)
        {
            PropData thisData = new PropData();
            bool     loadedOK = true;

            thisData.propID         = reader.ReadInt32();
            thisData.propName       = (PropTypes)thisData.propID;
            thisData.propNameString = reader.ReadString();
            if (thisData.propName.ToString() != thisData.propNameString)
            {
                loadedOK = false;
            }
            thisData.propDesc   = reader.ReadString();
            thisData.isWaypoint = reader.ReadBoolean();
            if (thisData.isWaypoint)
            {
                thisData.waypointFor  = (PropWaypointUser)reader.ReadInt16();
                thisData.waypointType = (PropWaypointType)reader.ReadInt16();
            }
            thisData.isScripted = reader.ReadBoolean();
            if (thisData.isScripted)
            {
                thisData.scriptName = reader.ReadString();
            }
            thisData.isPOI = reader.ReadBoolean();
            if (thisData.isPOI)
            {
                thisData.poiType      = (PoiType)reader.ReadInt16();
                thisData.poiGoonCount = reader.ReadInt32();
            }
            thisData.placement    = (reader.ReadBoolean()) ? PropPlacement.INTERIOR : PropPlacement.EXTERIOR;
            thisData.isUnpathable = reader.ReadBoolean();
            thisData.hideInEditor = reader.ReadBoolean();

            string folderPath    = "PROPS/" + thisData.propName.ToString() + "/";
            string streamingPath = "/PROPCONFIGS/" + thisData.propName.ToString() + "/";
            thisData.spriteSet.frontFacing.sprite = Resources.Load <Sprite>(folderPath + "FRONT_FACING");
            if (thisData.spriteSet.frontFacing.sprite != null)
            {
                tempBounds = null;
                StartCoroutine(GetSpriteBounds(streamingPath + "FRONT_FACING"));
                while (tempBounds == null)
                {
                    yield return(new WaitForEndOfFrame());
                }
                thisData.spriteSet.frontFacing.bounds = tempBounds;
            }
            thisData.spriteSet.leftFacing.sprite = Resources.Load <Sprite>(folderPath + "LEFT_FACING");
            if (thisData.spriteSet.leftFacing.sprite != null)
            {
                tempBounds = null;
                StartCoroutine(GetSpriteBounds(streamingPath + "LEFT_FACING"));
                while (tempBounds == null)
                {
                    yield return(new WaitForEndOfFrame());
                }
                thisData.spriteSet.leftFacing.bounds = tempBounds;
            }
            thisData.spriteSet.rightFacing.sprite = Resources.Load <Sprite>(folderPath + "RIGHT_FACING");
            if (thisData.spriteSet.rightFacing.sprite != null)
            {
                tempBounds = null;
                StartCoroutine(GetSpriteBounds(streamingPath + "RIGHT_FACING"));
                while (tempBounds == null)
                {
                    yield return(new WaitForEndOfFrame());
                }
                thisData.spriteSet.rightFacing.bounds = tempBounds;
            }
            thisData.spriteSet.backFacing.sprite = Resources.Load <Sprite>(folderPath + "BACK_FACING");
            if (thisData.spriteSet.backFacing.sprite != null)
            {
                tempBounds = null;
                StartCoroutine(GetSpriteBounds(streamingPath + "BACK_FACING"));
                while (tempBounds == null)
                {
                    yield return(new WaitForEndOfFrame());
                }
                thisData.spriteSet.backFacing.bounds = tempBounds;
            }
            thisData.spriteSet.editorUISprite = Resources.Load <Sprite>(folderPath + "EDITOR_UI");
            tempBounds = null;
            StartCoroutine(GetSpriteBounds(streamingPath + thisData.propName.ToString()));
            while (tempBounds == null)
            {
                yield return(new WaitForEndOfFrame());
            }
            thisData.spriteSet.completeSpriteBounds = tempBounds;

            thisData.zOffset = reader.ReadInt16();

            if (loadedOK)
            {
                propData.Add(thisData);
            }
        }
        reader.Close();

        PropProperties.SetData(propData);
    }
Ejemplo n.º 12
0
 /* Set prop type */
 public void SetPropType(PropTypes _type)
 {
     propType = _type;
     gameObject.GetComponent <Image>().sprite = PropProperties.GetSpriteSet(propType).editorUISprite;
 }