Пример #1
0
        void DoTimeStep()
        {
#if PROFILE
            start = Stopwatch.GetTimestamp();
#endif
            SpaceObjectBuffer.Update();
            EntityStateWriteBuffer.Update();
            DeactivationManager.Update();
            ForceUpdater.Update();
            DuringForcesUpdateables.Update();
            BoundingBoxUpdater.Update();
            BroadPhase.Update();
            BeforeNarrowPhaseUpdateables.Update();
            NarrowPhase.Update();
            BeforeSolverUpdateables.Update();
            Solver.Update();
            BeforePositionUpdateUpdateables.Update();
            PositionUpdater.Update();
            BufferedStates.ReadBuffers.Update();
            DeferredEventDispatcher.Update();
            EndOfTimeStepUpdateables.Update();
#if PROFILE
            end = Stopwatch.GetTimestamp();
#endif
        }
Пример #2
0
        public App(string pushNotifParameter = null)
        {
            //INITIALIZATION
            if (AppContext == null)
            {
                IGeolocator                 geoLocator              = CrossGeolocator.Current;
                IRepository                 repository              = new AzureRepository("http://xdevmessaging.azurewebsites.net/");
                IPositionUpdater            positionUpdater         = new PositionUpdater(repository);
                IDisplayNameProvider <User> userDisplayNameProvider = new UserDisplayNameProvider();
                MeetupRepository            meetupRepository        = new MeetupRepository();
                AppContext = new AppContext(repository, geoLocator, positionUpdater, userDisplayNameProvider, meetupRepository);
            }

            //Check stored data
            //if (AppContext.IsUserStored)
            //{
            //    AppContext.LoginFromStorageAsync().Wait();
            //    var mapPage = new NavigationPage(new MapPage(AppContext));
            //    MainPage = mapPage;
            //}
            //else
            //{
            var loginPage = new NavigationPage(new LoginPage(AppContext));

            MainPage = loginPage;
            //}
        }
Пример #3
0
    void UpdateMyPosition()
    {
        PositionUpdater message = new PositionUpdater();                                 // Clean up the message ready to start again.

        for (int i = 0; i < playersInGame.Count; i++)                                    // Go through all the players and find which one is me.
        {
            if (playersInGame[i].networkID == myAddress)                                 // If it is me...
            {
                message.position.x = playersInGame[i].transform.position.x;              // Store my position details in a PositionUpdater
                message.position.y = playersInGame[i].transform.position.y;              // Store my position details in a PositionUpdater
                message.position.z = playersInGame[i].transform.position.z;              // Store my position details in a PositionUpdater
                Byte[] sendBytes = Encoding.ASCII.GetBytes(JsonUtility.ToJson(message)); // Encode that PositionUpdater into a json
                udp.Send(sendBytes, sendBytes.Length);                                   // Send it to the server.
            }
        }
    }
Пример #4
0
 void DoTimeStep()
 {
     SpaceObjectBuffer.Update();
     EntityStateWriteBuffer.Update();
     DeactivationManager.Update();
     ForceUpdater.Update();
     DuringForcesUpdateables.Update();
     BoundingBoxUpdater.Update();
     BroadPhase.Update();
     BeforeNarrowPhaseUpdateables.Update();
     NarrowPhase.Update();
     BeforeSolverUpdateables.Update();
     NarrowPhase.FlushGeneratedSolverUpdateables();
     Solver.Update();
     BeforePositionUpdateUpdateables.Update();
     PositionUpdater.Update();
     BufferedStates.ReadBuffers.Update();
     DeferredEventDispatcher.Update();
     EndOfTimeStepUpdateables.Update();
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.Find("Player");
     script = player.GetComponent <PositionUpdater>();
     head   = script.HeadTransform();
     if (player != null)
     {
         Debug.Log("Player Found");
     }
     else
     {
         Debug.Log("Player not found");
     }
     maxTimes      = 5;
     cubeNumber    = 0;
     score         = maxTimes;
     totalNumber   = 0;
     currentPoints = 0;
     //FindSpawnPosition();
 }
