CutterWrapper(SequentialPluginDataReader reader, AggressivePlayer player, ILevelManager level) { reader.GetNext(out int id); this.cutter = (TreeCutter)level.GetBuilding(id).Plugin; this.player = player; reader.GetNext(out position); }
public BringingWood(SequentialPluginDataReader reader, Dog dog) : base(dog) { reader.GetNext(out bool isDestructing); if (isDestructing) { reader.GetNext(out double remaining); destruction = new Timeout(DestructionTime, remaining); } }
public static Dictionary <IBuilding, CutterWrapper> LoadCutters(SequentialPluginDataReader reader, AggressivePlayer player, ILevelManager level) { Dictionary <IBuilding, CutterWrapper> cutters = new Dictionary <IBuilding, CutterWrapper>(); reader.GetNext(out int numberOfCutters); for (int i = 0; i < numberOfCutters; i++) { CutterWrapper newWrapper = new CutterWrapper(reader, player, level); cutters.Add(newWrapper.cutter.Building, newWrapper); player.takenPositions.Add(newWrapper.position); } return(cutters); }
public static Worker Load(SequentialPluginDataReader reader, TreeCutter cutter, bool doRespawn) { reader.GetNext(out int ID); reader.GetNext(out double duration); reader.GetNext(out double remaining); IUnit unit = ID != 0 ? cutter.Level.GetUnit(ID) : null; return(new Worker(cutter, unit, duration, remaining) { DoRespawn = doRespawn }); }
public static State Load(SequentialPluginDataReader reader, AggressivePlayer player) { reader.GetNext(out int intState); switch ((States)intState) { case States.BuildCutters: return(new BuildCutters(reader, player)); case States.BuildUnits: return(new BuildUnits(reader, player)); case States.AttackEnemy: return(new AttackEnemy(reader, player)); default: throw new ArgumentOutOfRangeException(); } }
public static State Load(SequentialPluginDataReader reader, Dog dog) { reader.GetNext(out int stateInt); States savedState = (States)stateInt; switch (savedState) { case States.GoingToTree: return(new GoingToTree(reader, dog)); case States.Chomping: return(new Chomping(reader, dog)); case States.BringingWood: return(new BringingWood(reader, dog)); case States.SearchingForTree: return(new SearchingForTree(reader, dog)); default: throw new ArgumentException("Provided data reader contains invalid data"); } }
public SearchingForTree(SequentialPluginDataReader reader, Dog dog) : base(dog) { reader.GetNext <double>(out double remaining); timeout = new Timeout(searchTimeout, remaining); }
public Chomping(SequentialPluginDataReader reader, Dog dog) : base(dog) { reader.GetNext(out double remaining); chomping = new Timeout(duration, remaining); }
public GoingToTree(SequentialPluginDataReader reader, Dog dog) : base(dog) { }
public AttackEnemy(SequentialPluginDataReader reader, AggressivePlayer player) : base(CutterTimeout, DefenseTimeout, player) { }
public BuildUnits(SequentialPluginDataReader reader, AggressivePlayer player) : base(CutterTimeout, DefenseTimeout, player) { }
public BuildCutters(SequentialPluginDataReader reader, AggressivePlayer player) : base(player) { }