diff --git a/Assets/IsoUnity/Source/EvenManagers/AnimationManager.cs b/Assets/IsoUnity/Source/EvenManagers/AnimationManager.cs index 4c2d324..974d87b 100644 --- a/Assets/IsoUnity/Source/EvenManagers/AnimationManager.cs +++ b/Assets/IsoUnity/Source/EvenManagers/AnimationManager.cs @@ -36,7 +36,9 @@ public override void ReceiveEvent(IGameEvent ev) decoration.GetComponent().sharedMaterial = new Material(Shader.Find("Transparent/Cutout/Diffuse")); decoration.Father = dec; + decoration.Centered = true; decoration.adaptate(); + decoration.SendMessage("Update"); AutoAnimator anim = go.AddComponent(); anim.FrameSecuence = new int[8] { 0, 1, 2, 3, 4, 5, 6, 7 }; @@ -44,8 +46,6 @@ public override void ReceiveEvent(IGameEvent ev) anim.AutoDestroy = true; anim.Repeat = 1; anim.registerEvent(ev); - - go.transform.Translate(new Vector3(0, 0, -2.8f)); } } diff --git a/Assets/IsoUnity/Source/Map/Decoration.cs b/Assets/IsoUnity/Source/Map/Decoration.cs index 17906e1..4886bd1 100644 --- a/Assets/IsoUnity/Source/Map/Decoration.cs +++ b/Assets/IsoUnity/Source/Map/Decoration.cs @@ -202,7 +202,7 @@ public void updateTextures(bool regenerateMesh) this.GetComponent().sharedMaterial = myMat; int x = tile % (isoDec.nCols); - int y = Mathf.FloorToInt(tile / isoDec.nCols); + int y = Mathf.FloorToInt(tile / (float) isoDec.nCols); this.GetComponent().sharedMaterial.mainTextureOffset = new Vector2((x / ((float)isoDec.nCols)), (y / ((float)isoDec.nRows))); } @@ -288,13 +288,12 @@ public void colocate() else if (this.father is Decoration) { Decoration decorationpadre = this.father as Decoration; - this.transform.parent = decorationpadre.transform; + this.transform.parent = decorationpadre.transform.parent; - Vector3 position = new Vector3(); - - position = new Vector3(0f, this.transform.localScale.y, 0f); + Vector3 position = new Vector3(0f, this.transform.localScale.y, 0f); - this.transform.localPosition = position; + this.transform.position = decorationpadre.transform.position; + this.transform.localPosition -= this.transform.worldToLocalMatrix.MultiplyVector(Vector3.forward * 0.01f); } } @@ -330,15 +329,15 @@ public void setRotation() case 2: { y = 90; break; } } } + + this.transform.Rotate(x, y, z); } else if (this.father is Decoration) { - this.transform.localRotation = (this.father as Decoration).transform.rotation; - y = -45; + this.transform.rotation = (this.father as Decoration).transform.rotation; + //y = -45; } - - this.transform.Rotate(x, y, z); } } } \ No newline at end of file