protected override async Task OnActivateAsync() { VisualObject newObject = VisualObject.CreateRandom(this.Id.ToString()); ActorEventSource.Current.ActorMessage(this, "StateCheck {0}", (await this.StateManager.ContainsStateAsync(StatePropertyName)).ToString()); VisualObject result = await this.StateManager.GetOrAddStateAsync <VisualObject>(StatePropertyName, newObject); this.jsonString = result.ToJson(); // ACTOR MOVEMENT REFRESH this.updateTimer = this.RegisterTimer(this.MoveObject, null, TimeSpan.FromMilliseconds(10), TimeSpan.FromMilliseconds(10)); return; }
private async Task MoveObject(object obj) { VisualObject visualObject = await this.StateManager.GetStateAsync <VisualObject>(StatePropertyName); //alternate which lines are commented out //then do an upgrade to cause the //visual objects to start rotating visualObject.Move(false); //visualObject.Move(true); await this.StateManager.SetStateAsync <VisualObject>(StatePropertyName, visualObject); this.jsonString = visualObject.ToJson(); return; }
private async Task MoveObject(object obj) { VisualObject visualObject = await this.StateManager.GetStateAsync <VisualObject>(StatePropertyName); //visualObject.Move(true); if (client.BoolVariation("rotate-object-flag", user, false)) { visualObject.Move(true); } else { visualObject.Move(false); } await this.StateManager.SetStateAsync <VisualObject>(StatePropertyName, visualObject); this.jsonString = visualObject.ToJson(); return; }