Beispiel #1
0
 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;
 }
Beispiel #2
0
        internal CGridLinesSprite(CServiceLocatorNode aParent) : base(aParent)
        {
            this.QuadrantValue       = CValue.GetStaticValue <CBoolValue>(this.World, QuadrantValueDeclaration);
            this.PlattformSpriteEnum = CPlatformSpriteEnum.GridLines;

            this.Init();
        }
Beispiel #3
0
        internal CPlanet(CServiceLocatorNode aParent) : base(aParent)
        {
            this.DestroyedSound = CSoundDirectoryEnum.Audio_Destroyed_Planet;
            this.CategoryName   = "Planet";

            this.Init();
        }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 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;
 }
Beispiel #6
0
        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));
        }
Beispiel #7
0
        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()
            ;
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
 internal CShotsSoundDirectory(CServiceLocatorNode aParent) : base(aParent)
 {
     this.OpenDirectory();
     this.World.ShootFired += delegate()
     {
         this.PlayRandomSound();
     };
 }
Beispiel #10
0
 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
     };
 }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        internal CSun(CServiceLocatorNode aParent) : base(aParent)
        {
            this.DestroyedSound    = CSoundDirectoryEnum.Audio_Destroyed_Sun;
            this.AsteroidRadiusMax = this.World.SunRadiusMax;
            this.CategoryName      = "Sun";

            this.Init();
        }
Beispiel #13
0
 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;
 }
Beispiel #14
0
 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);
 }
Beispiel #15
0
 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 };
 }
Beispiel #16
0
        internal CCollisionSoundDirectory(CServiceLocatorNode aParent)  : base(aParent)
        {
            this.OpenDirectory();

            if (this.HitPointEngineIsDefined)
            {
                this.HitPointEngine.Load();
            }
        }
Beispiel #17
0
        internal CGemActivateSoundDirectory(CServiceLocatorNode aParent) : base(aParent)
        {
            this.AddDirectory(CSoundDirectoryEnum.Audio_GemActivate);

            this.World.GemActivated += delegate(CCollectedGemSprite aGemSprite)
            {
                this.PlayRandomSound();
            };
        }
Beispiel #18
0
 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();
 }
Beispiel #19
0
        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();
        }
Beispiel #20
0
 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);
 }
Beispiel #21
0
 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);
 }
Beispiel #22
0
        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);
        }
Beispiel #23
0
 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();
 }
Beispiel #24
0
        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;
        }
Beispiel #25
0
        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();
        }
Beispiel #26
0
        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();
        }
Beispiel #27
0
        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();
        }
Beispiel #28
0
 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);
 }
Beispiel #29
0
 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);
     };
 }
Beispiel #30
0
        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();
        }