public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); //Version 0 if (version >= 0) { m_ContestedPointsPerMinute = reader.ReadDouble(); m_ControlledPointsPerMinute = reader.ReadDouble(); m_HotspotType = (HotspotEventType)reader.ReadInt(); int participantsCount = reader.ReadInt(); for (int a = 0; a < participantsCount; a++) { BaseShip ship = (BaseShip)reader.ReadItem(); int points = reader.ReadInt(); OceanHotspotParticipantEntry entry = new OceanHotspotParticipantEntry(ship); entry.m_Points = points; m_Participants.Add(entry); } } //----- if (!m_Instances.Contains(this)) { m_Instances.Add(this); } }
public override void EventTick() { base.EventTick(); double pointsTickScalar = EventTickInterval / 60; List <BaseShip> m_Ships = new List <BaseShip>(); foreach (BaseShip ship in BaseShip.m_Instances) { if (ship == null) { continue; } if (ship.Deleted) { continue; } if (ship.m_SinkTimer != null) { continue; } if (ship.MobileControlType != MobileControlType.Player) { continue; } if (!(Utility.IsInArea(ship.Location, TopLeftAreaPoint, BottomRightAreaPoint))) { continue; } m_Ships.Add(ship); } foreach (BaseShip ship in m_Ships) { OceanHotspotParticipantEntry entry = GetParticipationEntry(ship); if (m_Ships.Count == 1) { entry.m_Points += (pointsTickScalar * ControlledPointsPerMinute); } else { entry.m_Points += (pointsTickScalar * ContestedPointsPerMinute); } } }
public OceanHotspotParticipantEntry GetParticipationEntry(BaseShip ship) { foreach (OceanHotspotParticipantEntry entry in m_Participants) { if (entry == null) { continue; } if (entry.m_Ship == ship) { return(entry); } } OceanHotspotParticipantEntry newEntry = new OceanHotspotParticipantEntry(ship); m_Participants.Add(newEntry); return(newEntry); }
public OceanHotspotParticipantEntry GetParticipationEntry(BaseBoat boat) { foreach (OceanHotspotParticipantEntry entry in m_Participants) { if (entry == null) { continue; } if (entry.m_Boat == boat) { return(entry); } } OceanHotspotParticipantEntry newEntry = new OceanHotspotParticipantEntry(boat); m_Participants.Add(newEntry); return(newEntry); }