Skip to content

Commit

Permalink
Fixed decoration animation positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorma committed Jun 15, 2018
1 parent 9d3281b commit cda560c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Assets/IsoUnity/Source/EvenManagers/AnimationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ public override void ReceiveEvent(IGameEvent ev)

decoration.GetComponent<Renderer>().sharedMaterial = new Material(Shader.Find("Transparent/Cutout/Diffuse"));
decoration.Father = dec;
decoration.Centered = true;
decoration.adaptate();
decoration.SendMessage("Update");

AutoAnimator anim = go.AddComponent<AutoAnimator>();
anim.FrameSecuence = new int[8] { 0, 1, 2, 3, 4, 5, 6, 7 };
anim.FrameRate = 0.07f;
anim.AutoDestroy = true;
anim.Repeat = 1;
anim.registerEvent(ev);

go.transform.Translate(new Vector3(0, 0, -2.8f));
}
}

Expand Down
19 changes: 9 additions & 10 deletions Assets/IsoUnity/Source/Map/Decoration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void updateTextures(bool regenerateMesh)
this.GetComponent<Renderer>().sharedMaterial = myMat;

int x = tile % (isoDec.nCols);
int y = Mathf.FloorToInt(tile / isoDec.nCols);
int y = Mathf.FloorToInt(tile / (float) isoDec.nCols);

this.GetComponent<Renderer>().sharedMaterial.mainTextureOffset = new Vector2((x / ((float)isoDec.nCols)), (y / ((float)isoDec.nRows)));
}
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit cda560c

Please sign in to comment.