title: How to reference enum in Unity3d alternate script?
body: <p>I have one C# script titled TouchDetector.cs which looks exactly like this:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class TouchDetector : MonoBehaviour
  {
    public delegate void deTouchEvent (enTouchType touchType);
  
    public static event deTouchEvent evTouchEvent;
  
    public enum enTouchType
    {
      SwipeLeft,
      SwipeRight,
      SwipeDown,
      SwipeUp,
    }   
  
    void Start ()
    {   
    }   
  
    void Update ()
    {   
      if (evTouchEvent == null)
          return;
  
      if (Input.GetKeyDown(KeyCode.UpArrow   )) evTouchEvent(enTouchType.SwipeUp   );
      if (Input.GetKeyDown(KeyCode.DownArrow )) evTouchEvent(enTouchType.SwipeDown );
      if (Input.GetKeyDown(KeyCode.LeftArrow )) evTouchEvent(enTouchType.SwipeLeft );
      if (Input.GetKeyDown(KeyCode.RightArrow)) evTouchEvent(enTouchType.SwipeRight);
  
      if (Input.touchCount &gt; 0)
      {
          foreach (Touch t in Input.touches)
          {
              Vector3 swipe = t.deltaPosition * t.deltaTime;
  
              if (swipe.y &gt;  0.5f) evTouchEvent(enTouchType.SwipeUp   );
              if (swipe.y &lt; -0.5f) evTouchEvent(enTouchType.SwipeDown );
              if (swipe.x &gt;  0.5f) evTouchEvent(enTouchType.SwipeRight);
              if (swipe.x &lt; -0.5f) evTouchEvent(enTouchType.SwipeLeft );
          }
      }
  }
  }   
  </code></pre>
  
  <p>I'm trying to replace the following keycode calls to the corresponding swipe call above. I am somewhat new to programming and am trying to teach myself here. I've managed to get the swipe script working but have exhausted every avenue as far as how to get this as my controller if that makes sense. Thank you for any help or advice you can give me. I've tried the following.</p>
  
  <pre><code>if(SwipeLeft)
  {
    //Do something here
  }
  </code></pre>
  
  <p>Yet this is not working for me. I can't seem to reference the control type within my other control script. Here's what the script looks like in my Control.cs script that I am trying to replace:</p>
  
  <pre><code>if (Input.GetKeyDown(KeyCode.LeftArrow) &amp;&amp; m_playerJump &lt;= -1.0f &amp;&amp; m_playerSlide &lt;=0.0f)
  {
    if (m_playerDirection == enCellDir.North) m_playerNextDirection = enCellDir.West;
    if (m_playerDirection == enCellDir.East ) m_playerNextDirection = enCellDir.North;
    if (m_playerDirection == enCellDir.South) m_playerNextDirection = enCellDir.East;
    if (m_playerDirection == enCellDir.West ) m_playerNextDirection = enCellDir.South;
  }
  </code></pre>
  
  <p>Instead of Input.GetKeyDown, I want it to say SwipeLeft or however I need to code it. Please help. I am getting very frustrated. I've looked up enum's but don't quite understand what I am reading or how to reference them. I'm assuming, from what I've read, that enum's are like int's in java. But if that's the case, how would I call those?</p>