public override void Initialize(InitializeParameters p) { base.Initialize(p); object1 = new ObjectProxy(FindObject(ObjectId1)); object2 = new ObjectProxy(FindObject(ObjectId2)); }
public ScreenEngine(GameEngine game, string fileName) { this.game = game; this.Content = new ContentManager(game.Services, GameEngine.ContentRootDirectory); this.FileName = fileName; this.CurrentEvents = new Dictionary <string, bool>(); this.tapAreas = new List <XTapArea>(); this.obstacles = new List <XElement>(); this.spriteBatch = new SpriteBatchWithFloats(this.game.GraphicsDevice); if (this.game.Scale != Vector3.One) { scaleMatrix = Matrix.CreateScale(this.game.Scale); } this.initializeParameters = new InitializeParameters() { Game = game, ScreenEngine = this }; this.updateParameters = new UpdateParameters() { Game = game, ScreenEngine = this }; this.drawParameters = new DrawParameters() { Game = game, ScreenEngine = this, SpriteBatch = spriteBatch }; }
public override void Initialize(InitializeParameters p) { base.Initialize(p); PerfMon.Start("Other-Do"); actions = Compiler.CompileStatements(this, this.Action); PerfMon.Stop("Other-Do"); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); if (this.Action != null) this.actions = Compiler.CompileStatements(this, this.Action); if (this.EnterAction != null) this.enterActions = Compiler.CompileStatements(this, this.EnterAction); if (this.ExitAction != null) this.exitActions = Compiler.CompileStatements(this, this.ExitAction); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); if (this.Value == "0") value2Reader = NumConstant.Zero; else value2Reader = Compiler.CompileExpression<double>(this, this.Value); compareFunc = compareFuncs[this.Compare]; }
public override void Initialize(InitializeParameters p) { base.Initialize(p); PerfMon.Start("Other-KeyFrame"); animation = (XNumAnimation)this.Parent; GenerateValueReaders(); this.timeReader = Compiler.CompileExpression<double>(this.Parent, this.Time); this.CurrentTime = 0f; PerfMon.Stop("Other-KeyFrame"); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); PerfMon.Start("Other-Tap"); p.ScreenEngine.tapAreas.Add(this); InitActions(this.Action, ref this.pressActions); InitActions(this.MoveAction, ref this.moveActions); InitActions(this.ReleaseAction, ref this.releaseActions); PerfMon.Stop("Other-Tap"); }
protected void LoadGameElement() { this.GameObject = LoadXml <XGame>("Game.xml"); GameObject.InitHierarchy(); var initParameters = new InitializeParameters() { Game = this }; GameObject.InitializeMainThread(initParameters); GameObject.Initialize(initParameters); PrepareGlobals(); }
public override void Initialize(InitializeParameters p) { if (EnableTrace) this.trace = new List<Tuple<double, double>>(2048); if (!string.IsNullOrEmpty(this.From)) { // Use the From/To properties this.CreateSubcomponents(); this.Subcomponents.Add(new XKeyFrame() { Time = "0", Value = this.From, Smoothing = this.Smoothing }); this.Subcomponents.Add(new XKeyFrame() { Time = this.Duration, Value = this.To, Smoothing = this.Smoothing }); } base.Initialize(p); PerfMon.Start("Other-Ani"); // get targets GenerateTargets(); startValues = new List<double?>(new double?[targets.Count]); // collect keyFrames and check for consistency keyFrames = this.GetComponents<XKeyFrame>().ToList(); if (keyFrames.Any(k => k.CurveKeys.Count != targets.Count)) throw new InvalidOperationException("Number of values in key frames must match number of targets."); if (keyFrames.Count < 2) throw new InvalidOperationException("Number of key frames must be 2 or more."); lastFrame = keyFrames[keyFrames.Count - 1]; // create curves curves = new List<TimeCurve>(targets.Count); for (int i = 0; i < targets.Count; i++) { var curve = new TimeCurve(); curve.PostLoop = this.Autoreverse ? CurveLoopType.Oscillate : CurveLoopType.Cycle; curve.PreLoop = this.Autoreverse ? CurveLoopType.Oscillate : CurveLoopType.Cycle; for (int j = 0; j < keyFrames.Count; j++) { curve.Keys.Add(keyFrames[j].CurveKeys[i]); } curves.Add(curve); } PerfMon.Stop("Other-Ani"); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); string internalTypeName = "Lunohod.Objects.X" + this.TypeFilter; this.TypeFilterType = this.GetType().Assembly.GetType(internalTypeName); if (this.TypeFilterType == null) { throw new InvalidOperationException("Iterator could not find type: " + internalTypeName); } if (this.ObjectIds != null) { this.objects = this.ObjectIds.Split(',').Select(id => FindObject(id, p.ScreenEngine.RootComponent)).ToList(); } }
public override void Initialize(InitializeParameters p) { base.Initialize(p); var pairs = this.Ranges.Split(','); eplodingElements = new List<XElement>(pairs.Length); rangeNames = new List<string>(pairs.Length); rangeValuesSquared = new List<double>(pairs.Length); pairs.ForEach(s => { var parts = s.Split('='); rangeNames.Add(parts[0]); var rangeValue = double.Parse(parts[1], CultureInfo.InvariantCulture); rangeValuesSquared.Add(rangeValue * rangeValue); }); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); GameEngine.Instance.MuteChanged += HandleMuteChanged; }
public override void Initialize(InitializeParameters p) { base.Initialize(p); valueReader = Compiler.CompileExpression<bool>(this, this.Condition ?? "true"); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); durationReader = Compiler.CompileExpression<double>(this, this.Duration); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); this.ParentElement = this.FindAncestor(o => o is XElement) as XElement; var exploding = this as IExploding; if (exploding != null && exploding.IsExploding) { ((XLevel)this.GetScreen()).Exploding.Add(this); } }
public override void Initialize(InitializeParameters p) { base.Initialize(p); value1Reader = Compiler.CompileExpression<double>(this, this.Property); }
public override void Initialize(InitializeParameters p) { base.Initialize(p); p.LevelEngine.obstacles.Add(this); }