/// <summary> /// 使用繪製物件和移動物件建立互動性活動物件 /// </summary> /// <param name="drawObject">繪製物件</param> /// <param name="moveObject">移動物件</param> public ObjectActive(DrawBase drawObject, MoveBase moveObject) : base(drawObject, moveObject) { Skills = new SkillCollection(); Energy = new CounterObject(Global.DefaultEnergyLimit, Global.DefaultEnergyLimit, false); EnergyGetPerSec = Global.DefaultEnergyGetPerSec; }
/// <summary> /// 發生於技能集合變更 /// </summary> protected virtual void OnSkillsChanged(SkillCollection oldValue, SkillCollection newValue) { if (oldValue != null) { oldValue.BindingUnlock(); oldValue.Binding(Scene); } if (newValue != null) { newValue.Binding(this, true); } if (SkillsChanged != null) { SkillsChanged(this, oldValue, newValue); } }
/// <summary> /// 綁定技能到集合(集合>所有人>場景,集合內綁定,除此之外勿使用此函數) /// </summary> /// <param name="collection">集合</param> /// <param name="bindingLock">綁定後是否鎖定綁定功能</param> public void Binding(SkillCollection collection, bool bindingLock = false) { if (_Container == collection) { return; } if (BindingLock) { throw new Exception("技能已被鎖定無法綁定"); } if (collection != null && !collection.Contains(this)) { throw new Exception("技能不在集合中"); } Break(); Container = collection; Owner = null; Scene = null; BindingLock = bindingLock; OnBindingChanged(); }