Пример #6
0
        ///<summary>
        /// Removes a space object from the simulation.
        ///</summary>
        ///<param name="spaceObject">Space object to remove.</param>
        public void Remove(ISpaceObject spaceObject)
        {
            if (spaceObject.Space != this)
            {
                throw new ArgumentException("The object does not belong to this space; cannot remove it.");
            }

            SimulationIslandMember simulationIslandMember = spaceObject as SimulationIslandMember;

            if (simulationIslandMember != null)
            {
                DeactivationManager.Remove(simulationIslandMember);
            }

            ISimulationIslandMemberOwner simulationIslandMemberOwner = spaceObject as ISimulationIslandMemberOwner;

            if (simulationIslandMemberOwner != null)
            {
                DeactivationManager.Remove(simulationIslandMemberOwner.ActivityInformation);
            }

            //Go through each stage, removing the space object from it if necessary.
            IForceUpdateable velocityUpdateable = spaceObject as IForceUpdateable;

            if (velocityUpdateable != null)
            {
                ForceUpdater.Remove(velocityUpdateable);
            }

            MobileCollidable boundingBoxUpdateable = spaceObject as MobileCollidable;

            if (boundingBoxUpdateable != null)
            {
                BoundingBoxUpdater.Remove(boundingBoxUpdateable);
            }

            BroadPhaseEntry broadPhaseEntry = spaceObject as BroadPhaseEntry;

            if (broadPhaseEntry != null)
            {
                BroadPhase.Remove(broadPhaseEntry);
            }

            //Entites own collision proxies, but are not entries themselves.
            IBroadPhaseEntryOwner broadPhaseEntryOwner = spaceObject as IBroadPhaseEntryOwner;

            if (broadPhaseEntryOwner != null)
            {
                BroadPhase.Remove(broadPhaseEntryOwner.Entry);
                boundingBoxUpdateable = broadPhaseEntryOwner.Entry as MobileCollidable;
                if (boundingBoxUpdateable != null)
                {
                    BoundingBoxUpdater.Remove(boundingBoxUpdateable);
                }
            }

            SolverUpdateable solverUpdateable = spaceObject as SolverUpdateable;

            if (solverUpdateable != null)
            {
                Solver.Remove(solverUpdateable);
            }

            IPositionUpdateable integrable = spaceObject as IPositionUpdateable;

            if (integrable != null)
            {
                PositionUpdater.Remove(integrable);
            }

            Entity entity = spaceObject as Entity;

            if (entity != null)
            {
                BufferedStates.Remove(entity);
            }

            IDeferredEventCreator deferredEventCreator = spaceObject as IDeferredEventCreator;

            if (deferredEventCreator != null)
            {
                DeferredEventDispatcher.RemoveEventCreator(deferredEventCreator);
            }

            IDeferredEventCreatorOwner deferredEventCreatorOwner = spaceObject as IDeferredEventCreatorOwner;

            if (deferredEventCreatorOwner != null)
            {
                DeferredEventDispatcher.RemoveEventCreator(deferredEventCreatorOwner.EventCreator);
            }

            //Updateable stages.
            IDuringForcesUpdateable duringForcesUpdateable = spaceObject as IDuringForcesUpdateable;

            if (duringForcesUpdateable != null)
            {
                DuringForcesUpdateables.Remove(duringForcesUpdateable);
            }

            IBeforeNarrowPhaseUpdateable beforeNarrowPhaseUpdateable = spaceObject as IBeforeNarrowPhaseUpdateable;

            if (beforeNarrowPhaseUpdateable != null)
            {
                BeforeNarrowPhaseUpdateables.Remove(beforeNarrowPhaseUpdateable);
            }

            IBeforeSolverUpdateable beforeSolverUpdateable = spaceObject as IBeforeSolverUpdateable;

            if (beforeSolverUpdateable != null)
            {
                BeforeSolverUpdateables.Remove(beforeSolverUpdateable);
            }


            IBeforePositionUpdateUpdateable beforePositionUpdateUpdateable = spaceObject as IBeforePositionUpdateUpdateable;

            if (beforePositionUpdateUpdateable != null)
            {
                BeforePositionUpdateUpdateables.Remove(beforePositionUpdateUpdateable);
            }

            IEndOfTimeStepUpdateable endOfStepUpdateable = spaceObject as IEndOfTimeStepUpdateable;

            if (endOfStepUpdateable != null)
            {
                EndOfTimeStepUpdateables.Remove(endOfStepUpdateable);
            }

            IEndOfFrameUpdateable endOfFrameUpdateable = spaceObject as IEndOfFrameUpdateable;

            if (endOfFrameUpdateable != null)
            {
                EndOfFrameUpdateables.Remove(endOfFrameUpdateable);
            }

            spaceObject.Space = null;
            spaceObject.OnRemovalFromSpace(this);
        }
Пример #7
0
        /// <summary>
        /// 生成
        /// </summary>
        /// <param name="part"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override AttributeBase CreateKeyFrame(SpritePart part, ValueBase value)
        {
            Value v = (Value)value;

            return(PositionUpdater.Create(PositionUpdater.kTargetY, v.value));
        }
