public void Hide() { MyMotion.Get(gameObject) .Smooth(isSmooth) .Postion(defaultPostion) .Mode(MyMotion.Modes.Absolute) .BlendTime(motionTime) .Run(); }
public void Display() { MyMotion.Get(gameObject) .Smooth(isSmooth) .Postion(targetPostion) .Mode(MyMotion.Modes.Absolute) .BlendTime(motionTime) .Run(); }
//砍去底部树干 public void RemoveTrunk(Vector3 postion, Vector3 rotate) { if (nodeList.Count == 0) { return; } audio.Play(); TreeNode bottomNode = nodeList[0]; bottomNode.GetComponent <SpriteRenderer>().sortingOrder = 3; lastNode = bottomNode; nodeList.Remove(bottomNode); MyMotion.Get(bottomNode.gameObject) .Mode(MyMotion.Modes.Absolute) .Postion(postion) .Gravity(new Vector3(0, 0.05f, 0)) .Rotate(rotate) .BlendTime(0.75f) .AddOnFinishListener(() => { Destroy(bottomNode.gameObject); }) .Run(); CreateTrunk(); nodeList[0].transform.position = origin.transform.position + new Vector3(0, 0.5f * stump.bounds.size.y, 0) + new Vector3(0, 1.5f * trunk[index].bounds.size.y, 0) + originOffset; //TreeMotion(); //只运动最后一节树干 MyMotion.Get(nodeList[0].gameObject).WaitFinish(() => { MyMotion.Get(nodeList[0].gameObject) .Mode(MyMotion.Modes.Relative) .Postion(new Vector3(0, -bottomNode.GetComponent <SpriteRenderer>().sprite.bounds.size.y)) .BlendTime(0.075f) .AddOnBlendListener(() => { TreeMotion(); }) .AddOnFinishListener(() => { TreeMotion(); }) .Run(); }, true); }