private AmbushAddProtocol(Ambush ambush) { var ab = ambush as BrambleEnclosureAmbush; this.AmbushType = Ambush.GetAmbushCode(ambush); this.AmbushType = Ambush.GetAmbushCode(ambush); this.IsEntrapment = ab?.IsEntrapping ?? false; this.TilePositionX = ambush.TileY; this.TilePositionY = ambush.TileY; }
//////////////// protected override void InitializeServerSendData(int who) { var myworld = ModContent.GetInstance <AmbushesWorld>(); IEnumerable <Ambush> ambushes = myworld.AmbushMngr.GetAllAmbushes(); int count = ambushes.Count(); this.AmbushTypes = new int[count]; this.IsEntrapments = new bool[count]; this.TilePositionXs = new int[count]; this.TilePositionYs = new int[count]; int i = 0; foreach (Ambush ambush in ambushes) { var ab = ambush as BrambleEnclosureAmbush; this.AmbushTypes[i] = Ambush.GetAmbushCode(ambush); this.IsEntrapments[i] = ab?.IsEntrapping ?? false; this.TilePositionXs[i] = ambush.TileY; this.TilePositionYs[i] = ambush.TileY; i++; } }