Example #1
0
        private void OnEnable()
        {
            RPGCharacter character = (RPGCharacter)target;

            character.Stats.SetupReferences();
            character.States.SetupReferences();
        }
Example #2
0
        private void Update()
        {
            RPGCharacter character = (RPGCharacter)target;

            if (character.Buffs != null && character.Buffs.Count != 0)
            {
                Repaint();
            }
        }
Example #3
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            RPGCharacter character = (RPGCharacter)target;

            if (character.Buffs != null && character.Buffs.Count != 0)
            {
                foreach (Buff buff in character.Buffs)
                {
                    if (buff == null)
                    {
                        continue;
                    }

                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField(buff.StackSize.Value.ToString() + "   " + buff.buffTemplate.name, EditorStyles.boldLabel);

                    Rect iconRect = GUILayoutUtility.GetLastRect();
                    iconRect      = EditorGUI.IndentedRect(iconRect);
                    iconRect.xMax = iconRect.xMin + iconRect.height;
                    iconRect.x   -= iconRect.height;

                    DrawCustomIcon(iconRect, buff.buffTemplate.Icon);

                    EditorGUI.indentLevel++;
                    foreach (BuffClock clock in buff.Clocks)
                    {
                        Rect rect = GUILayoutUtility.GetRect(0, 16);

                        rect = EditorGUI.IndentedRect(rect);

                        if (typeof(BuffClockDecaying).IsAssignableFrom(clock.GetType()))
                        {
                            BuffClockDecaying decayingClock = (BuffClockDecaying)clock;

                            EditorGUI.ProgressBar(rect, decayingClock.TimeRemaining / decayingClock.Duration, decayingClock.StackSize.Value.ToString());
                        }
                        else if (typeof(BuffClockFixed).IsAssignableFrom(clock.GetType()))
                        {
                            BuffClockFixed fixedClock = (BuffClockFixed)clock;

                            EditorGUI.ProgressBar(rect, 1.0f, fixedClock.StackSize.Value.ToString());
                        }
                    }

                    EditorGUI.indentLevel--;
                    EditorGUI.indentLevel--;
                }

                GUILayout.Space(20);
            }
        }
Example #4
0
        public void TryUse(ItemSurrogate context, RPGCharacter character)
        {
            ConnectionEntry <int> manaCostInput     = ManaCost.GetEntry(context);
            ConnectionEntry <int> quantityCostInput = QuantityCost.GetEntry(context);
            EventEntry            onActivateOutput  = OnActivate.GetEntry(context);

            if (CanCharacterUse(context, character))
            {
                context.owner.Value.States.CurrentMana.Value -= manaCostInput.Value;
                context.Quantity -= quantityCostInput.Value;

                onActivateOutput.OnEventFired();
                AudioManager.Play(ActivateSound);
            }
        }
Example #5
0
        public bool CanCharacterUse(ItemSurrogate context, RPGCharacter character)
        {
            ConnectionEntry <int> manaCostInput     = ManaCost[context];
            ConnectionEntry <int> quantityCostInput = QuantityCost[context];

            if (context.Quantity < quantityCostInput.Value)
            {
                return(false);
            }

            if (context.owner.Value.States.CurrentMana.Value < manaCostInput.Value)
            {
                return(false);
            }

            return(true);
        }
Example #6
0
        public Buff(BuffTemplate _buffTemplate, RPGCharacter _target, BuffClock baseClock)
        {
            buffTemplate = _buffTemplate;
            buffTemplate.SetupGraph(this);

            buffInput = buffTemplate.GetNode <BuffInputNode>();
            buffInput.Target.GetEntry(this).Value = _target;

            AddClock(baseClock);

            BaseStackSize.onChanged += RecalculateStackSize;

            OnRemove += () =>
            {
                buffTemplate.RemoveGraph(this);
            };
            buffInput.SetTarget(this, this);
        }
Example #7
0
 public BuffCollection(RPGCharacter applyBuffs)
 {
     //character = applyBuffs;
 }
Example #8
0
 private void Subscribe(RPGCharacter character)
 {
     character.Buffs.OnAddBuff += CreateIndicator;
 }
Example #9
0
        public void SetTarget(IBehaviourContext context, RPGCharacter target)
        {
            ConnectionEntry <RPGCharacter> targetOutput = Target.GetEntry(context);

            targetOutput.Value = target;
        }