Example #1
0
        // Draws from standard unity update
        public void Update()
        {
            if (curAnimation != null)
            {
                AnimationSprite.GetPropertyBlock(curPropBlock);
                AnimationSprite.sprite = curAnimation.animationFrames[animeStep].frameSprite;
                curPropBlock.SetTexture("_tex", AnimationSprite.sprite.texture);
                curPropBlock.SetColor("_col", MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor));
                AnimationSprite.SetPropertyBlock(curPropBlock);

                if (animTime >= 1)
                {
                    if (animeStep == animLength)
                    {
                        if (curAnimation.animationLoop)
                        {
                            animeStep = 0;
                        }
                        else
                        {
                            curAnimation = null;
                        }
                    }
                    else
                    {
                        animeStep++;
                    }
                    animTime = 0;
                }
                else
                {
                    animTime = animTime + animSpeed * Time.deltaTime;
                }
            }
        }
Example #2
0
        // Update the (chunk or tile layer) mesh renderer to display an updated version of z (chunk or tile layer).
        public void UpdateMesh()
        {
            // Clear the mesh and asign new data to the renderer.
            curMesh.Clear();
            curMesh.vertices  = verts;
            curMesh.triangles = tris;
            curMesh.uv        = uvs;

            // Set the material(s)
            curRenderer.sharedMaterial = ScenePrimer.StandardWorld;
            curRenderer.GetPropertyBlock(curPropBlock);
            if (curCunk.textureId[currentLayer] != 0)
            {
                //Debug.Log(XCPManager.currentXCP.tileIds.Length);
                //Debug.Log(curCunk.textureId[currentLayer]);
                curPropBlock.SetTexture("_tex", XCPManager.PngToTex(XCPManager.currentXCP.tileTextures[curCunk.textureId[currentLayer]]));
            }
            else
            {
                curPropBlock.SetTexture("_tex", XCPManager.PngToTex(XCPManager.currentXCP.tileTextures[curCunk.textureId[currentLayer]]));
            }
            curPropBlock.SetColor("_col", MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor));
            curRenderer.SetPropertyBlock(curPropBlock);

            curRenderer.sortingOrder      = -1000 + currentLayer;
            curRenderer.sortingLayerName  = "tilelayer";
            curRenderer.shadowCastingMode = ShadowCastingMode.Off;
            curRenderer.receiveShadows    = false;
        }
Example #3
0
 public static void UpdateCurrentCamera()
 {
     if (curCamera != null)
     {
         curCamera.backgroundColor   = MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].bgColor);
         RenderSettings.ambientLight = MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor);
     }
 }
Example #4
0
 // Generate the sprites that are placed on the cunk. this must only happen once in a chunks life time.
 // TODO : Move the generation to a separate class to improve system workflow, and extensibility.
 public void GenerateSprites()
 {
     if (curCunk.sprites != null)
     {
         if (curCunk.sprites.Length != 0)
         {
             // If the programer is not complying with the above instructions, then force a re-geneation of all sprites on the chunk.
             // This may be only good in editing mode.
             if (spriteContainer != null)
             {
                 GameObject.Destroy(spriteContainer);
                 spriteContainer = new GameObject("Sprites");
                 spriteContainer.transform.SetParent(transform);
                 spriteContainer.transform.position = transform.position;
             }
             else
             {
                 spriteContainer = new GameObject("Sprites");
                 spriteContainer.transform.SetParent(transform);
                 spriteContainer.transform.position = transform.position;
             }
             GameObject            spriteObj;
             SpriteRenderer        spriteRender;
             MaterialPropertyBlock spriteProps;
             spriteProps = new MaterialPropertyBlock();
             for (int i = 0; i < curCunk.sprites.Length; i++)
             {
                 spriteObj          = new GameObject(curCunk.sprites[i].spriteId.ToString());
                 spriteObj.isStatic = true;
                 spriteObj.transform.SetParent(spriteContainer.transform);
                 spriteObj.transform.localPosition = new Vector3(curCunk.sprites[i].posx, 0.2f, curCunk.sprites[i].posy);
                 spriteRender          = spriteObj.AddComponent <SpriteRenderer>();
                 spriteRender.material = ScenePrimer.StandardSprite;
                 spriteRender.GetPropertyBlock(spriteProps);
                 spriteRender.transform.eulerAngles = new Vector2(90, 0);
                 spriteRender.sprite = XCPManager.PngToSprite(XCPManager.currentXCP.spriteTextures[curCunk.sprites[i].spriteId]);
                 spriteProps.SetTexture("_tex", spriteRender.sprite.texture);
                 spriteProps.SetColor("_col", MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor));
                 spriteRender.SetPropertyBlock(spriteProps);
                 if (ScenePrimer.curEditorPrimer != null)
                 {
                     spriteObj.AddComponent <BoxCollider>().isTrigger = true; spriteObj.AddComponent <SpriteInfo>().spriteIndex = i;
                 }
                 if (XCPManager.currentXCP.spriteTextures[curCunk.sprites[i].spriteId].colliders != null)
                 {
                     for (int col = 0; i < XCPManager.currentXCP.spriteTextures[curCunk.sprites[i].spriteId].colliders.Length; i++)
                     {
                         BoxCollider colider = spriteRender.gameObject.AddComponent <BoxCollider>();
                     }
                 }
                 spriteRender.sortingLayerName = EditorPrimer.GoodIdToBadUnityId(curCunk.sprites[i].sortLayer + 1);
                 spriteRender.sortingOrder     = SessionManager.SpriteSortByPos(spriteRender);
             }
         }
     }
 }
