Exemple #1
0
        public void CheckAndUpdateVoyeur(TargettedVoyeurInfo voyeur)
        {
            var newPos = GetInterpolatedPosition(voyeur.Quantum);

            if (newPos != null)
            {
                if (newPos.Distance(voyeur.LastSentPosition) > voyeur.Radius)
                {
                    SendVoyeurUpdate(voyeur, newPos, TargetStatus.OK);
                }
            }
        }
Exemple #2
0
        public void SendVoyeurUpdate(TargettedVoyeurInfo voyeur, Position pos, TargetStatus status)
        {
            voyeur.LastSentPosition = new Position(pos);    // ref?

            var info = new TargetInfo(0, PhysicsObj.ID, voyeur.Radius, voyeur.Quantum);

            info.TargetPosition       = PhysicsObj.Position;
            info.InterpolatedPosition = new Position(pos);    // ref?
            info.Velocity             = PhysicsObj.get_velocity();
            info.Status = status;

            var voyeurObj = PhysicsObj.GetObjectA(voyeur.ObjectID);

            if (voyeurObj != null)
            {
                voyeurObj.receive_target_update(info);
            }
        }
Exemple #3
0
        public void AddVoyeur(uint objectID, float radius, double quantum)
        {
            if (VoyeurTable != null)
            {
                VoyeurTable.TryGetValue(objectID, out var existingInfo);
                if (existingInfo != null)
                {
                    existingInfo.Radius  = radius;
                    existingInfo.Quantum = quantum;
                    return;
                }
            }
            else
            {
                VoyeurTable = new Dictionary <uint, TargettedVoyeurInfo>();
            }

            var info = new TargettedVoyeurInfo(objectID, radius, quantum);

            VoyeurTable.Add(objectID, info);

            SendVoyeurUpdate(info, PhysicsObj.Position, TargetStatus.OK);
        }