private void OnEnable() { RPGCharacter character = (RPGCharacter)target; character.Stats.SetupReferences(); character.States.SetupReferences(); }
private void Update() { RPGCharacter character = (RPGCharacter)target; if (character.Buffs != null && character.Buffs.Count != 0) { Repaint(); } }
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); } }
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); } }
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); }
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); }
public BuffCollection(RPGCharacter applyBuffs) { //character = applyBuffs; }
private void Subscribe(RPGCharacter character) { character.Buffs.OnAddBuff += CreateIndicator; }
public void SetTarget(IBehaviourContext context, RPGCharacter target) { ConnectionEntry <RPGCharacter> targetOutput = Target.GetEntry(context); targetOutput.Value = target; }