Example #5
0
 public void UpdateSpriteRendering(Sprite overrideSprite = null)
 {
     AnimationSprite.GetPropertyBlock(curPropBlock);
     if (overrideSprite != null)
     {
         AnimationSprite.sprite = overrideSprite;
     }
     else
     {
         AnimationSprite.sprite = curAnimation.animationFrames[animeStep].frameSprite;
     }
     curPropBlock.SetTexture("_tex", AnimationSprite.sprite.texture);
     curPropBlock.SetColor("_col", MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor));
     AnimationSprite.SetPropertyBlock(curPropBlock);
 }
Example #6
0
        public override void ToolUpdate()
        {
            if (ScenePrimer.curEditorPrimer.curSpriteMode)
            {
                if (ScenePrimer.curEditorPrimer.curSpriteId != -1)
                {
                    spriteMode = true;
                    curTileSelector.gameObject.SetActive(false);
                    Icon.gameObject.SetActive(true);
                    Icon = EditorPrimer.spriteIconRenderer;

                    Icon.GetPropertyBlock(spriteProps);
                    Icon.sprite = XCPManager.PngToSprite(XCPManager.currentXCP.spriteTextures[ScenePrimer.curEditorPrimer.curSpriteId]);
                    spriteProps.SetColor("_col", MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor));
                    spriteProps.SetTexture("_tex", Icon.sprite.texture);
                    Icon.SetPropertyBlock(spriteProps);

                    Icon.sortingLayerName = EditorPrimer.GoodIdToBadUnityId(ScenePrimer.curEditorPrimer.curSortingLayer + 1);
                }
            }
        }
        public override void CreateEntity(string entityName = "PlayerObj")
        {
            // Setup the player EntityAgent & rigidbody
            // transform.eulerAngles = new Vector2(90, 0);
            entityObj       = gameObject;
            entityRigidbody = entityObj.AddComponent <Rigidbody>();
            entityRigidbody.interpolation  = RigidbodyInterpolation.Interpolate;
            entityRigidbody.freezeRotation = true;
            entityRigidbody.transform.SetParent(transform);
            entityRigidbody.useGravity = false;
            entityRigidbody.drag       = 9;

            //
            //entityBoxCollider = entityObj.AddComponent<BoxCollider>();
            //entityBoxCollider.size = new Vector3(0.24f,2,0.48f);

            entityFeetCollider = new GameObject("Feet").AddComponent <CapsuleCollider>();
            entityFeetCollider.gameObject.transform.SetParent(entityObj.transform);
            entityFeetCollider.transform.localPosition = new Vector3(0, 0, 0);
            entityFeetCollider.radius = 0.06f;
            entityFeetCollider.height = 2;
            entityFeetCollider.tag    = "feet";

            // Setup a new camera obj
            playerCameraObj = CameraManager.SetupNewCamera(ScenePrimer.curPrimerComponent.primerParrentObj, "PlayerCamera", true, true, 1, new Color(), new Vector3(entityObj.transform.position.x, 2, entityObj.transform.position.z), new Vector3(90, 0, 0));
            playerCameraObj.AddComponent <OldZoom>();
            playerCameraObj.AddComponent <ObjectFollow>().target = transform;

            // Add the BPlayerController to the camera.
            targetPlayerController = SessionManager.CreateBPlayerController(playerCameraObj);
            targetPlayerController.ControllerUpdateMode(true);
            targetPlayerController.targetEntityAgent            = this;
            targetPlayerController.targetRigidbody              = entityRigidbody;
            targetPlayerController.targetCameraObj              = playerCameraObj;
            targetPlayerController.targetCamera                 = playerCameraObj.GetComponent <Camera>();
            targetPlayerController.targetCamera.backgroundColor = MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].bgColor);
            PlayerSetupTextures();
        }
