Advertisement
Guest User

GlobalEvent.cs

a guest
Nov 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GlobalEvent : MonoBehaviour {
  6.  
  7.     static public event System.Action<float> OnVerticalMoving;
  8.  
  9.     // Use this for initialization
  10.     void Start () {
  11.        
  12.     }
  13.    
  14.     // Update is called once per frame
  15.     void Update () {
  16.         if(Mathf.Abs(Input.GetAxis("Horizontal")) > 0.1f)
  17.         {
  18.             if (OnVerticalMoving != null)
  19.                 OnVerticalMoving(Input.GetAxis("Horizontal"));
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement