Esempio n. 1
0
        public static void AddInput(int index, Action action, MouseType type)
        {
            switch (type)
            {
            case MouseType.Down:
                if (Obj.inputsMouseDown.ContainsKey(index))
                {
                    obj.inputsMouseDown[index] += action;
                }
                else
                {
                    if (obj.inputsMouseDown.Count == 0)
                    {
                        GameEvent.AddEvent(obj.TOnUpdate_MouseDown, Method.Update);
                    }
                    obj.inputsMouseDown.Add(index, action);
                }
                break;

            case MouseType.Press:
                if (Obj.inputsMousePress.ContainsKey(index))
                {
                    obj.inputsMousePress[index] += action;
                }
                else
                {
                    if (obj.inputsMousePress.Count == 0)
                    {
                        GameEvent.AddEvent(obj.TOnUpdate_MousePress, Method.Update);
                    }
                    obj.inputsMousePress.Add(index, action);
                }
                break;

            case MouseType.Up:
                if (Obj.inputsMouseUp.ContainsKey(index))
                {
                    obj.inputsMouseUp[index] += action;
                }
                else
                {
                    if (obj.inputsMouseUp.Count == 0)
                    {
                        GameEvent.AddEvent(obj.TOnUpdate_MouseUp, Method.Update);
                    }
                    obj.inputsMouseUp.Add(index, action);
                }
                break;
            }
        }
Esempio n. 2
0
 public static void AddInput(string name, Action <float> action)
 {
     if (Obj.inputs.ContainsKey(name))
     {
         obj.inputs[name] += action;
     }
     else
     {
         if (obj.inputs.Count == 0)
         {
             GameEvent.AddEvent(obj.TOnUpdate, Method.Update);
         }
         obj.inputs.Add(name, action);
     }
 }
Esempio n. 3
0
        private void OnEnable()
        {
            if (inputs.Count != 0)
            {
                GameEvent.AddEvent(TOnUpdate, Method.Update);
            }
            if (inputsMouseDown.Count != 0)
            {
                GameEvent.AddEvent(TOnUpdate_MouseDown, Method.Update);
            }
            if (inputsMousePress.Count != 0)
            {
                GameEvent.AddEvent(TOnUpdate_MousePress, Method.Update);
            }
            if (inputsMouseUp.Count != 0)
            {
                GameEvent.AddEvent(TOnUpdate_MouseUp, Method.Update);
            }

            GameEvent.AddEvent(LateUpdateMethod, Method.LateUpdate);
        }
Esempio n. 4
0
 private void OnEnable()
 {
     InputEvent.AddInput(InputDatas);
     GameEvent.AddEvent(EventDatas);
     EOnEnable();
 }