Ejemplo n.º 1
0
		public override void Initialize(InitializeParameters p)
		{
			base.Initialize(p);
			
			object1 = new ObjectProxy(FindObject(ObjectId1));
			object2 = new ObjectProxy(FindObject(ObjectId2));
		}
Ejemplo n.º 2
0
        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
            };
        }
Ejemplo n.º 3
0
        public override void Initialize(InitializeParameters p)
        {
            base.Initialize(p);

			PerfMon.Start("Other-Do");

			actions = Compiler.CompileStatements(this, this.Action);

			PerfMon.Stop("Other-Do");
        }
Ejemplo n.º 4
0
		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);
		}
Ejemplo n.º 5
0
		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];
		}
Ejemplo n.º 6
0
        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");
        }
Ejemplo n.º 7
0
		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");
        }
Ejemplo n.º 8
0
        protected void LoadGameElement()
        {
            this.GameObject = LoadXml <XGame>("Game.xml");

            GameObject.InitHierarchy();
            var initParameters = new InitializeParameters()
            {
                Game = this
            };

            GameObject.InitializeMainThread(initParameters);
            GameObject.Initialize(initParameters);

            PrepareGlobals();
        }
Ejemplo n.º 9
0
        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");
        }
Ejemplo n.º 10
0
		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();
			}
		}
Ejemplo n.º 11
0
		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);
			});
		}
Ejemplo n.º 12
0
        public override void Initialize(InitializeParameters p)
        {
            base.Initialize(p);

            GameEngine.Instance.MuteChanged += HandleMuteChanged;
        }
Ejemplo n.º 13
0
		public override void Initialize(InitializeParameters p)
		{
			base.Initialize(p);
			
			valueReader = Compiler.CompileExpression<bool>(this, this.Condition ?? "true");
		}
Ejemplo n.º 14
0
		public override void Initialize(InitializeParameters p)
		{
			base.Initialize(p);
			
			durationReader = Compiler.CompileExpression<double>(this, this.Duration);
		}
Ejemplo n.º 15
0
		public override void Initialize(InitializeParameters p)
		{
			base.Initialize(p);

			GameEngine.Instance.MuteChanged += HandleMuteChanged;
		}
Ejemplo n.º 16
0
		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);
			}
		}
Ejemplo n.º 17
0
		public override void Initialize(InitializeParameters p)
		{
			base.Initialize(p);

            value1Reader = Compiler.CompileExpression<double>(this, this.Property);
		}
Ejemplo n.º 18
0
        public override void Initialize(InitializeParameters p)
		{
			base.Initialize(p);
			
			p.LevelEngine.obstacles.Add(this);
        }