Example #8
0
        public override void ToolPrimaryUse()
        {
            if (spriteMode)
            {
                usesDrag    = false;
                targetChunk = SessionManager.GetChunk(Icon.transform.position, SessionManager.GetChunkCluster(Icon.transform.position), false);
                if (targetChunk != null)
                {
                    Icon.transform.position = SessionManager.ObjPosition(Icon.transform.position);
                    if (targetChunk.sprites == null)
                    {
                        targetChunk.sprites              = new Spr[1];
                        targetChunk.sprites[0].posx      = Icon.transform.position.x;
                        targetChunk.sprites[0].posy      = Icon.transform.position.z;
                        targetChunk.sprites[0].sortLayer = (ushort)ScenePrimer.curEditorPrimer.curSortingLayer;
                        targetChunk.sprites[0].spriteId  = (ushort)ScenePrimer.curEditorPrimer.curSpriteId;
                    }
                    else
                    {
                        Array.Resize(ref targetChunk.sprites, targetChunk.sprites.Length + 1);
                        targetChunk.sprites[targetChunk.sprites.Length - 1]           = new Spr();
                        targetChunk.sprites[targetChunk.sprites.Length - 1].posx      = Icon.transform.position.x;
                        targetChunk.sprites[targetChunk.sprites.Length - 1].posy      = Icon.transform.position.z;
                        targetChunk.sprites[targetChunk.sprites.Length - 1].sortLayer = (ushort)ScenePrimer.curEditorPrimer.curSortingLayer;
                        targetChunk.sprites[targetChunk.sprites.Length - 1].spriteId  = (ushort)ScenePrimer.curEditorPrimer.curSpriteId;
                        targetChunk.sprites[targetChunk.sprites.Length - 1].sortLayer = (ushort)ScenePrimer.curEditorPrimer.curSortingLayer;
                    }
                    if (targetChunk != null)
                    {
                        if (targetChunk.meshObjRef == null)
                        {
                            targetChunk.meshObjRef = targetChunk.chunkObjRef.GetComponent <TileMesh2D>();
                        }
                    }
                    targetChunk.meshObjRef.curCunk = targetChunk;
                    if (targetChunk.meshObjRef.spriteContainer != null)
                    {
                        GameObject spriteObj = new GameObject(ScenePrimer.curEditorPrimer.curSpriteId.ToString());
                        spriteObj.transform.SetParent(targetChunk.meshObjRef.spriteContainer.transform);
                        spriteObj.transform.localPosition = Icon.transform.position;
                        if (targetChunk.sprites.Length == 1)
                        {
                            spriteObj.AddComponent <SpriteInfo>().spriteIndex = 0;
                        }
                        else
                        {
                            spriteObj.AddComponent <SpriteInfo>().spriteIndex = targetChunk.sprites.Length - 1;
                        }
                        SpriteRenderer spriteRender = spriteObj.AddComponent <SpriteRenderer>();

                        spriteRender.material = ScenePrimer.curEditorPrimer.worldMaterial;
                        spriteRender.transform.eulerAngles = new Vector2(90, 0);
                        spriteRender.sprite           = XCPManager.PngToSprite(XCPManager.currentXCP.spriteTextures[ScenePrimer.curEditorPrimer.curSpriteId]);
                        spriteRender.sortingOrder     = SessionManager.SpriteSortByPos(spriteRender);
                        spriteRender.sortingLayerName = EditorPrimer.GoodIdToBadUnityId(ScenePrimer.curEditorPrimer.curSortingLayer + 1);
                        spriteObj.AddComponent <BoxCollider>().isTrigger = true;

                        spriteRender.GetPropertyBlock(spriteProps);
                        spriteRender.sprite = XCPManager.PngToSprite(XCPManager.currentXCP.spriteTextures[ScenePrimer.curEditorPrimer.curSpriteId]);
                        spriteProps.SetColor("_col", MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor));
                        spriteProps.SetTexture("_tex", spriteRender.sprite.texture);
                        spriteRender.SetPropertyBlock(spriteProps);
                    }
                    else
                    {
                        targetChunk.meshObjRef.GenerateSprites();
                    }
                }
            }
            else
            {
                usesDrag        = true;
                cursorTransform = CameraManager.curCamera.ScreenToWorldPoint(Input.mousePosition);

                cursorTransform.x = (float)System.Math.Round(cursorTransform.x / tileSize) * tileSize - tileSize * 0.5f;
                cursorTransform.z = (float)System.Math.Round(cursorTransform.z / tileSize) * tileSize + tileSize * 0.5f;

                SessionManager.PlaceTile(cursorTransform, ScenePrimer.curEditorPrimer.curLayer, ScenePrimer.curEditorPrimer.curTileId, true, false);
            }
        }
