public override void LoadState(PluginDataWrapper pluginData) { animationController = CreateAnimationController(Unit); walker = Unit.GetDefaultComponent <WorldWalker>(); attacker = Unit.GetDefaultComponent <MovingMeeleAttacker>(); RegisterEvents(); var reader = pluginData.GetReaderForWrappedSequentialData(); healthBar = HealthBarControl.Load(Level, Unit, reader); reader.GetNext(out bool attackMove); AttackMove = attackMove; }
public static Wolf CreateNew(ILevelManager level, IUnit unit, WolfType myType) { Wolf wolf = new Wolf(level, unit, myType); wolf.animationController = CreateAnimationController(unit); wolf.walker = WorldWalker.CreateNew(wolf, level); wolf.attacker = MovingMeeleAttacker.CreateNew(wolf, level, true, new IntVector2(20, 20), 1, 5, 0.5f); wolf.healthBar = new HealthBarControl(level, unit, 100, new Vector3(0, 0.7f, 0), new Vector2(0.5f, 0.1f), true); UnitSelector.CreateNew(wolf, level); MovingRangeTarget.CreateNew(wolf, level, targetOffset); unit.AlwaysVertical = false; wolf.RegisterEvents(); return(wolf); }