public void RemoveSteering(SteeringType Type) { if (Behaviours.ContainsKey(Type)) { Behaviours.Remove(Type); } }
private void OnBehaviourRemoved(Behaviour behaviour) { Behaviours.Remove(behaviour); behaviour.Removed -= OnBehaviourRemoved; BehaviourRemoved?.Invoke(behaviour); AnyBehaviourRemoved?.Invoke(behaviour); }
public bool RemoveBehaviour(string abbreviatedName) { lock (Behaviours) { IBehaviour behaviour; if (!Behaviours.TryGetValue(abbreviatedName, out behaviour)) { return(false); } behaviour.Close(); Behaviours.Remove(abbreviatedName); return(true); } }
public void InitProperties() { AddValidatedProperty("Gradient", false); AddValidatedProperty("Flat", false); AddValidatedProperty("CornerRadius", 0); AddValidatedProperty("Text", ""); AddValidatedProperty("TextColor", Color.Navy); AddValidatedProperty("MouseIsDown", false); AddValidatedProperty("ControlKeyPressed", false); Property["Switch", false] .Changed += () => { if (Switch) { Behaviours.Add(Core.Behaviours.Checked(), "checked"); } else { Behaviours.Remove("checked"); } Invalidate(); }; Value["Down"] = new Func <object>(() => { return(MouseIsDown || Checked || Value["ControlKeyPressed"].AsBoolean()); }); AddValidatedProperty("Font", new Font("Arial", 8)); TextAlignment = StringAlignment.Center; DrawFocus = true; Value["FlatIsNow"] = new Func <object>(() => { return(Flat && !MouseIsOver && !Down); }); Property["Checked", false].Changed += () => { Invalidate(); if (CheckedChanged != null) { CheckedChanged(this, new EventArgs()); } }; }
/// <summary> /// Removes a behaviour from this manager. /// </summary> /// <param name="behaviour">The behaviour this manager should stop managing.</param> /// <returns> /// <c>true</c> if the behaviour was removed; else <c>false</c>. /// </returns> public virtual bool Remove(T behaviour) { return(Behaviours.Remove(behaviour)); }
public void RemoveBehaviour(BaseBehaviour behaviour) => Behaviours.Remove(behaviour);