Example #1
0
        public string Description(IBehaviourContext character)
        {
            ConnectionEntry <RPGCharacter> targetInput = Target.GetEntry(character);
            ConnectionEntry <float>        effectInput = Effect.GetEntry(character);

            StatInstance inst = targetInput.Value.Stats[entry];

            return(Display.Replace("{0}", inst.Info.RenderModifier(effectInput.Value, Scaling)));
        }
Example #2
0
        protected override void OnSetup(IBehaviourContext character)
        {
            ConnectionEntry <float> valueAInput = ValueA.GetEntry(character);
            ConnectionEntry <float> valueBInput = ValueB.GetEntry(character);
            ConnectionEntry <bool>  output      = Output.GetEntry(character);

            Action updateHandler = () =>
            {
                if (Operator == Comparison.Equal)
                {
                    output.Value = valueAInput.Value == valueBInput.Value;
                }
                else if (Operator == Comparison.Greater)
                {
                    output.Value = valueAInput.Value > valueBInput.Value;
                }
                else if (Operator == Comparison.Less)
                {
                    output.Value = valueAInput.Value < valueBInput.Value;
                }
            };

            valueAInput.OnAfterChanged += updateHandler;
            valueBInput.OnAfterChanged += updateHandler;

            updateHandler();
        }
Example #3
0
        protected override void OnSetup(IBehaviourContext character)
        {
            ConnectionEntry <RPGCharacter> centerInput        = Center.GetEntry(character);
            ConnectionEntry <bool>         includeCasterInput = IncludeCaster.GetEntry(character);
            ConnectionEntry <float>        distanceInput      = Distance.GetEntry(character);

            CharacterConnection.EntryCollection targetsOutput = Targets.GetEntry(character);

            GameObject       proximityHolder = new GameObject("Proximity Cheacker");
            ProximityChecker proximity       = proximityHolder.AddComponent <ProximityChecker> ();

            proximity.enabled = false;

            proximity.Conditions += (RPGCharacter target) =>
            {
                return(includeCasterInput.Value ? true : target != centerInput.Value);
            };

            proximity.OnEnter += (RPGCharacter target) =>
            {
                targetsOutput.Add(target);
            };

            proximity.OnExit += (RPGCharacter target) =>
            {
                targetsOutput.Remove(target);
            };

            Action changeHandler = () =>
            {
                if (centerInput.Value == null)
                {
                    proximityHolder.transform.SetParent(null);
                    proximity.enabled = false;
                    return;
                }

                proximityHolder.transform.SetParent(centerInput.Value.transform);
                proximityHolder.transform.localPosition = Vector3.zero;
                proximity.enabled = true;
            };

            Action distanceChangeHandler = () =>
            {
                proximity.Distance = distanceInput.Value;
            };

            distanceChangeHandler();
            changeHandler();

            centerInput.OnAfterChanged   += changeHandler;
            distanceInput.OnAfterChanged += distanceChangeHandler;
        }
Example #4
0
        protected override void OnSetup(IBehaviourContext character)
        {
            ConnectionEntry <float> valueAInput = ValueA.GetEntry(character);
            ConnectionEntry <float> valueBInput = ValueB.GetEntry(character);
            ConnectionEntry <float> output      = Output.GetEntry(character);

            Action updateHandler = () =>
            {
                output.Value = valueAInput.Value + valueBInput.Value;
            };

            valueAInput.OnAfterChanged += updateHandler;
            valueBInput.OnAfterChanged += updateHandler;

            updateHandler();
        }
Example #5
0
        protected override void OnSetup(IBehaviourContext character)
        {
            ConnectionEntry <float> minInput = Min.GetEntry(character);
            ConnectionEntry <float> maxInput = Max.GetEntry(character);
            ConnectionEntry <float> output   = Output.GetEntry(character);

            Action updateHandler = () =>
            {
                output.Value = UnityEngine.Random.Range(minInput.Value, maxInput.Value);
            };

            minInput.OnAfterChanged += updateHandler;
            maxInput.OnAfterChanged += updateHandler;

            updateHandler();
        }
Example #6
0
        protected override void OnSetup(IBehaviourContext context)
        {
            ConnectionEntry <int>   firesInput      = Fires[context];
            ConnectionEntry <float> perSecondsInput = PerSeconds.GetEntry(context);
            ConnectionEntry <float> spacingInput    = Spacing.GetEntry(context);
            EventEntry eventInput     = Event[context];
            EventEntry limitedtOutput = Limited[context];

            Queue <float> FiringTimes    = new Queue <float> ();
            float         lastFiringTime = float.MinValue;

            eventInput.OnEventFired += () =>
            {
                if (Time.time < lastFiringTime + spacingInput.Value)
                {
                    return;
                }

                if (FiringTimes.Count < firesInput.Value)
                {
                    FiringTimes.Enqueue(Time.time);
                    lastFiringTime = Time.time;
                    limitedtOutput.Invoke();
                }
                else
                {
                    float lastTime = FiringTimes.Peek();

                    if (Time.time > lastTime + perSecondsInput.Value)
                    {
                        FiringTimes.Dequeue();
                        FiringTimes.Enqueue(Time.time);
                        lastFiringTime = Time.time;
                        limitedtOutput.Invoke();
                    }
                }
            };
        }