Example #1
0
    public static FloatEvent CreateEvent(string eventName, UnityAction <float, float> listener)
    {
        FloatEvent thisEvent = new FloatEvent();

        Instance.eventDictionary.Add(eventName, thisEvent);
        return(thisEvent);
    }
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         FloatEvent o;
         o = new FloatEvent();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Example #3
0
    public void CreateAnimationUnit(string name, AnimatorControllerParameterType type, BoolVariable boolVariable = null, IntVariable intVariable = null, FloatVariable floatVariable = null, AtomEvent atomEvent = null)
    {
        AnimationUnit unit = ScriptableObject.CreateInstance <AnimationUnit>();

        unit.name = name;

        if (boolVariable != null)
        {
            unit.boolVariable = boolVariable;
            BoolEvent boolEvent = ScriptableObject.CreateInstance <BoolEvent>();
            boolVariable.Changed = boolEvent;
        }
        else if (intVariable != null)
        {
            unit.intVariable = intVariable;
            IntEvent intEvent = ScriptableObject.CreateInstance <IntEvent>();
            intVariable.Changed = intEvent;
        }
        else if (floatVariable != null)
        {
            unit.floatVariable = floatVariable;
            FloatEvent floatEvent = ScriptableObject.CreateInstance <FloatEvent>();
            floatVariable.Changed = floatEvent;
        }
        else if (atomEvent != null)
        {
            unit.atomEvent = atomEvent;
        }

        AddToAnimationUnits(unit);
        SetUpAnimationUnit(unit);
    }
Example #4
0
 protected override void Awake()
 {
     base.Awake();
     _normalScaleEvent = new FloatEvent();
     _slowScaleEvent   = new FloatEvent();
     //_normalFixedDeltaTime = Time.fixedDeltaTime;
 }
        public override void OnInspectorGUI()
        {
            FloatEvent script = (FloatEvent)target;

            //Event Description
            GUILayout.BeginVertical();
            EditorGUILayout.LabelField("Event Description", EditorStyles.centeredGreyMiniLabel);
            EditorStyles.textField.wordWrap = true;
            script.EventDescription         = EditorGUILayout.TextArea(script.EventDescription, GUILayout.MinHeight(100));
            GUILayout.EndVertical();

            //Test Event Button
            GUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Test Event", EditorStyles.centeredGreyMiniLabel);
            value = EditorGUILayout.FloatField("Value ", value);

            if (GUILayout.Button("Raise"))
            {
                if (Application.isPlaying)
                {
                    script.Raise(value);
                }
            }
            GUILayout.EndVertical();
        }
    /* </Immunity */

    // Start is called before the first frame update
    void Awake()
    {
        deathEvent  = new UnityEvent();
        healEvent   = new FloatEvent();
        damageEvent = new FloatEvent();

        damageEvent.AddListener(TakeDamage);
    }
 public SAxis(string[] names, bool sendWhenZeroToo)
 {
     this.names           = names;
     this.sendWhenZeroToo = sendWhenZeroToo;
     events    = new ButtonEvents();
     AxisValue = null;
     isPressed = false;
 }
Example #8
0
        public static void TriggerEvent(GlobalEvents eventName, float val)
        {
            FloatEvent thisEvent = null;

            if (floatEventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.Invoke(val);
            }
        }
    public void OnEventRaised(float value)
    {
        FloatEvent floatEvent = gameEvent as FloatEvent;

        if (floatEvent)
        {
            floatResponse.Invoke(value);
        }
    }
//	public static void TriggerGlobalEvent (string globalEventName, int value)
//	{
//		IntEvent thisEvent = null;
//		if (instance.IntEventDictionary.TryGetValue (globalEventName, out thisEvent))
//		{
//			thisEvent.Invoke (value);
//		}
//	}

    public static void TriggerGlobalEvent(string globalEventName, float value)
    {
        FloatEvent thisEvent = null;

        if (instance.floatEventDictionary.TryGetValue(globalEventName, out thisEvent))
        {
            thisEvent.Invoke(value);
        }
    }
