Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------------------------------------------------
- // _______ _____ __ ________
- // | ___ \ / \ | | |___ ___|
- // | | \ | / ___ \ | | / /
- // | |___/ / / / \ \ | | / /_
- // | | \ \ \ \___/ / | | /_ /
- // | |___/ | \ / | |____ | /
- // |_______/ \_____/ |_______| |/
- //
- // V I S U A L S C R I P T I N G
- //--------------------------------------------------------------
- //
- // THIS FILE IS AUTO-GENERATED.
- //
- // ANY CHANGES WILL BE LOST NEXT TIME THIS SCRIPT IS GENERATED.
- //
- //--------------------------------------------------------------
- #pragma warning disable 162, 219, 429
- using Bolt;
- using Ludiq;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- namespace Bolt.Generated
- {
- public class AimGraphScript : FlowGraphScript
- {
- private EventHook updateHook;
- private Action<EmptyEventArgs> updateHandler;
- public AimGraphScript(IMachineScript machineScript) : base(machineScript) {}
- public override FlowGraphData graphData
- {
- get => _graphData;
- set
- {
- _graphData = value;
- }
- }
- public void Update()
- {
- var result = Camera.main.WorldToScreenPoint(Input.mousePosition);
- var output = result - gameObject.transform.position;
- Variables.Object(gameObject).Set("dir", output);
- var result2 = Mathf.Atan2(output.ConvertTo<Vector3>().y, output.ConvertTo<Vector3>().x);
- var output2 = Mathf.Rad2Deg * result2;
- Variables.Object(gameObject).Set("angle", output2);
- var result3 = Quaternion.Euler(0f, 0f, output2.ConvertTo<float>());
- gameObject.transform.rotation = result3;
- }
- public override void StartListening()
- {
- updateHook = new EventHook("Update", machineScript);
- updateHandler = args => Update();
- EventBus.Register(updateHook, updateHandler);
- }
- public override void StopListening()
- {
- EventBus.Unregister(updateHook, updateHandler);
- updateHandler = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement