public override void Load() { base.Load(); var pauseButton = this.GameObjects.First(g => g.Name.ToLower().Contains("pause")); var buttonAnimation = new PropertyAnimationComponent(); buttonAnimation.Property = "Scale"; buttonAnimation.StartValue = "1,1,1"; buttonAnimation.StopValue = "1.1,1.1,1"; buttonAnimation.DurationSeconds = 0.2f; pauseButton.AddComponent(buttonAnimation); pauseButton.OnMouseDown += new EventHandler<Engine.Events.MouseButtonDownEvent>(pauseButton_OnMouseDown); pauseButton.OnMouseUp += new EventHandler<Engine.Events.MouseButtonUpEvent>(pauseButton_OnMouseUp); pauseButton.OnMouseOut += new EventHandler<Engine.Events.MouseOutEvent>(pauseButton_OnMouseOut); _starTextComponent = GameObjects.First(g => g.Name == "StarCount").Components.First(c => c is TextComponent) as TextComponent; _game = this.Game as TestGame; var gameOver = this.GameObjects.First(g => g.Name == "Gameover"); gameOver.Visible = false; gameOver.Enabled = false; gameOver.OnMouseDown += (a, b) => { var overlay = this.GameObjects.Single(g => g.Name == "Overlay"); overlay.Visible = false; gameOver.Visible = false; gameOver.Enabled = false; ((TestGame)this.Game).ReloadScene(); }; }
public override void OverrideLoadedProperties() { base.OverrideLoadedProperties(); /* should be set by engine, so reset properties works as expected */ _alphaAnimationComponent = Components.First(c => c.Id == AlphaAnimationComponentId) as PropertyAnimationComponent; _alphaAnimationComponent.Property = "StarColor"; _alphaAnimationComponent.StartValue = StarColor.ToString().Replace("(", string.Empty).Replace(")", string.Empty); var stopColor = new Vector4(StarColor.X, StarColor.Y, StarColor.Z, 0); _alphaAnimationComponent.StopValue = stopColor.ToString().Replace("(", string.Empty).Replace(")", string.Empty); _alphaAnimationComponent.DurationSeconds = 0.5f; _rotationAnimationComponent = Components.First(c => c.Id == RotationAnimationComponentId) as PropertyAnimationComponent; _rotationAnimationComponent.Property = "Rotation"; _rotationAnimationComponent.StartValue = new Vector3(0, 0, this.Rotation.Z).ToString().Replace("(", string.Empty).Replace(")", string.Empty); _rotationAnimationComponent.StopValue = new Vector3(0, 6.28f / 2f, this.Rotation.Z).ToString().Replace("(", string.Empty).Replace(")", string.Empty); _rotationAnimationComponent.DurationSeconds = 0.5f; DistanceSorting = true; _grabbed = false; _flare.Position = this.WorldPosition; }
protected override void Init() { base.Init(); _alphaAnimationComponent = Components.First(c => c.Id == AlphaAnimationComponentId) as PropertyAnimationComponent; _alphaAnimationComponent.Property = "FlareColor"; _alphaAnimationComponent.StartValue = "1,1,0,1"; _alphaAnimationComponent.StopValue = "1,1,0,0"; _alphaAnimationComponent.DurationSeconds = 2.0f; _alphaAnimationComponent.PlayMode = AnimationComponent.Mode.RepeatInverted; DistanceSorting = true; }
void Scene_OnLoaded(object sender, Engine.Events.LoadedEvent e) { _previousPosition = this.Position; this.Material.ShaderProgram = ShaderProgram.ProgramType.POINTLIGHT; Material.TextureName = "greenball"; DistanceSorting = true; if (!Game.InDesignMode) { var lightAnim = new PropertyAnimationComponent(); lightAnim.StartValue = "0,0,0,1"; lightAnim.StopValue = "1,1,1,1"; lightAnim.DurationSeconds = 5; lightAnim.PlayMode = AnimationComponent.Mode.Play; lightAnim.Property = "Light.Diffuse"; _lightObject.AddComponent(lightAnim); lightAnim.Play(); } SetAsTarget(); _aimSphere.Enabled = !Game.InDesignMode; }
public override void OverrideLoadedProperties() { base.OverrideLoadedProperties(); _scaleAnimationComponent = Components.First(c => c.Id == ScaleAnimationComponentId) as PropertyAnimationComponent; _scaleAnimationComponent.Property = "Scale"; _scaleAnimationComponent.StartValue = StartScale.ToString().Replace("(", string.Empty).Replace(")", string.Empty); _scaleAnimationComponent.StopValue = StopScale.ToString().Replace("(", string.Empty).Replace(")", string.Empty); _scaleAnimationComponent.DurationSeconds = ScaleDuration; _alphaAnimationComponent = Components.First(c => c.Id == AlphaAnimationComponentId) as PropertyAnimationComponent; _alphaAnimationComponent.Property = "FlareColor"; _alphaAnimationComponent.StartValue = StartFlareColor.ToString().Replace("(", string.Empty).Replace(")", string.Empty); _alphaAnimationComponent.StopValue = StopFlareColor.ToString().Replace("(", string.Empty).Replace(")", string.Empty); _alphaAnimationComponent.DurationSeconds = ColorDuration; DistanceSorting = true; }