Пример #8
0
        /// <summary>
        /// executes the program
        /// </summary>
        protected override void ProgramExecution()
        {
            var bundle = GetDataBundle(ConfigurationSettings.InputReferencePath, ConfigurationSettings.InputPrefix);
            var header = bundle.Cache.Header.Custom as GlobalCustomHeader;

            if (header == null)
            {
                throw new InvalidCastException("Unable to cast the custom header as a GlobalCustomHeader");
            }

            IUpdater updater              = null;
            var      outputFiles          = new List <string>();
            var      transcriptDataSource = bundle.Cache.Header.TranscriptSource.ToString();

            if (_useTranscriptUpdater)
            {
                var transcripts = GetDesiredTranscripts(bundle, ConfigurationSettings.TranscriptIds);
                if (transcripts.Count == 0)
                {
                    throw new UserErrorException($"Unable to find the desired transcript: {ConfigurationSettings.TranscriptIds}");
                }

                var transcriptId = ConfigurationSettings.TranscriptIds.First();
                var transcript   = transcripts[0];

                updater = new TranscriptUpdater(transcriptId, transcript.ReferenceIndex, transcriptDataSource);
            }
            else if (_useMultiTranscriptUpdater)
            {
                var transcripts = GetDesiredTranscripts(bundle, ConfigurationSettings.TranscriptIds);
                if (transcripts.Count < 2)
                {
                    throw new UserErrorException($"Unable to find two or more transcripts: {ConfigurationSettings.TranscriptIds}");
                }

                var ids = new List <string>();
                ids.AddRange(ConfigurationSettings.TranscriptIds);

                updater = new MultiTranscriptUpdater(ids, transcriptDataSource);
            }
            else if (_usePositionUpdater)
            {
                var refIndex = bundle.Sequence.Renamer.GetReferenceIndex(ConfigurationSettings.ReferenceName);
                updater = new PositionUpdater(refIndex, ConfigurationSettings.ReferencePosition,
                                              ConfigurationSettings.ReferenceAllele, ConfigurationSettings.AlternateAllele, transcriptDataSource);
            }
            else if (_usePositionRangeUpdater)
            {
                var refIndex = bundle.Sequence.Renamer.GetReferenceIndex(ConfigurationSettings.ReferenceName);
                updater = new PositionRangeUpdater(refIndex, ConfigurationSettings.ReferencePosition,
                                                   ConfigurationSettings.ReferenceEndPosition, transcriptDataSource);
            }

            if (updater == null)
            {
                throw new NullReferenceException("The IUpdater is null.");
            }

            var status = updater.Update(bundle, ConfigurationSettings.OutputDirectory, header.VepVersion, outputFiles);

            UnitTestResourceCrawler.CleanupFiles(status, new List <string>(), outputFiles);

            if (status != UpdateStatus.Current)
            {
                throw new UserErrorException($"Unable to create the mini-cache file. Status: {status}");
            }

            Console.WriteLine();
            Console.WriteLine("- created the following files:");
            foreach (var path in outputFiles)
            {
                Console.WriteLine(Path.GetFileNameWithoutExtension(path));
            }
        }
Пример #9
0
        private static CacheFile TryMatchFilename(string ndbPath, Func <string, Match> matcher, MiniCacheType type,
                                                  ChromosomeRenamer renamer)
        {
            string filename = Path.GetFileName(ndbPath);

            if (filename == null)
            {
                return(null);
            }

            var match = matcher(filename);

            if (!match.Success)
            {
                return(null);
            }

            IUpdater updater;
            string   id, transcriptDataSource;
            int      position;
            ushort   refIndex;

            switch (type)
            {
            case MiniCacheType.Transcript:
                var tuple = FormatUtilities.SplitVersion(match.Groups[1].Value);
                id                   = tuple.Item1;
                refIndex             = renamer.GetReferenceIndex(match.Groups[2].Value);
                transcriptDataSource = match.Groups[3].Value;
                updater              = new TranscriptUpdater(id, refIndex, transcriptDataSource);
                break;

            case MiniCacheType.Regulatory:
                id                   = match.Groups[1].Value;
                refIndex             = renamer.GetReferenceIndex(match.Groups[2].Value);
                transcriptDataSource = match.Groups[3].Value;
                updater              = new RegulatoryUpdater(id, refIndex, transcriptDataSource);
                break;

            case MiniCacheType.Position:
                refIndex = renamer.GetReferenceIndex(match.Groups[1].Value);
                position = int.Parse(match.Groups[2].Value);
                string refAllele = match.Groups[3].Value;
                string altAllele = match.Groups[4].Value;
                transcriptDataSource = match.Groups[5].Value;
                updater = new PositionUpdater(refIndex, position, refAllele, altAllele, transcriptDataSource);
                break;

            case MiniCacheType.PositionRange:
                refIndex = renamer.GetReferenceIndex(match.Groups[1].Value);
                position = int.Parse(match.Groups[2].Value);
                int endPosition = int.Parse(match.Groups[3].Value);
                transcriptDataSource = match.Groups[4].Value;
                updater = new PositionRangeUpdater(refIndex, position, endPosition, transcriptDataSource);
                break;

            default:
                throw new GeneralException($"Unexpected mini-cache type encountered: {type}");
            }

            return(new CacheFile(ndbPath, updater.RefIndex, ConvertTranscriptDataSource(updater.TranscriptDataSource),
                                 type, updater));
        }
Пример #10
0
 private void Awake()
 {
     instance = this;
 }
 protected override void Initialise()
 {
     ParticleGenerator = new RandomParticleGenerator(Context.GetIdHolder().Width, Context.GetIdHolder().Height, ParticleSettings.GetLifetime(), ParticleSettings.GetAgingVelocity(), ParticleSettings.GetVelocity());
     PositionUpdater = new LinearPositionUpdater(Panel.GetXDirectionChange(), Panel.GetYDirectionChange());
     CreateInitialParticles();
 }