Exemple #1
0
        private void CreateTrackerItem(NaniteMiningItem target)
        {
            double distance = Vector3D.Distance(m_constructionBlock.ConstructionBlock.GetPosition(), target.Position);
            int    time     = (int)Math.Max(GetMinTravelTime() * 1000f, (distance / GetSpeed()) * 1000f);

            NaniteMiningTarget miningTarget = new NaniteMiningTarget();

            miningTarget.ParticleCount = 0;
            miningTarget.StartTime     = MyAPIGateway.Session.ElapsedPlayTime.TotalMilliseconds;
            miningTarget.LastUpdate    = MyAPIGateway.Session.ElapsedPlayTime.TotalMilliseconds;
            miningTarget.CarryTime     = time - 1000;
            m_targetTracker.Add(target, miningTarget);
        }
        private void CreateTrackerItem(NaniteMiningItem target)
        {
            var    nearestFactory = GetNearestFactory(TargetName, target.Position);
            double distance       = Vector3D.Distance(nearestFactory.ConstructionBlock.GetPosition(), target.Position);
            int    time           = (int)Math.Max(GetMinTravelTime() * 1000f, (distance / GetSpeed()) * 1000f);

            NaniteMiningTarget miningTarget = new NaniteMiningTarget();

            miningTarget.ParticleCount = 0;
            miningTarget.StartTime     = MyAPIGateway.Session.ElapsedPlayTime.TotalMilliseconds;
            miningTarget.LastUpdate    = MyAPIGateway.Session.ElapsedPlayTime.TotalMilliseconds;
            miningTarget.CarryTime     = time - 1000;

            MyAPIGateway.Utilities.InvokeOnGameThread(() =>
            {
                if (!m_targetTracker.ContainsKey(target))
                {
                    m_targetTracker.Add(target, miningTarget);
                }
            });
        }