UIScale.cs 532 B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. namespace Model
  3. {
  4. [Node(NodeClassifyType.Action, "将UI缩放")]
  5. public class UIScale : Node
  6. {
  7. [NodeInput("传入的UI参数", typeof(UI))]
  8. private string uiKey;
  9. [NodeField("缩放倍数")]
  10. private float scale;
  11. public UIScale(NodeProto nodeProto): base(nodeProto)
  12. {
  13. }
  14. protected override bool Run(BehaviorTree behaviorTree, BTEnv env)
  15. {
  16. UI ui = env.Get<UI>(this.uiKey);
  17. ui.GameObject.transform.localScale = new Vector3(this.scale, this.scale, this.scale);
  18. return true;
  19. }
  20. }
  21. }