当前位置: 首页>>代码示例>>C#>>正文


C# ParticleSystem.Init方法代码示例

本文整理汇总了C#中ParticleSystem.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleSystem.Init方法的具体用法?C# ParticleSystem.Init怎么用?C# ParticleSystem.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleSystem的用法示例。


在下文中一共展示了ParticleSystem.Init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init()
        {
            system = new ParticleSystem(6);

            system.Position = new Point(300, 190);

            switch (Color) {
                case Color.Red:
                    system.StartColor = new int[] {163, 0, 0, 1};
                    system.EndColor = new int[] {220, 0, 0, 1};
                    break;
                case Color.Blue:
                    system.StartColor = new int[] {0, 0, 255, 1};
                    system.EndColor = new int[] {0, 0, 173, 1};
                    break;
                case Color.Green:
                    system.StartColor = new int[] {53, 244, 73, 1};
                    system.EndColor = new int[] {23, 104, 31, 1};
                    break;
                case Color.Yellow:
                    system.StartColor = new int[] {255, 212, 0, 1};
                    system.EndColor = new int[] {145, 121, 0, 1};
                    break;
            }
            system.Size = 30;
            system.SizeRandom = 2;
            system.MaxParticles = 30;
            system.LifeSpan = 5;
            system.Speed = 1;
            system.Gravity = new DoublePoint(0, 0);

            system.Init();

            curSpeed = system.Speed;
        }
开发者ID:dested,项目名称:LampLightOnlineSharp,代码行数:35,代码来源:QuickShooterDrawer.cs

示例2: Init

        public void Init()
        {
            system = new ParticleSystem(5);

            system.Position = new Point(300, 190);
            system.StartColor = new int[] {255, 0, 0, 1};
            system.EndColor = new int[] {127, 55, 0, 1};
            system.Size = 20;
            system.MaxParticles = 25;
            system.LifeSpan = 25;

            system.Init();
        }
开发者ID:dested,项目名称:LampLightOnlineSharp,代码行数:13,代码来源:GunWeaponDrawer.cs

示例3: AddProjectile

        public void AddProjectile(int x, int y)
        {
            var proj = new ParticleSystem(6);

            proj.Position = system.Position.Clone();
            proj.StartColor = new int[] {127, 0, 0, 1};
            proj.EndColor = new int[] {127, 55, 0, 1};
            proj.Size = 15;
            proj.MaxParticles = 25;
            proj.LifeSpan = 25;
            double angle = Math.Atan2(-y - proj.Position.Y, -x - proj.Position.X) / Math.PI * 180 + 180;

            proj.Angle = (int) ( angle );
            proj.AngleRandom = 10;
            proj.MaxEmitted = 10;
            proj.Speed = 10;
            proj.Gravity = new DoublePoint(0, 0);
            proj.Init();

            projectiles.Add(proj);
        }
开发者ID:dested,项目名称:LampLightOnlineSharp,代码行数:21,代码来源:GunWeaponDrawer.cs

示例4: Init

        public void Init()
        {
            systems = new List<ParticleSystem>();

            var items = new List<Point>(Map.Travel(50, myScale, false));

            for (int index = 0; index < items.Count; index++) {
                var point = items[index];
                var system = new ParticleSystem(3);

                int[] StartColors = null;
                int[] EndColors = null;
                int[] StartColors2 = null;
                int[] EndColors2 = null;

                switch (StartColor) {
                    case Color.Red:
                        StartColors = new int[] {163, 0, 0, 1};
                        EndColors = new int[] {220, 0, 0, 1};
                        break;
                    case Color.Blue:
                        StartColors = new int[] {0, 0, 255, 1};
                        EndColors = new int[] {0, 0, 173, 1};
                        break;
                    case Color.Green:
                        StartColors = new int[] {53, 244, 73, 1};
                        EndColors = new int[] {23, 104, 31, 1};
                        break;
                    case Color.Yellow:
                        StartColors = new int[] {255, 212, 0, 1};
                        EndColors = new int[] {145, 121, 0, 1};
                        break;
                }

                switch (EndColor) {
                    case Color.Red:
                        StartColors2 = new int[] {163, 0, 0, 1};
                        EndColors2 = new int[] {220, 0, 0, 1};
                        break;
                    case Color.Blue:
                        StartColors2 = new int[] {0, 0, 255, 1};
                        EndColors2 = new int[] {0, 0, 173, 1};
                        break;
                    case Color.Green:
                        StartColors2 = new int[] {53, 244, 73, 1};
                        EndColors2 = new int[] {23, 104, 31, 1};
                        break;
                    case Color.Yellow:
                        StartColors2 = new int[] {255, 212, 0, 1};
                        EndColors2 = new int[] {145, 121, 0, 1};
                        break;
                }

                StartColors[0] = (int) ( StartColors[0] + ( StartColors2[0] - StartColors[0] ) * ( (double) index / items.Count ) );
                StartColors[1] = (int) ( StartColors[1] + ( StartColors2[1] - StartColors[1] ) * ( (double) index / items.Count ) );
                StartColors[2] = (int) ( StartColors[2] + ( StartColors2[2] - StartColors[2] ) * ( (double) index / items.Count ) );
                StartColors[3] = (int) ( StartColors[3] + ( StartColors2[3] - StartColors[3] ) * ( (double) index / items.Count ) );

                EndColors[0] = (int) ( EndColors[0] + ( EndColors2[0] - EndColors[0] ) * ( (double) index / items.Count ) );
                EndColors[1] = (int) ( EndColors[1] + ( EndColors2[1] - EndColors[1] ) * ( (double) index / items.Count ) );
                EndColors[2] = (int) ( EndColors[2] + ( EndColors2[2] - EndColors[2] ) * ( (double) index / items.Count ) );
                EndColors[3] = (int) ( EndColors[3] + ( EndColors2[3] - EndColors[3] ) * ( (double) index / items.Count ) );

                system.StartColor = StartColors;
                system.EndColor = EndColors;

                system.Size = 9;
                system.MaxParticles = 4;
                system.LifeSpan = 11;
                system.LifeSpanRandom = 2;
                system.Speed = 1;
                system.Gravity = new DoublePoint(0, 0);
                system.Position = point;
                system.Init();
                systems.Add(system);
            }
        }
开发者ID:dested,项目名称:LampLightOnlineSharp,代码行数:77,代码来源:ColorWaypointDrawer.cs


注:本文中的ParticleSystem.Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。