/// <summary> /// Called once per frame, rotates the cube and calculates the Model and view matrices. /// </summary> public void Update(StepTimer timer) { // Rotate the cube. // Convert degrees to radians, then convert seconds to rotation angle. var radiansPerSecond = DEGREES_PER_SECOND * ((float)Math.PI / 180.0f); var totalRotation = timer.TotalSeconds * radiansPerSecond; var radians = (float)Math.IEEERemainder(totalRotation, 2 * Math.PI); var modelRotation = Matrix4x4.CreateFromAxisAngle(new Vector3(0, 1, 0), -radians); // Position the cube. var modelTranslation = Matrix4x4.CreateTranslation(_position); // Multiply to get the transform matrix. // Note that this transform does not enforce a particular coordinate system. The calling // class is responsible for rendering this content in a consistent manner. var modelTransform = modelRotation * modelTranslation; // The view and projection matrices are provided by the system; they are associated // with holographic cameras, and updated on a per-camera basis. // Here, we provide the Model transform for the sample hologram. The Model transform // matrix is transposed to prepare it for the shader. this._modelConstantBufferData.Model = Matrix4x4.Transpose(modelTransform); // Loading is asynchronous. Resources must be created before they can be updated. if (!_loadingComplete) { return; } // Use the D3D device context to update Direct3D device-based resources. var context = this._deviceResources.D3DDeviceContext; // Update the Model transform buffer for the hologram. context.UpdateSubresource(ref this._modelConstantBufferData, this._modelConstantBuffer); }
void Awake() { try { #if ENABLE_VRIK this.avatar = this.avatarForFinalIK; this.head = this.headForFinalIK; this.body = this.bodyForFinalIK; this.LeftHand = this.LeftHandForFinalIK; this.rightHand = this.rightHandForFinalIK; this.noticePanelForAvatar = this.noticePanelForFinalIKAvatar; this.noticeTextForAvatar = this.noticeTextForFinalIKAvatar; #else this.avatar = this.avatarForSimpleIK; this.head = this.headForSimpleIK; this.body = this.bodyForSimpleIK; this.LeftHand = this.LeftHandForSimpleIK; this.rightHand = this.rightHandForSimpleIK; this.noticePanelForAvatar = this.noticePanelForSimpleIKAvatar; this.noticeTextForAvatar = this.noticeTextForSimpleIKAvatar; #endif // Practice mode if (HumanNaviConfig.Instance.configInfo.executionMode == (int)ExecutionMode.Practice) { this.isPracticeMode = true; } // Playback system this.playbackRecorder = this.playbackManager.GetComponent <HumanNaviPlaybackRecorder>(); // Avatar this.initialAvatarPosition = this.avatar.transform.position; this.initialAvatarRotation = this.avatar.transform.eulerAngles; // GUI this.mainMenu = GameObject.FindGameObjectWithTag("MainMenu"); this.panelMainController = mainMenu.GetComponent <PanelMainController>(); this.noticePanelForAvatar.SetActive(false); this.noticeTextForAvatar.text = ""; // MessageMap this.receivedMessageMap = new Dictionary <string, bool>(); this.receivedMessageMap.Add(MsgIamReady, false); this.receivedMessageMap.Add(MsgGetAvatarStatus, false); this.receivedMessageMap.Add(MsgGetObjectStatus, false); this.receivedMessageMap.Add(MsgGetSpeechState, false); this.receivedMessageMap.Add(MsgGiveUp, false); // Timer this.stepTimer = new StepTimer(); } catch (Exception exception) { Debug.LogError(exception); SIGVerseLogger.Error(exception.Message); SIGVerseLogger.Error(exception.StackTrace); this.ApplicationQuitAfter1sec(); } }
/// <summary> /// Called once per frame, rotates the cube and calculates the model and view matrices. /// </summary> public void Update(StepTimer timer) { this.totalTicks = (int)timer.TotalTicks; // Position the cube. Matrix4x4 modelTranslation = Matrix4x4.CreateTranslation(position); // The view and projection matrices are provided by the system; they are associated // with holographic cameras, and updated on a per-camera basis. // Here, we provide the model transform for the sample hologram. The model transform // matrix is transposed to prepare it for the shader. this.modelConstantBufferData.model = Matrix4x4.Transpose(modelTranslation); // Loading is asynchronous. Resources must be created before they can be updated. if (!loadingComplete) { return; } // Use the D3D device context to update Direct3D device-based resources. var context = this.deviceResources.D3DDeviceContext; // Update the model transform buffer for the hologram. context.UpdateSubresource(ref this.modelConstantBufferData, this.modelConstantBuffer); }
internal void Update(StepTimer timer) { foreach (var renderer in Tiles) { renderer?.Update(timer); } foreach (var renderer in statusItems) { renderer?.Update(timer); } settingViewer?.Update(timer); foreach (var pointer in Pointers) { pointer?.Update(timer); } navigationFrame?.Update(timer); navMacroFrame?.Update(timer); navRadioFrame?.Update(timer); macro?.Update(timer); radiology?.Update(timer); histo?.Update(timer); model?.Update(timer); caseView?.Update(timer); }
internal void Update(StepTimer timer) { foreach (StatusBarRenderer sbr in view) { sbr?.Update(timer); } }
void Awake() { try { if (CleanupConfig.Instance.configFileInfo.playbackType == WorldPlaybackCommon.PlaybackTypePlay) { return; } this.tool = new CleanupModeratorTool(this); this.stepTimer = new StepTimer(); this.executionMode = this.tool.GetExecutionMode(); this.mainMenu = GameObject.FindGameObjectWithTag("MainMenu"); this.mainPanelController = mainMenu.GetComponent <PanelMainController>(); } catch (Exception exception) { Debug.LogError(exception); SIGVerseLogger.Error(exception.Message); SIGVerseLogger.Error(exception.StackTrace); this.ApplicationQuitAfter1sec(); } }
/// <summary> /// Called once per frame, rotates the cube and calculates the model and view matrices. /// </summary> public void Update(StepTimer timer) { // Position the cube. Matrix4x4 modelTranslation = Matrix4x4.CreateTranslation(position); // Multiply to get the transform matrix. // Note that this transform does not enforce a particular coordinate system. The calling // class is responsible for rendering this content in a consistent manner. Matrix4x4 modelTransform = modelTranslation; // The view and projection matrices are provided by the system; they are associated // with holographic cameras, and updated on a per-camera basis. // Here, we provide the model transform for the sample hologram. The model transform // matrix is transposed to prepare it for the shader. this.modelConstantBufferData.model = Matrix4x4.Transpose(modelTransform); // Loading is asynchronous. Resources must be created before they can be updated. if (!loadingComplete) { return; } // Use the D3D device context to update Direct3D device-based resources. var context = this.deviceResources.D3DDeviceContext; // Update the model transform buffer for the hologram. context.UpdateSubresource(ref this.modelConstantBufferData, this.modelConstantBuffer); }
void InitLevel(string[] rows) { GameFieldModel fieldModel = new GameFieldModel(rows); PlayerModel playerModel = new PlayerModel(new FieldBounds(fieldModel.Width, fieldModel.Height), TileUtility.GetTiles(TileType.Body, fieldModel.Tiles)); GameFieldView fieldView = gameField.GetComponent <GameFieldView> (); Player playerView = player.GetComponent <Player> (); PlayerController playerController = new PlayerController(playerModel, playerView); GameFieldController gameFieldController = new GameFieldController(fieldModel, fieldView); LevelModel levelModel = new LevelModel(); LevelView levelView = GetComponent <LevelView> (); StepTimer tickTimer = GetComponent <StepTimer> (); StepTimerController timerController = new StepTimerController(levelModel, playerView, tickTimer); StatusPanelView statusView = statusPanel.GetComponent <StatusPanelView> (); StatusPanelController statusPanelController = new StatusPanelController(levelModel, statusView); SpawnController spawnController = new SpawnController(fieldModel, playerModel); LevelController levelController = new LevelController(playerModel, fieldModel, levelModel, levelView, tickTimer); }
void IProfileTestFixture.SetUpIteration(int currentUser, int currentIteration, StepTimer timer) { CurrentUser = currentUser; CurrentIteration = currentIteration; _timer = timer; SetUpIteration(); }
public void Initialize(IntoTheBlaze game) { this.game = game; winTimer = new StepTimer(180); fireSndTimer = new StepTimer(108); fireExtSndTimer = new StepTimer(440); heatMap = new HeatMap(); partSystem = new GamePartSystem(); partSystem.Initialize(game); startingCost = 0; player = new Player(); player.Initialize(this, game); background = new RenderTarget2D( game.GraphicsDevice, 1024, 640, false, game.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); floor = new byte[32, 17]; walls = new byte[32, 17]; backgroundGenerated = false; gameObjects = new Dictionary <string, GameObject>(); wallColliders = new List <Rect>(); gameObjectInstances = new List <GameObjectInstance>(); }
internal override void Update(StepTimer timer) { Task task = new Task(async() => { await UpdateTextureAsync(); }); task.Start(); }
internal void Update(StepTimer timer) { //foreach( var renderer in labels ) { // renderer?.Update( timer ); //} histo?.Update(timer); //image?.Update( timer ); }
/// <summary> /// Marks a new step. /// </summary> public static void NewStep() { Stepping = true; StepCount++; if (StepTimer.ActionReady) { StepTimer.PerformAction(); } }
public virtual void Update(StepTimer timer, SpatialCoordinateSystem referenceFrameCoordinateSystem) { if (!Enabled) { return; } UpdateTransform(referenceFrameCoordinateSystem); }
/// <summary> /// Updates the AwardHandler. /// </summary> public static void Update() { KillTimer.Update(); HandleKillAwards(); StepTimer.Update(); RegenTimer.Update(); HandleSpeedAwards(); }
public StepTimerController(LevelModel levelModel, Player playerView, StepTimer timer) { this.levelModel = levelModel; this.playerView = playerView; this.timer = timer; this.levelModel.LivesChangedHandler += OnLivesChanged; this.playerView.DirectionChangedHandler += OnDirectionChanged; }
public override void StepTimerTick(object source, System.Timers.ElapsedEventArgs e) { move(); if (Math.Abs(x - _target.x) <= 0.05 || Math.Abs(y - _target.y) <= 0.05) { StepTimer.Stop(); _target.hit(_parent); base.hit(); } }
public Zerg(List <Point> points, int wave) //передаю список вейпоинтов и номер волны : base(MobType.Zerg, wave) { this.points = points; x = points[0].X; y = points[0].Y; //NextPointIndex = 1; //StepTimer.Interval = 100.0 / _Speed; StepTimer.Start(); }
internal void Update(StepTimer timer) { if (refreshNeeded) { foreach (var renderer in settingItems) { renderer?.Update(timer); } refreshNeeded = false; } }
public LevelController(PlayerModel playerModel, GameFieldModel gameFieldModel, LevelModel levelModel, LevelView levelView, StepTimer timer) { this.playerModel = playerModel; this.gameFieldModel = gameFieldModel; this.levelModel = levelModel; this.levelView = levelView; this.timer = timer; InitLevelData(); }
/// <summary> /// Called once per frame, rotates the cube and calculates the model and view matrices. /// </summary> public void Update(StepTimer timer, SpatialPointerPose pose) { // Loading is asynchronous. Resources must be created before they can be updated. if (!loadingComplete) { return; } animationEngine.updateObjects(); foreach (var sprite in animationEngine.getObjects()) { sprite.Update(timer, deviceResources, pose); } }
public override IEnumerable GetEvaluationBlock() { var timer = new StepTimer(typedInfo.duration); while (timer.ValueNormalized < 1) { timer.Step(deltaTime); yield return(null); } item = null; }
/// <summary> /// Called once per frame, rotates the cube and calculates the model and view matrices. /// </summary> public void Update(StepTimer timer) { // Loading is asynchronous. Resources must be created before they can be updated. if (!loadingComplete) { return; } foreach (var sprite in sprites) { sprite.Update(timer, deviceResources); } }
public unsafe void TestRandom(int count) { int loopCount = 200; uint[] items = new uint[count]; uint[] lookupList = new uint[count]; for (uint x = 0; x < items.Length; x++) { items[x] = 2 * x; lookupList[x] = 2 * x + 1; } Shuffle(lookupList, 3, 10); StepTimer.Reset(); for (int cnt = 0; cnt < loopCount; cnt++) { //GC.Collect(0); //items = (uint[])items.Clone(); //GC.WaitForPendingFinalizers(); //System.Threading.Thread.Sleep(10); SnapCustomMethodsUInt32 bin = new SnapCustomMethodsUInt32(); fixed(uint *lp = items) { byte * lpp = (byte *)lp; SnapUInt32 box = new SnapUInt32(); StepTimer.ITimer timer = StepTimer.Start("Lookup"); for (int x = 0; x < lookupList.Length; x++) { box.Value = lookupList[x]; bin.BinarySearch(lpp, box, count, 4); //BoxKeyMethodsUint32.BinarySearchTest(lpp, box, count, 4); } timer.Stop(); } } StringBuilder SB = new StringBuilder(); //Console.Write(count.ToString("Tree\t0\t")); //SB.Append((count * 4).ToString("0\t") + (count / StepTimer.GetAverage("Lookup") / 1000000).ToString("0.000\t")); //SB.Append((count * 4.0 / 1024).ToString("0.###\t") + ((StepTimer.GetAverage("Lookup") / Math.Log(count, 2)) / count * 1000000000).ToString("0.00\t")); SB.Append(((StepTimer.GetSlowest("Lookup") / Math.Log(count, 2)) / count * 1000000000).ToString("0.00\t")); //SB.Append(((StepTimer.GetAverage("Lookup") / Math.Log(count, 2)) / count * 1000000000).ToString("0.00\t")); Console.WriteLine(SB.ToString()); }
// Repositions the sample hologram. public void Update(SpatialPointerPose pointerPose, StepTimer timer) { float deltaTime = (float)timer.ElapsedSeconds; float lerpDeltaTime = deltaTime * c_lerpRate; if (pointerPose != null) { // Get the gaze direction relative to the given coordinate system. var headPosition = pointerPose.Head.Position; var headForward = pointerPose.Head.ForwardDirection; var headBack = -headForward; var headUp = pointerPose.Head.UpDirection; var headRight = Vector3.Cross(headForward, headUp); Forward = headForward; Up = headUp; Right = headRight; var prevPosition = position; position = Vector3.Lerp(position, targetPosition, lerpDeltaTime); velocity = (position - prevPosition) / deltaTime; texCoordScale = Vector2.Lerp(texCoordScale, targetTexCoordScale, lerpDeltaTime); texCoordOffset = Vector2.Lerp(texCoordOffset, targetTexCoordOffset, lerpDeltaTime); // Calculate our model to world matrix relative to the user's head. Matrix4x4 modelRotationTranslation = Matrix4x4.CreateWorld(position, Forward, Up); // Scale our 1m quad down to 20cm wide. Matrix4x4 modelScale = Matrix4x4.CreateScale(0.2f); Matrix4x4 modelTransform = modelScale * modelRotationTranslation; // The view and projection matrices are provided by the system; they are associated // with holographic cameras, and updated on a per-camera basis. // Here, we provide the model transform for the sample hologram. The model transform // matrix is transposed to prepare it for the shad(er. modelConstantBufferData.model = Matrix4x4.Transpose(modelTransform); modelConstantBufferData.texCoordScale = texCoordScale; modelConstantBufferData.texCoordOffset = texCoordOffset; // Use the D3D device context to update Direct3D device-based resources. var context = deviceResources.D3DDeviceContext; // Update the model transform buffer for the hologram. context.UpdateSubresource(ref this.modelConstantBufferData, this.modelConstantBuffer); } }
public override IEnumerable GetEvaluationBlock() { var info = this.info as PickUpItemStateInfo; var timer = new StepTimer( info.duration ); while ( timer.ValueNormalized < 1f ) { timer.Step( deltaTime ); yield return null; } target.NotifyPickUp( character ); character.inventory.AddItem( target.item ); target = null; }
internal override void Update(StepTimer timer) { var time = System.DateTime.Now.ToString("h:mm:ss"); if (!time.Equals(Text)) { Updating = true; Text = time; Task task = new Task(async() => { await UpdateTextureAsync(); }); task.Start(); } }
public override IEnumerable GetEvaluationBlock() { var info = this.info as PickUpItemStateInfo; var timer = new StepTimer(info.duration); while (timer.ValueNormalized < 1f) { timer.Step(deltaTime); yield return(null); } target.NotifyPickUp(character); character.Inventory.AddItem(target.item); target = null; }
/************************************************************************** * FUNCTIONS * **************************************************************************/ /// <summary> /// Switch the states between play and pause /// </summary> public void switchPlayPauseState() { if (isAutoplaying) { btnPlayPause.Text = "4"; StepTimer.Stop(); } else { btnPlayPause.Text = ";"; StepTimer.Start(); } // Invert the state isAutoplaying = !isAutoplaying; }
internal override void Update(StepTimer timer) { var txt = Index == 0 ? Settings.Image1 : Settings.Image2; if (!txt.Equals(Text)) { Updating = true; Text = txt; Task task = new Task(async() => { await UpdateTextureAsync(); }); task.Start(); } }
public void Update(StepTimer timer) { Matrix4x4 modelRotation = Matrix4x4.CreateConstrainedBillboard(position, headPosition, Vector3.UnitY, headForward, Vector3.UnitZ); Matrix4x4 modelTranslation = Matrix4x4.CreateTranslation(position); modelConstantBufferData.Model = Matrix4x4.Transpose(modelRotation * modelTranslation); if (!loadingFinished) { return; } var context = deviceResources.D3DDeviceContext; context.UpdateSubresource(ref modelConstantBufferData, modelConstantBuffer); }