Example #9
0
        public override void WindowCreate(int sizeX, int sizeY, GameObject windowRef)
        {
            targetWindowRef = windowRef;
            // A realy bad way to overide.
            sizeX = 200;
            sizeY = Screen.height - 64;

            // Create the window panel.
            windowPanel.uiSize       = new Vector2(sizeX, sizeY);
            windowPanel.uiAnchorMode = UiManager.UiAnchorsMode.MiddelLeftStretchVertical;
            windowPanel.uiPosition   = new Vector2(Screen.width / 2 * -1 + sizeX - 68, -32);
            windowPanel.uiRayCast    = true;
            GameObject panel = UiManager.CreateBackgroundObj(windowRef, windowPanel);

            panel.transform.parent.gameObject.AddComponent <QuickUiAnimator>().PlayFadeAnim(0, 1, false, false, 9f);

            // Editor File Menu
            UiButtonObject editorFileMenu = new UiButtonObject();

            editorFileMenu.uiObjName    = "editorFileMenu";
            editorFileMenu.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            editorFileMenu.uiPosition   = new Vector2(100, -24);
            editorFileMenu.uiSize       = new Vector2(185, 32);
            editorFileMenu.uiStaticObj  = true;
            editorFileMenu.uiButtonBackgroundObject.uiColor = new Color32(155, 155, 155, 100);

            editorFileMenu.uiButtonText             = new UiTextObject();
            editorFileMenu.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            editorFileMenu.uiButtonText.uiText      = "Layers";
            editorFileMenu.uiButtonText.uiTextColor = new Color(0, 0, 0, 1);

            editorFileMenu.uiButtonIcon = new UiBackgroundObject();
            editorFileMenu.uiButtonIcon.uiTextureRef = ScenePrimer.curEditorPrimer.editorIcons[18];
            editorFileMenu.uiButtonIcon.uiColor      = new Color(0, 0, 0, 0.5f);
            editorFileMenu.uiButtonIcon.uiSize       = new Vector2(17, 17);
            editorFileMenu.uiButtonIcon.uiPosition   = new Vector2(78, 0);

            editorFileMenu.uiButtonBackgroundObject.uiRayCast    = true;
            editorFileMenu.uiButtonBackgroundObject.uiSize       = new Vector2(185, 32);
            editorFileMenu.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 70);
            editorFileMenu.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            editorFileMenu.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            UiManager.CreateButton(panel, editorFileMenu).gameObject.AddComponent <editorLayersButton>();

            UiTextInputField uiLayerName = new UiTextInputField();

            uiLayerName.uiPosition   = new Vector2(100, -90);
            uiLayerName.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            uiLayerName.uiSize       = new Vector2(185, 32);
            uiLayerName.uiButtonBackgroundObject.uiRayCast    = true;
            uiLayerName.uiButtonBackgroundObject.uiSize       = uiLayerName.uiSize;
            uiLayerName.uiButtonBackgroundObject.uiColor      = new Color32(100, 100, 100, 100);
            uiLayerName.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 100);
            uiLayerName.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            uiLayerName.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            uiLayerName.uiButtonIcon.uiColor  = new Color32(255, 255, 255, 110);
            uiLayerName.uiButtonIcon.uiSize   = new Vector2(uiLayerName.uiSize.x - 2, uiLayerName.uiSize.y - 2);
            uiLayerName.uiButtonText          = new UiTextObject();
            uiLayerName.uiButtonText.uiText   = XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].layerName;
            uiLayerName.fieldName             = new UiTextObject();
            uiLayerName.fieldName.uiTextColor = new Color32(0, 0, 0, 255);
            uiLayerName.fieldName.uiTextAlign = TextAnchor.UpperLeft;
            uiLayerName.fieldName.uiSize      = uiLayerName.uiSize;
            uiLayerName.fieldName.uiPosition += new Vector2(3, 25);
            uiLayerName.fieldName.uiText      = "Layer Name";
            InputField inLayerName = UiManager.CreateTextInputField(panel, uiLayerName);

            inLayerName.onEndEdit.AddListener(delegate { SetLayerName(inLayerName.text); });

            UiTextInputField uiLayerBgColor = new UiTextInputField();

            uiLayerBgColor.uiPosition   = new Vector2(100, -189);
            uiLayerBgColor.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            uiLayerBgColor.uiSize       = new Vector2(185, 98);
            uiLayerBgColor.uiButtonBackgroundObject.uiRayCast    = true;
            uiLayerBgColor.uiButtonBackgroundObject.uiSize       = uiLayerBgColor.uiSize;
            uiLayerBgColor.uiButtonBackgroundObject.uiColor      = new Color32(100, 100, 100, 100);
            uiLayerBgColor.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 100);
            uiLayerBgColor.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            uiLayerBgColor.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            uiLayerBgColor.uiButtonIcon.uiColor  = new Color32(255, 255, 255, 110);
            uiLayerBgColor.uiButtonIcon.uiSize   = new Vector2(uiLayerBgColor.uiSize.x - 2, uiLayerBgColor.uiSize.y - 2);
            uiLayerBgColor.fieldName             = new UiTextObject();
            uiLayerBgColor.fieldName.uiTextColor = new Color32(0, 0, 0, 255);
            uiLayerBgColor.fieldName.uiTextAlign = TextAnchor.UpperLeft;
            uiLayerBgColor.fieldName.uiSize      = uiLayerBgColor.uiSize;
            uiLayerBgColor.fieldName.uiPosition += new Vector2(3, 25);
            uiLayerBgColor.fieldName.uiText      = "Background Color";
            UiManager.CreateColorInputField(panel, uiLayerBgColor, MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].bgColor), new RunnerLayerBGColor());

            UiTextInputField uiLayerFgColor = new UiTextInputField();

            uiLayerFgColor.uiPosition   = new Vector2(100, -321.8f);
            uiLayerFgColor.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            uiLayerFgColor.uiSize       = new Vector2(185, 98);
            uiLayerFgColor.uiButtonBackgroundObject.uiRayCast    = true;
            uiLayerFgColor.uiButtonBackgroundObject.uiSize       = uiLayerFgColor.uiSize;
            uiLayerFgColor.uiButtonBackgroundObject.uiColor      = new Color32(100, 100, 100, 100);
            uiLayerFgColor.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 100);
            uiLayerFgColor.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            uiLayerFgColor.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            uiLayerFgColor.uiButtonIcon.uiColor  = new Color32(255, 255, 255, 110);
            uiLayerFgColor.uiButtonIcon.uiSize   = new Vector2(uiLayerFgColor.uiSize.x - 2, uiLayerFgColor.uiSize.y - 2);
            uiLayerFgColor.fieldName             = new UiTextObject();
            uiLayerFgColor.fieldName.uiTextColor = new Color32(0, 0, 0, 255);
            uiLayerFgColor.fieldName.uiTextAlign = TextAnchor.UpperLeft;
            uiLayerFgColor.fieldName.uiSize      = uiLayerFgColor.uiSize;
            uiLayerFgColor.fieldName.uiPosition += new Vector2(3, 25);
            uiLayerFgColor.fieldName.uiText      = "Forground Color";
            UiManager.CreateColorInputField(panel, uiLayerFgColor, MapDataConverter.ColToColor32(XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].forColor), new RunnerLayerFGColor());

            UiButtonObject uiLayerPlayerSpawn = new UiButtonObject();

            uiLayerPlayerSpawn.uiPosition   = new Vector2(100, -398.27f);
            uiLayerPlayerSpawn.uiAnchorMode = UiManager.UiAnchorsMode.TopLeft;
            uiLayerPlayerSpawn.uiSize       = new Vector2(185, 32);
            uiLayerPlayerSpawn.uiButtonBackgroundObject.uiRayCast    = true;
            uiLayerPlayerSpawn.uiButtonBackgroundObject.uiSize       = uiLayerPlayerSpawn.uiSize;
            uiLayerPlayerSpawn.uiButtonBackgroundObject.uiColor      = new Color32(100, 100, 100, 100);
            uiLayerPlayerSpawn.uiButtonBackgroundObject.normalColor  = new Color32(170, 170, 170, 100);
            uiLayerPlayerSpawn.uiButtonBackgroundObject.hoverColor   = new Color32(134, 166, 255, 100);
            uiLayerPlayerSpawn.uiButtonBackgroundObject.pressedColor = new Color32(0, 150, 255, 100);
            uiLayerPlayerSpawn.uiButtonIcon.uiColor     = new Color32(255, 255, 255, 110);
            uiLayerPlayerSpawn.uiButtonIcon.uiSize      = new Vector2(uiLayerPlayerSpawn.uiSize.x - 2, uiLayerPlayerSpawn.uiSize.y - 2);
            uiLayerPlayerSpawn.uiButtonText             = new UiTextObject();
            uiLayerPlayerSpawn.uiButtonText.uiTextAlign = TextAnchor.MiddleCenter;
            uiLayerPlayerSpawn.uiButtonText.uiText      = "Set player spawn point";
            uiLayerPlayerSpawn.uiButtonText.uiTextColor = new Color(0, 0, 0, 1);
            uiLayerPlayerSpawn.uiButtonText.uiSize      = new Vector2(185, 32);
            EditorToolIndicator setSpawn = UiManager.CreateButton(panel, uiLayerPlayerSpawn).gameObject.AddComponent <EditorToolIndicator>();
            EditorToolPosition  tool     = new EditorToolPosition();

            tool.toolActiveSetterIcon = Resources.Load <Sprite>("BerrySystem/Textures/Topdown/alphaSpawn");
            setSpawn.targetTool       = tool;

            uiLayerPlayerSpawn.uiPosition          = new Vector2(100, -434.1f);
            uiLayerPlayerSpawn.uiButtonText.uiText = "Main Layer : " + XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].mainLayer;
            if (XCPManager.currentXCP.xpcMaps[MapDataManager.mapDataXCPIndex].mapLayers[MapDataManager.mapDataCurrentLayer].mainLayer)
            {
                UiManager.CreateButton(panel, uiLayerPlayerSpawn);
            }
            else
            {
                UiIntractable setToMain = UiManager.CreateButton(panel, uiLayerPlayerSpawn).GetComponent <UiIntractable>();
                setToMain.onMouseClickEvent = SetLayerMain;
            }

            windowRef.AddComponent <QuickUiAnimator>().PlayPosAnim(new Vector2(-230, 0), new Vector2(0, 0), false, false, 1800f);
        }