protected void LinkBehavior(string name, IBehavior behavior) { if (Behaviors.ContainsKey(name)) { Behaviors[name] = behavior; } else { Behaviors.Add(name, behavior); } behavior.SetUnit(unit, name); }
public void AddBehavior(IBehavior b, string behaviorName) { if (b is IVelocityModifier) { Par.VelocityModifiers.Add((IVelocityModifier)b); Par.UpdateXYVelocity(); } b.SetUnit(this, behaviorName); b.Init(); if (actions.ContainsKey(b.Name)) { actions[b.Name] = b; } else { actions.Add(b.Name, b); } act.Add(b); }