internal CWormholeSoundDirectory(CServiceLocatorNode aParent) : base(aParent) { this.World = this.ServiceContainer.GetService <CWorld>(); this.CreateDirectoryDic = true; this.AddDirectory(CSoundDirectoryEnum.Audio_Wormhole); this.World.WormholeEntered += this.OnWormholeEntered; }
internal CGridLinesSprite(CServiceLocatorNode aParent) : base(aParent) { this.QuadrantValue = CValue.GetStaticValue <CBoolValue>(this.World, QuadrantValueDeclaration); this.PlattformSpriteEnum = CPlatformSpriteEnum.GridLines; this.Init(); }
internal CPlanet(CServiceLocatorNode aParent) : base(aParent) { this.DestroyedSound = CSoundDirectoryEnum.Audio_Destroyed_Planet; this.CategoryName = "Planet"; this.Init(); }
internal CHitPointEngine(CServiceLocatorNode aParent, CHitpoint[] aHitPoints) : base(aParent) { this.World = this.ServiceContainer.GetService <CWorld>(); this.HitPoints = aHitPoints.OrderBy(aHitPoint => aHitPoint.Item1.TotalMilliseconds).ToArray(); this.BackgroundTaskCancelRequested = false; this.BackgroundTask = Task.Factory.StartNew(this.RunBackgroundTask); }
internal CSinglePoolSpriteManager(CServiceLocatorNode aParent) : base(aParent) { this.SpritePool = new CObjectPool <TSprite>(); this.SpritePool.NewFunc = new Func <TSprite>(() => this.NewSprite()); this.SpritePool.Deallocated += this.OnDeallocated; this.SpritePool.Allocated += this.OnAllocated; }
internal CMonoBumperModel(CServiceLocatorNode aParent) : base(aParent) { var aAsteroidModel = this.Models.AsteroidModel; this.OctaederLineListVertexBuffer = aAsteroidModel.Octaeder.ColoredLineList.ToVertexPositionColor().ToVertexBuffer(this.Game.GraphicsDevice); this.SphereDots = aAsteroidModel.Sphere.Dots; var aGraphicsDevice = this.Game.GraphicsDevice; this.SphereLineListVertexBuffer = aAsteroidModel.Sphere.HorizontalOutterPolygonLineList.ToVector3s().ToVertexPositionColor(Color.White).ToVertexBuffer(aGraphicsDevice); this.SphereLineListVertexBuffers = (from aSphere in aAsteroidModel.Spheres select aSphere.HorizontalOutterPolygonLineList.ToVector3s().ToVertexPositionColor(Color.White) .ToVertexBuffer(aGraphicsDevice)).ToArray(); this.SphereTriangleListVertexBuffers = (from aSphere in aAsteroidModel.Spheres select aSphere.TriangleStrips.ToVector3s().ToVertexPositionColor(Color.White) .ToVertexBuffer(aGraphicsDevice)).ToArray(); this.CircleVertexBuffers = new CCircleVertexBuffers(aGraphicsDevice, aAsteroidModel.Circles, CMonoColors.OrbitGray); this.MviAsteroidModel = aAsteroidModel; this.BlendState = new BlendState(); this.BlendState.ColorSourceBlend = Blend.BlendFactor; this.BlendState.AlphaBlendFunction = BlendFunction.Subtract; // test this.BlendState.AlphaSourceBlend = Blend.BlendFactor; var aRasterizerState = new RasterizerState(); aRasterizerState.CullMode = CullMode.CullClockwiseFace; this.RasterizerState = aRasterizerState; this.RotateBy90Degrees = Matrix.CreateRotationZ(MathHelper.ToRadians(90f)); }
internal CGridLinesModel(CServiceLocatorNode aParent) : base(aParent) { this.FrontSquare = new CVector3Dbl[] { this.FrontBottomLeft, this.FrontTopLeft, this.FrontTopRight, this.FrontBottomRight }; this.BackSquare = new CVector3Dbl[] { this.BackBottomLeft, this.BackTopLeft, this.BackTopRight, this.BackBottomRight }; this.TopSquare = new CVector3Dbl[] { this.FrontTopLeft, this.BackTopLeft, this.BackTopRight, this.FrontTopRight }; this.BottomSquare = new CVector3Dbl[] { this.FrontBottomLeft, this.BackBottomLeft, this.BackBottomRight, this.FrontBottomRight }; this.LeftSquare = new CVector3Dbl[] { this.FrontBottomLeft, this.FrontTopLeft, this.BackTopLeft, this.BackBottomLeft }; this.RightSquare = new CVector3Dbl[] { this.FrontBottomRight, this.FrontTopRight, this.BackTopRight, this.BackBottomRight }; this.FrontSquareLines = this.FrontSquare.PolyPointsToLines().ToArray(); this.BackSquareLines = this.BackSquare.PolyPointsToLines().ToArray(); this.TopSquareLines = this.TopSquare.PolyPointsToLines().ToArray(); this.BottomSquareLines = this.BottomSquare.PolyPointsToLines().ToArray(); this.LeftSquareLines = this.LeftSquare.PolyPointsToLines().ToArray(); this.RightSquareLines = this.RightSquare.PolyPointsToLines().ToArray(); this.LineList = Array.Empty <CVector3Dbl>() .Concat(this.FrontSquareLines) .Concat(this.BackSquareLines) .Concat(this.TopSquareLines) .Concat(this.BottomSquareLines) .Concat(this.LeftSquareLines) .Concat(this.RightSquareLines) .ToArray() ; }
internal CMonoGemModel(CServiceLocatorNode aParent) : base(aParent) { var aModel = this.Models.GemModel; this.OctaederTriangleListVertexBuffer = aModel.Octaeder.ColoredTriangleList.ToVertexPositionColor().ToVertexBuffer(this.GraphicsDevice); this.OctaederLineListVertexBuffer = aModel.Octaeder.LineList.ToVector3s().ToVertexPositionColor(Color.White).ToVertexBuffer(this.GraphicsDevice); }
internal CShotsSoundDirectory(CServiceLocatorNode aParent) : base(aParent) { this.OpenDirectory(); this.World.ShootFired += delegate() { this.PlayRandomSound(); }; }
internal CMonoShotModel(CServiceLocatorNode aParent) : base(aParent) { this.TriangleStripsVertexBuffer = this.Models.ShotModel.Sphere.TriangleStrips.ToVector3s().ToVertexPositionColor(Color.White).ToVertexBuffer(this.GraphicsDevice); this.BlendState = new BlendState { ColorSourceBlend = Blend.BlendFactor }; }
internal CBumperModel(CServiceLocatorNode aParent) : base(aParent) { this.Sphere = new CSphere(4, 1.0f, true); var aLen = this.World.SphereScaleCount; // 33; this.Spheres = (from aIdx in Enumerable.Range(0, aLen) select new CSphere(aIdx + 1, 1.0d, true)).ToArray(); this.Circles = new CCircles(3, 100); }
internal CSun(CServiceLocatorNode aParent) : base(aParent) { this.DestroyedSound = CSoundDirectoryEnum.Audio_Destroyed_Sun; this.AsteroidRadiusMax = this.World.SunRadiusMax; this.CategoryName = "Sun"; this.Init(); }
internal CMonoGemSlotControlsSprite(CServiceLocatorNode aParent) : base(aParent) { this.MonoModel = this.MonoModels.MonoGemSlotControlsModel; this.RasterizerStateNoCull = new RasterizerState(); this.RasterizerStateNoCull.CullMode = CullMode.None; this.BlendState = new BlendState(); this.BlendState.ColorSourceBlend = Blend.BlendFactor; }
internal CGame(CServiceLocatorNode aParent) { this.Parent = aParent; this.GraphicsDeviceManager = new GraphicsDeviceManager(this); this.Window.AllowUserResizing = true; this.Content.RootDirectory = "Content\\bin"; this.OriginValue = CValue.GetStaticValue <CBoolValue>(this.ServiceLocatorNode, OriginValueDeclaration); }
internal CCrosshairModel(CServiceLocatorNode aParent) : base(aParent) { this.Top = new CVector3Dbl(0, -0.5, 0); this.Bottom = new CVector3Dbl(0, 0.5, 0); this.Left = new CVector3Dbl(-0.5d, 0, 0); this.Right = new CVector3Dbl(+0.5, 0, 0); this.LineList = new CVector3Dbl[] { this.Top, this.Bottom, this.Left, this.Right }; }
internal CCollisionSoundDirectory(CServiceLocatorNode aParent) : base(aParent) { this.OpenDirectory(); if (this.HitPointEngineIsDefined) { this.HitPointEngine.Load(); } }
internal CGemActivateSoundDirectory(CServiceLocatorNode aParent) : base(aParent) { this.AddDirectory(CSoundDirectoryEnum.Audio_GemActivate); this.World.GemActivated += delegate(CCollectedGemSprite aGemSprite) { this.PlayRandomSound(); }; }
internal CValueSpriteManager(CServiceLocatorNode aParent) : base(aParent) { this.SeconaryWeaponValueEnums = typeof(CValueEnum).GetEnumValues().Cast <CValueEnum>() .Where(e => e.GetCustomAttributeIsDefined <CSecondaryWeaponValueAttribute>()) .Where(e => e.GetCustomAttribute <CSecondaryWeaponValueAttribute>().IsSeconaryWeaponValue) .ToArray() ; this.Init(); }
internal CAsteroid(CServiceLocatorNode aParent) : base(aParent) { this.PlaysFlybySound = true; this.MassIsDefined = true; this.DestroyedSound = Sfx.CSoundDirectoryEnum.Audio_Destroyed_Moon; this.AsteroidRadiusMax = this.World.DefaultAsteroidRadiusMax; this.CategoryName = "Asteroid"; this.Init(); }
internal CSoundFile(CServiceLocatorNode aParent, FileInfo aFileInfo) : base(aParent) { this.SoundBufferLoader = this.ServiceContainer.GetService <CSoundLoader>(); this.FileInfo = aFileInfo; if (this.XmlFileInfo.Exists) { this.ReadXml(); } this.SoundBuffer = this.SoundBufferLoader.LoadSoundBuffer(this.FileInfo); }
internal CModels(CServiceLocatorNode aParent) : base(aParent) { this.AsteroidModel = new CBumperModel(this); this.GridLinesModel = new CGridLinesModel(this); this.ShotModel = new CShotModel(this); this.CrosshairModel = new CCrosshairModel(this); this.ExplosionModel = new CExplosionModel(this); this.GemModel = new CGemModel(this); this.GemControlsModel = new CGemControlsModel(this); }
internal static CPropability <TEnum> NewFromEnum <TEnum>(CServiceLocatorNode aParent, TEnum[] aEnums) where TEnum : Enum { var aAttributes = aEnums .Where(e => e.GetCustomAttributeIsDefined <CPropabilityAttribute>()) .Select(e => new Tuple <TEnum, CPropabilityAttribute>(e, e.GetCustomAttribute <CPropabilityAttribute>())); var aWeights = (from aAttribute in aAttributes select new Tuple <double, TEnum>(aAttribute.Item2.Weight, aAttribute.Item1)).ToArray(); var aPropability = new CPropability <TEnum>(aParent, aWeights); return(aPropability); }
public CFacade(CServiceLocatorNode aParent) : base(aParent) { this.ValueObjectRegistry = new CValueObjectRegistry(this); this.GemCategories = new CGemCategories(this); this.World = new CWorld(this); this.LookUp.Load(); this.LookDown.Load(); this.LookLeft.Load(); this.LookRight.Load(); }
internal static CPropability <TEnum> NewFromEnum <TEnum>(CServiceLocatorNode aParent) where TEnum : Enum { var aEnums = typeof(T).GetEnumValues().Cast <TEnum>().ToArray(); var aPropability = NewFromEnum <TEnum>(aParent, aEnums); return(aPropability); //var aAttributes = typeof(T).GetEnumAttributes<T, CPropabilityAttribute>(); //var aWeights = (from aAttribute in aAttributes select new Tuple<double, T>(aAttribute.Item2.Weight, aAttribute.Item1)).ToArray(); //var aPropability = new CPropability<T>(aParent, aWeights); //return aPropability; }
internal CAvatarSprite(CServiceLocatorNode aParent) : base(aParent) { this.ValueObjectIsDefined = true; this.PlattformSpriteEnum = CPlatformSpriteEnum.Avatar; this.SetCollisionIsEnabled(CCollisionSourceEnum.Gem, true); this.BuildIsDone = true; this.Radius = 0.01; this.AvatarValues = new CAvatarValues(this); this.Init(); }
internal CGemSpriteManager(CServiceLocatorNode aParent) : base(aParent) { this.AddOnAllocate = true; this.RandomGenerator = new CRandomGenerator(this); this.RandomGenerator.Begin(); this.GemPropability = CGemPropability.NewFromEnum <CGemEnum>(this); this.CategoryToPropabilityMap = this.NewCategoryToPropabilityMap(); this.World.SpriteDestroyedByShot += this.OnSpriteDestroyedByShot; this.Init(); }
internal CGemCollectedSoundDirectory(CServiceLocatorNode aParent) : base(aParent) { this.AddDirectory(CSoundDirectoryEnum.Audio_GemCollected); this.World.GemCollected += delegate(CCollectedGemSprite aGemSprite) { var aSound = this.GetRandomSoundFile(); aSound.SoundBuffer.Play(); this.World.OnGemCollectedSoundStarting(aGemSprite, this.SoundSequence.Add); }; this.Init(); }
internal CSoundManager(CServiceLocatorNode aParent) : base(aParent) { this.CollisionSoundDirectory = new CCollisionSoundDirectory(this); this.AmbientSoundDirectory = new CAmbientSoundDirectory(this); this.ShotsSoundDirectory = new CShotsSoundDirectory(this); this.EventSoundDirectory = new CDestroyedSoundDirectory(this); this.FlybySoundDirectory = new CFlybySoundDirectory(this); this.WormholeSoundDirectory = new CWormholeSoundDirectory(this); this.GemCollectedSoundDirectory = new CGemCollectedSoundDirectory(this); this.GemSpeechSoundDirectory = new CGemSpeechSoundDirectory(this); this.GemActivateSoundDirectory = new CGemActivateSoundDirectory(this); }
internal CMultiPoolSpriteManager(CServiceLocatorNode aParent) : base(aParent) { this.MultiSpritePool = new CMultiSpritePool(this); this.MultiSpritePool.Allocated += delegate(CReuseable aReusable) { this.OnAllocated((TSprite)aReusable); }; this.MultiSpritePool.Deallocated += delegate(CReuseable aReusable) { this.OnDeallocated((TSprite)aReusable); }; }
internal CWorldSpriteManagers(CServiceLocatorNode aParent) : base(aParent) { this.AvatarManager = new CAvatarManager(this); this.ShotManager = new CShotManager(this); this.CrosshairManager = new CCrosshairManager(this); this.ExplosionsManager = new CExplosionsManager(this); this.SolarSystemSpriteManagers = this.Cube.Quadrants.Select(aQ => aQ.ServiceContainer.GetService <CQuadrantSpriteManager>()).ToArray(); this.GemSpriteManager = new CGemSpriteManager(this); this.GemSlotControlsSpriteManager = new CGemSlotControlsSpriteManager(this); this.Items = this.ItemsPr.ToArray(); this.Init(); }