Example #11
0
    public void StopListening(string eventName, UnityAction <object> listener)
    {
        FloatEvent thisEvent = null;

        if (eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Example #12
0
    public static void SafeInvoke(this FloatEvent e, Single value)
    {
        if (e == null)
        {
            return;
        }

        e.Invoke(value);
    }
Example #13
0
    public void TriggerEvent(string eventName, object obj)
    {
        FloatEvent thisEvent = null;

        if (eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(obj);
        }
    }
Example #14
0
 public KeyToEventPair(string _axisName, params UnityAction <float>[] _floatAction)
 {
     axisName   = _axisName;
     floatEvent = new FloatEvent();
     foreach (UnityAction <float> ua in _floatAction)
     {
         floatEvent.AddListener(ua);
     }
 }
Example #15
0
    public static void TriggerEvent(string eventName, float parameter)
    {
        FloatEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(parameter);
        }
    }
Example #16
0
    public static void Subscribe(this FloatEvent e, UnityAction <Single> action)
    {
        if (e == null || action == null)
        {
            return;
        }

        e.AddListener(action);
    }
Example #17
0
    public void AddBaseDamage(float val)
    {
        FloatEvent ev = new FloatEvent()
        {
            Value = val
        };

        OnAddBaseDamage(ev);
        BlzSetUnitBaseDamage(_Self, R2I(ev.Value), 0);
    }
    public static void TriggerEvent(Object obj, string eventName, float value)
    {
        FloatEvent thisEvent = null;
        string     domain    = GetDomain(obj, eventName);

        if (instance.floatEventDictionary.TryGetValue(domain, out thisEvent))
        {
            thisEvent.Invoke(value);
        }
    }
Example #19
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            _spaceCount++;
            FloatEvent?.Invoke(_spaceCount);

            ActionEvent?.Invoke(true, 56);
        }
    }
 public SVector(Joystick[] names, NormalizationMode normalizationMode, bool sendWhenZeroToo)
 {
     this.names             = names;
     this.normalizationMode = normalizationMode;
     this.sendWhenZeroToo   = sendWhenZeroToo;
     events            = new ButtonEvents();
     JoystickValue     = null;
     JoystickMagnitude = null;
     isPressed         = false;
 }
Example #21
0
        public static void StopListeningFloatEvent(string eventName, UnityAction <float> listener)
        {
            Init();
            FloatEvent thisFloatEvent = null;

            if (floatEventDictionary.TryGetValue(eventName, out thisFloatEvent))
            {
                thisFloatEvent.RemoveListener(listener);
            }
        }
Example #22
0
        private FloatEvent GetOrCreateFloatEvent(string eventName)
        {
            UnityEventBase currentEvent = null;

            if (!Instance.m_EventDict.TryGetValue(eventName, out currentEvent))
            {
                currentEvent = new FloatEvent();
                Instance.m_EventDict.Add(eventName, currentEvent);
            }
            return(currentEvent as FloatEvent);
        }
Example #23
0
    public void AddGreyArmor(float val)
    {
        FloatEvent parsEvent = new FloatEvent()
        {
            Value = val
        };

        OnAddGreyArmor(parsEvent);
        GreyArmor += parsEvent.Value;
        BlzSetUnitArmor(_Self, val + GreenArmor);
    }
Example #24
0
    public void AddBonusDamageFlat(int val)
    {
        BonusDamage += val;
        FloatEvent ev = new FloatEvent()
        {
            Value = BonusDamage
        };

        OnAddBonusDamage(ev);
        SetGreenDamage(R2I(ev.Value + BlzGetUnitBaseDamage(_Self, 0) * BonusDamagePercent + Utils.ROUND_DOWN_CONST_OVERHEAD));
    }
Example #25
0
    public void AddGreenArmor(float val)
    {
        FloatEvent parseEvent = new FloatEvent()
        {
            Value = val
        };

        OnAddGreenArmor(parseEvent);
        GreenArmor += parseEvent.Value;
        SetGreenArmor(val);
    }
Example #26
0
 public void Reset()
 {
     DataDumpProperty       = null;
     OnStringUpdated        = null;
     OnIntUpdated           = null;
     OnIntUpdatedAsString   = null;
     OnFloatUpdated         = null;
     OnFloatUpdatedAsString = null;
     OnBoolUpdated          = null;
     OnBoolUpdatedAsString  = null;
 }
Example #27
0
        public static void TriggerFloatEvent(string eventName, float value)
        {
            Init();

            FloatEvent thisEvent = null;

            if (floatEventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.Invoke(value);
            }
        }
Example #28
0
    // Update is called once per frame
    void Awake()
    {
        if (OnShootEvent == null)
        {
            OnShootEvent = new FloatEvent();
        }

        if (OnFinishEntering == null)
        {
            OnFinishEntering = new UnityEvent();
        }
    }
Example #29
0
	static public int constructor(IntPtr l) {
		try {
			FloatEvent o;
			o=new FloatEvent();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Example #30
0
 static public int constructor(IntPtr l)
 {
     try {
         FloatEvent o;
         o = new FloatEvent();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #31
0
    public static void StopListening(string eventName, UnityAction <float> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        FloatEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }