Example #1
0
        /// <summary>
        /// This method will convert the particle into a certain particle type.
        /// </summary>
        /// <param name="type">The type of particle to convert to</param>
        /// <param name="pX">The X-component of the position</param>
        /// <param name="pY">The Y-component of the position.</param>
        /// <param name="vX">The X-component of the velocity</param>
        /// <param name="vY">The Y-component of the velocity</param>
        /// <param name="aX">The X-component of the acceleration</param>
        /// <param name="aY">The Y-component of the acceleration</param>
        /// <param name="radius">The radius of the particle</param>
        public void convertParticle(ParticleType type, float pX, float pY, float vX, float vY, float aX, float aY, float radius)
        {
            this.type = type;
            Particle part = new Particle();
            switch (type)
            {
                case ParticleType.firework:
                    pX = RandomNumber(0, 50);
                    pY = RandomNumber(0, 25);
                    vX = RandomNumber(0, 100);
                    vY = RandomNumber(0, 75);
                    aX = 0;
                    aY = 10;
                    radius = RandomNumber(0, 35);
                    part.convertParticle(type, pX, pY, vX, vY, aX, aY, radius);

                    position.X = pX;
                    position.Y = pY;
                    velocity.X = vX;
                    velocity.Y = vY;
                    acceleration.X = aX;
                    acceleration.Y = aY;
                    this.radius = radius;
                    sphere.Center.X = pX;
                    sphere.Center.Y = pY;
                    sphere.Radius = radius;
                    break;
                default:
                    break;
            }
        }
        public static ParticleEffect getParticleEffect(ParticleType particleType)
        {
            switch (particleType)
            {
            case ParticleType.None:
                return(null);

            case ParticleType.Waterfall:
                return(waterfall.DeepCopy());

            case ParticleType.Rain:
                return(rain.DeepCopy());

            case ParticleType.HeavyRain:
                return(heavyrain.DeepCopy());

            case ParticleType.Smoke:
                return(smoke.DeepCopy());

            case ParticleType.Bokeh:
                return(bokeh.DeepCopy());

            case ParticleType.FireFlies:
                return(fireflies.DeepCopy());

            case ParticleType.Clouds:
                return(clouds.DeepCopy());
            }

            return(null);
        }
Example #3
0
        public bool Equals(ParticleObject other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Position.Equals(other.Position) &&
                   NextParticleObjectPointer.Equals(other.NextParticleObjectPointer) &&
                   PrevParticleObjectPointer.Equals(other.PrevParticleObjectPointer) &&
                   ParticlePointer.Equals(other.ParticlePointer) &&
                   Timer.Equals(other.Timer) &&
                   Type.Equals(other.Type) &&
                   ParticleType.Equals(other.ParticleType) &&
                   NumEffectCycles.Equals(other.NumEffectCycles) &&
                   SkipFrames.Equals(other.SkipFrames) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   State.Equals(other.State) &&
                   Target.Equals(other.Target) &&
                   Spread.Equals(other.Spread) &&
                   Size.Equals(other.Size) &&
                   Color.Equals(other.Color) &&
                   DestroyWhenFar.Equals(other.DestroyWhenFar) &&
                   CreationChance.Equals(other.CreationChance) &&
                   Unknown.Equals(other.Unknown));
        }
Example #4
0
        private static int onPlayerDashUpdate(On.Celeste.Player.orig_DashUpdate orig, Player self)
        {
            if (P_DashA == null && P_DashB == null)
            {
                // skin disabled: just run vanilla code
                return(orig(self));
            }

            // back up vanilla particles
            ParticleType bakDashA    = Player.P_DashA;
            ParticleType bakDashB    = Player.P_DashB;
            ParticleType bakDashBadB = Player.P_DashBadB;

            // replace them with our recolored ones
            Player.P_DashA    = P_DashA;
            Player.P_DashB    = P_DashB;
            Player.P_DashBadB = P_DashB;

            // run vanilla code: if it emits particles, it will use our recolored ones.
            int result = orig(self);

            // restore vanilla particles
            Player.P_DashA    = bakDashA;
            Player.P_DashB    = bakDashB;
            Player.P_DashBadB = bakDashBadB;

            return(result);
        }
Example #5
0
        /** owner - ссылается на объект, кто создавал эмитер. Если указан, эмитер следует за ним*/

        public static CCParticleSystem GetEmiter(string texture, ParticleType type, int dieAfter, CCPoint where,
            Entity owner = null) {
            CCPoint pos;
            if (owner != null)
                pos = new CCPoint(owner.Texture.PixelsWide/2, owner.Texture.PixelsHigh/2);
            else
                pos = where;


            CCParticleSystem emiter = new CCParticleMeteor(pos);

            switch (type) {
                case ParticleType.ProjectileTrail:
                    emiter = new CCParticleMeteor(pos) {
                        Scale = 0.1f,
                        SpeedVar = 250,
                        Texture = CCTextureCache.SharedTextureCache.AddImage(texture)
                    };
                    if (owner != null)
                        emiter.Gravity = Entity.GetNormalPointByDirection(owner.Direction)*-2000;

                    break;
                case ParticleType.LevelUp:
                    emiter = new CCParticleSun(pos) {
                        Scale = 0.1f,
                        SpeedVar = 150,
                        Texture = CCTextureCache.SharedTextureCache.AddImage(texture)
                    };
                    break;
            }

            emiter.ScheduleOnce((float x) => emiter.RemoveFromParent(), dieAfter);

            return emiter;
        }
        public ParticleSystem SpawnEffect(BuildingType buildingType, ParticleType particleType)
        {
            var particleSystemObj = cloud.ParticleSystems[0];
            var company           = cloud.Companies[0];

            var targetPosition =
                company.GetOffice(buildingType).transform.position + Vector3.up * 30;

            var particleSystem = GameObject.Instantiate(particleSystemObj, targetPosition, Quaternion.identity).GetComponent <ParticleSystem>();

            var particleSystemRenderer = particleSystem.GetComponent <ParticleSystemRenderer>();

            switch (particleType)
            {
            case ParticleType.CASH:
                particleSystemRenderer.material = cloud.ParticleMaterials[0];
                break;

            case ParticleType.PROJECT:
                particleSystemRenderer.material = cloud.ParticleMaterials[1];
                break;

            default:
                break;
            }
            particleSystem.Play();

            return(particleSystem);
        }
        public ReskinnableStarRotateSpinner(EntityData data, Vector2 offset) : base(data, offset)
        {
            string[] particleColorsAsStrings = data.Attr("particleColors", "EA64B7|3EE852,67DFEA|E85351,EA582C|33BDE8").Split(',');
            trailParticles = new ParticleType[particleColorsAsStrings.Length];
            for (int i = 0; i < particleColorsAsStrings.Length; i++)
            {
                string[] colors = particleColorsAsStrings[i].Split('|');
                trailParticles[i] = new ParticleType(StarTrackSpinner.P_Trail[0])
                {
                    Color  = Calc.HexToColor(colors[0]),
                    Color2 = Calc.HexToColor(colors[1])
                };
            }

            colorID = Calc.Random.Next(0, particleColorsAsStrings.Length);

            Add(sprite = new Sprite(GFX.Game, data.Attr("spriteFolder", "danger/MaxHelpingHand/starSpinner") + "/"));
            for (int i = 0; i < particleColorsAsStrings.Length; i++)
            {
                sprite.AddLoop($"idle{i}", $"idle{i}_", 0.08f);
                sprite.Add($"spin{i}", $"spin{i}_", 0.06f, $"idle{(i + 1) % particleColorsAsStrings.Length}");
            }
            sprite.CenterOrigin();
            sprite.Play($"idle{colorID}");

            Depth = -50;
            Add(new MirrorReflection());
        }
Example #8
0
        /// <summary>
        /// Instantiate particle of type <see cref="ParticleType"/> at specified world position
        /// </summary>
        /// <param name="particleType"></param>
        /// <param name="worldPosition"></param>
        public void InstantiateParticle(ParticleType particleType, Vector3 worldPosition, bool roundToBlockPosition = false)
        {
            ParticleSystem particle = SpawnParticle(particleType, worldPosition, roundToBlockPosition);

            particle.Play();
            StartCoroutine(DestroyBlockParticleEnumerator(particleType, particle, particle.main.duration));
        }
Example #9
0
        public void SdbParticleConstraintTest()
        {
            const ParticleType ParticleType       = ParticleType.AnyWithUri;
            const ushort       ElementTypeId      = 18;
            const ushort       MinOccurs          = 2;
            const int          MaxOccurs          = 60;
            const ushort       ChildrenCount      = 80;
            const ushort       ChildrenStartIndex = 132;

            var instance = new SdbParticleConstraint(ParticleType, ElementTypeId, MinOccurs, MaxOccurs, ChildrenCount, ChildrenStartIndex);

            Assert.Equal(ParticleType, instance.ParticleType);
            Assert.Equal(ElementTypeId, instance.ElementTypeId);
            Assert.Equal(MinOccurs, instance.MinOccurs);
            Assert.Equal(MaxOccurs, instance.MaxOccurs);
            Assert.Equal(ChildrenCount, instance.ChildrenCount);
            Assert.Equal(ChildrenStartIndex, instance.ChildrenStartIndex);

            var bytes = VerifyBytes(instance, new byte[] { 0x06, 0x12, 0x00, 0x02, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x50, 0x00, 0x84, 0x00 });

            var deserialized = Assert.Single(Deserialize <SdbParticleConstraint>(bytes));

            Assert.Equal(ParticleType, deserialized.ParticleType);
            Assert.Equal(ElementTypeId, deserialized.ElementTypeId);
            Assert.Equal(MinOccurs, deserialized.MinOccurs);
            Assert.Equal(MaxOccurs, deserialized.MaxOccurs);
            Assert.Equal(ChildrenCount, deserialized.ChildrenCount);
            Assert.Equal(ChildrenStartIndex, deserialized.ChildrenStartIndex);

            Assert.Equal(instance, deserialized);
        }
Example #10
0
        /// <summary>
        /// Disable and add do pool particles after their lifetime
        /// </summary>
        private IEnumerator DestroyBlockParticleEnumerator(ParticleType type, ParticleSystem particle, float time)
        {
            yield return(new WaitForSecondsRealtime(time));

            particlesPool[type].Enqueue(particle);
            particle.gameObject.SetActive(false);
        }
 public ParticleState(Vector2 velocity, ParticleType type)
     : this()
 {
     Velocity = velocity;
     Type = type;
     LengthMultiplier = 1;
 }
Example #12
0
        public void StartEffect(BuildingType buildingType, ParticleType particleType)
        {
            var position = particleSystem.gameObject.transform.position;

            position = Vector3.zero;

            position =
                company.GetOffice(buildingType).transform.position + Vector3.up * 30;
            particleSystem.gameObject.transform.position = position;

            switch (particleType)
            {
            case ParticleType.CASH:
                particleSystemRenderer.material = cashMaterial;
                break;

            case ParticleType.PROJECT:
                particleSystemRenderer.material = projectMaterial;
                break;

            default:
                break;
            }
            particleSystem.Play();
        }
Example #13
0
    public void InstantiateParticleWithRotation(Vector3 position, ParticleType type, float destroyTime = 5f, Color color = new Color(), bool moveRight = true)
    {
        int        intType  = (int)type;
        GameObject particle = Instantiate(VFX[intType], position, Quaternion.identity);

        Vector3 lookPos = player.transform.position;

        lookPos = lookPos - position;
        float angle = Mathf.Atan2(lookPos.y, lookPos.x) * Mathf.Rad2Deg;

        particle.transform.rotation = Quaternion.AngleAxis(angle - 45, Vector3.forward);
        if (moveRight)
        {
            particle.transform.position += particle.transform.right;
        }
        ParticleSystem ps = particle.GetComponent <ParticleSystem>();

        if (color != null)
        {
            var main = ps.main;
            main.startColor = color;
        }
        particle.GetComponent <ParticleSystem>().Play();

        Destroy(particle, destroyTime);
    }
Example #14
0
    public void applyNucleonData(GameObject obj, ParticleType particletype)
    {
        if (obj.GetComponent <NucleonMotion>() == null)
        {
            return;
        }
        if (particles.Contains(obj))
        {
            particles.Remove(obj);
        }
        if (obj.GetComponent <NucleonMotion>().ParentNode != null && obj.GetComponent <NucleonMotion>().ParentNode != this && obj.GetComponent <NucleonMotion>().ParentNode.particles.Contains(obj))
        {
            obj.GetComponent <NucleonMotion>().ParentNode.particles.Remove(obj);
        }

        var nucleonMotion = obj.GetComponent <NucleonMotion>();

        nucleonMotion.MassCenter   = Vector3.zero;
        nucleonMotion.MotionType   = MotionType.Point;
        nucleonMotion.ParticleType = particletype;
        nucleonMotion.changeType(nucleonMotion.ParticleType);
        nucleonMotion.ParentNode = this;

        obj.transform.SetParent(transform);
        nucleonMotion.Speed = 2f;
        obj.GetComponent <Rigidbody>().drag = SpherePrefab.GetComponent <Rigidbody>().drag;

        particles.Add(obj);
    }
 public static void SpawnParticle(Vector3 position, ParticleType type, Vector3 velocity, float velocityJitter = 6f, int count = 1)
 {
     for (int i = 0; i < count; i++)
     {
         instance._SpawnParticle(position, type, velocity, velocityJitter);
     }
 }
    public ParticleSystem GetParticleSystem(ParticleType _type)
    {
        switch (_type)
        {
        case ParticleType.ON_HIT:
            if (particleOnHit != null)
            {
                return(particleOnHit);
            }
            else
            {
                return(null);
            }

        case ParticleType.ON_USE:
            if (particleOnUse != null)
            {
                return(particleOnUse);
            }
            else
            {
                return(null);
            }

        default:
            return(null);
        }
    }
Example #17
0
 /// <summary>
 /// Creates a particle state
 /// </summary>
 /// <param name="velocity">Velocity of the particle</param>
 /// <param name="type">Type of the particle</param>
 /// <param name="lengthMultiplier">Length multiplier of the particle</param>
 public ParticleState(Vector2 velocity, ParticleType type, float lengthMultiplier = 1f)
 {
     // Set the velocity, type, and length multiplier of the particle
     Velocity         = velocity;
     Type             = type;
     LengthMultiplier = lengthMultiplier;
 }
Example #18
0
        public CustomDreamBlock(Vector2 position, int width, int height, bool featherMode, bool oneUse, int refillCount, bool below, bool quickDestroy)
            : base(position, width, height, null, false, oneUse, below)
        {
            baseData     = new DynData <DreamBlock>(this);
            QuickDestroy = quickDestroy;
            RefillCount  = refillCount;

            FeatherMode = featherMode;
            //if (altLineColor) { Dropped in favour of symbol
            //    activeLineColor = Calc.HexToColor("FF66D9");
            //}
            shakeParticle = new ParticleType(SwitchGate.P_Behind)
            {
                Color          = ActiveLineColor,
                ColorMode      = ParticleType.ColorModes.Static,
                Acceleration   = Vector2.Zero,
                DirectionRange = (float)Math.PI / 2
            };

            featherTextures = new MTexture[] {
                GFX.Game["particles/CommunalHelper/featherBig"],
                GFX.Game["particles/CommunalHelper/featherMedium"],
                GFX.Game["particles/CommunalHelper/featherSmall"]
            };

            doubleRefillStarTextures = new MTexture[4] {
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(14, 0, 7, 7),
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(7, 0, 7, 7),
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(0, 0, 7, 7),
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(7, 0, 7, 7)
            };
        }
    public ParticleSystem getParticle(ParticleType particleType)
    {
        for (int poolIdx = 0; poolIdx < particlePools.Length; poolIdx++)
        {
            if (particlePools[poolIdx].particleType == particleType)
            {
                for (int idx = 0; idx < particlePools[poolIdx].particlePoolSize; idx++)
                {
                    if (!particlePools[poolIdx].particlePool[idx].isPlaying)
                    {
                        return(particlePools[poolIdx].particlePool[idx]);
                    }
                }

                ParticlePool   particlePool = particlePools[poolIdx];
                ParticleSystem particle     = Instantiate(particlePool.particle, particlePool.parent).GetComponent <ParticleSystem>();
                particle.Stop();

                Destroy(particle.gameObject, 10.0f);

                return(particle);
            }
        }

        return(null);
    }
    /// <summary>
    /// return the addon mass to be used to generate the star
    /// </summary>
    /// <param name="t"></param>
    /// <returns></returns>
    public static float GetMass(this ParticleType t)
    {
        switch (t)
        {
        case ParticleType.Fire:
            return(0.4f);

        case ParticleType.Water:
            return(0.25f);

        case ParticleType.Air:
            return(0.2f);

        case ParticleType.Earth:
            return(0.5f);

        case ParticleType.Light:
            return(0.3f);

        case ParticleType.Darkness:
            return(0.3f);

        case ParticleType.Energy:
            return(0.2f);

        case ParticleType.Metal:
            return(0.5f);

        default:
            return(0.1f);
        }
    }
    static Color white     = new Color(0.90196f, 0.83922f, 0.56471f); // Color.white

    /// <summary>
    /// return the color associated to the particle
    /// </summary>
    /// <param name="t"></param>
    /// <returns></returns>
    public static Color GetColor(this ParticleType t)
    {
        switch (t)
        {
        case ParticleType.Fire:
            return(red);

        case ParticleType.Water:
            return(lightblue);

        case ParticleType.Earth:
            return(orange);

        case ParticleType.Air:
            return(green);

        case ParticleType.Light:
            return(yellow);

        case ParticleType.Darkness:
            return(violet);

        case ParticleType.Energy:
            return(white);

        case ParticleType.Metal:
            return(pink);

        default:
            return(Color.clear);
        }
    }
 /// <summary>
 /// Initializes a new instance of the ParticleConstraint.
 /// </summary>
 protected ParticleConstraint(ParticleType type, int minOccurs, int maxOccurs, FileFormatVersions version)
 {
     ParticleType = type;
     MinOccurs    = minOccurs;
     MaxOccurs    = maxOccurs;
     Version      = version;
 }
Example #23
0
        public override void Added(Scene scene)
        {
            base.Added(scene);
            string iconTexture = "arrow";

            startColor = DefaultColor;

            if (DeleteBlock)
            {
                iconTexture = "x";
                startColor  = DeleteColor;
            }
            else
            {
                if ((Operation == Operations.Add && Modifier != 0f) || (Operation == Operations.Multiply && Modifier > 1f))
                {
                    iconTexture = "fast";
                    startColor  = FasterColor;
                }
                else if ((Operation == Operations.Subtract && Modifier != 0f) || (Operation == Operations.Multiply && Modifier < 1f))
                {
                    iconTexture = "slow";
                    startColor  = SlowerColor;
                }
            }
            scene.Add(icon = new Icon(Center, angle, iconTexture, reskinFolder));
            UpdateAppearance();
            p_Used = new ParticleType(SwitchGate.P_Behind)
            {
                Color          = icon.Sprite.Color,
                Color2         = Color.Lerp(icon.Sprite.Color, Color.White, .2f),
                DirectionRange = (float)Math.PI * 0.5f,
                SpeedMax       = 20f
            };
        }
Example #24
0
        private void OpenTextureSelectionDialog()
        {
            ParticleType pType = null;

            // check each particle types
            for (int i = 0; i < particleEffectControl.ParticleEffect.Emitter.ParticleTypes.Count; i++)
            {
                // check the index + 1 (index 0 is Global Settings)
                if (particleEffectProperties.SelectedNode == particleEffectProperties.Nodes[0].Nodes[0].Nodes[i + 1])
                {
                    pType = particleEffectControl.ParticleEffect.Emitter.ParticleTypes[i];
                }
            }
            // if the selected node was a particle type
            if (pType != null)
            {
                MaterialSelectorDialog materialSelectorDialog = new MaterialSelectorDialog();
                materialSelectorDialog.SelectedMaterial  = pType.Material;
                materialSelectorDialog.ShowLocalTextures = ItemIsLocal;
                if (materialSelectorDialog.ShowDialog() == DialogResult.OK)
                {
                    pType.Material = materialSelectorDialog.SelectedMaterial;
                }
            }
        }
        public override void Update()
        {
            Level level = base.Scene as Level;

            if (level.Frozen)
            {
                if (_burst != null)
                {
                    _burst.AlphaFrom = (_burst.AlphaTo = 0f);
                    _burst.Percent   = _burst.Duration;
                }
                return;
            }
            base.Update();
            Camera camera = level.Camera;

            base.Y      -= 8f * Engine.DeltaTime;
            base.X       = Calc.Clamp(base.X, camera.Left + 8f, camera.Right - 8f);
            base.Y       = Calc.Clamp(base.Y, camera.Top + 8f, camera.Bottom - 8f);
            _light.Alpha = Calc.Approach(_light.Alpha, 0f, Engine.DeltaTime * 4f);
            _bloom.Alpha = _light.Alpha;
            ParticleType particleType = _ghostberry ? RustBerry.P_GhostGlow : RustBerry.P_Glow;

            if (Scene.OnInterval(0.06f) && _sprite.CurrentAnimationFrame > 11)
            {
                level.ParticlesFG.Emit(particleType, 1, Position + Vector2.UnitY * -2f, new Vector2(8f, 4f));
            }
        }
Example #26
0
 public static void InitializeParticles()
 {
     P_Activate = new ParticleType(CrushBlock.P_Activate)
     {
         Color = Calc.HexToColor("e45f7c")
     };
 }
Example #27
0
        /// <summary>
        /// Spawnol egy téglát.
        /// </summary>
        ///


        public Brick CreateBrick(Point position, BrickType type, ParticleType particleType = ParticleType.DefaultBrick, byte hitsNeeded = 1)
        {
            Brick brick = new Brick(position.X, position.Y, type, particleType, hitsNeeded);

            this.EntityList.Add(brick);
            return(brick);
        }
Example #28
0
        private static void customizeParticles(On.Celeste.HeartGem.orig_Awake orig, HeartGem self, Scene scene)
        {
            orig(self, scene);

            if (!self.IsGhost && LobbyHelper.IsHeartSide(self.SceneAs <Level>().Session.Area.GetSID()))
            {
                // we are in a heartside: make the heart particles match the heart sprite.
                DynData <HeartGem> selfData = new DynData <HeartGem>(self);
                switch (selfData.Get <Sprite>("sprite").Texture.AtlasPath)
                {
                case "collectables/heartGem/1/00":
                    selfData["shineParticle"] = HeartGem.P_RedShine;
                    break;

                case "collectables/heartGem/2/00":
                    selfData["shineParticle"] = HeartGem.P_GoldShine;
                    break;

                case "CollabUtils2/crystalHeart/expert/00":
                    selfData["shineParticle"] = new ParticleType(HeartGem.P_BlueShine)
                    {
                        Color = Color.Orange
                    };
                    break;

                case "CollabUtils2/crystalHeart/grandmaster/00":
                    selfData["shineParticle"] = new ParticleType(HeartGem.P_BlueShine)
                    {
                        Color = Color.DarkViolet
                    };
                    break;
                }
            }
        }
Example #29
0
 public void CreateSparks(Vector2 position, ParticleType p)
 {
     SceneAs <Level>().ParticlesBG.Emit(p, position + sparkAdd + Calc.Random.Range(-Vector2.One, Vector2.One), sparkDirFromA);
     SceneAs <Level>().ParticlesBG.Emit(p, position - sparkAdd + Calc.Random.Range(-Vector2.One, Vector2.One), sparkDirFromB);
     SceneAs <Level>().ParticlesBG.Emit(p, position + sparkAdd + Calc.Random.Range(-Vector2.One, Vector2.One), sparkDirToA);
     SceneAs <Level>().ParticlesBG.Emit(p, position - sparkAdd + Calc.Random.Range(-Vector2.One, Vector2.One), sparkDirToB);
 }
Example #30
0
    public ParticleSystem GetFromPool(ParticleType g_type)
    {
        List <ParticleSystem> t_pool = myParticlePool [(int)g_type];

        foreach (ParticleSystem t_particle in t_pool)
        {
            if (t_particle.isStopped)
            {
                return(t_particle);
            }
        }

        Debug.Log("no particle available, creating a new one! " + g_type);

        //find the type
        ParticlePoolObject t_particlePoolObject = null;

        foreach (ParticlePoolObject t_object in myParticlePoolObjects)
        {
            if (t_object.GetMyType() == g_type)
            {
                t_particlePoolObject = t_object;
                break;
            }
        }

        if (t_particlePoolObject == null)
        {
            Debug.LogError("can not find the type: " + g_type);
            return(null);
        }

        return(CreateNewParticle(t_particlePoolObject));
    }
        public SeekerCustomColors(EntityData data, Vector2 offset) : base(data, offset)
        {
            if (basePAttack == null)
            {
                basePAttack    = P_Attack;
                basePHitWall   = P_HitWall;
                basePStomp     = P_Stomp;
                basePRegen     = P_Regen;
                baseTrailColor = TrailColor;
            }

            pAttack = new ParticleType(P_Attack)
            {
                Color  = Calc.HexToColor(data.Attr("attackParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("attackParticleColor2"))
            };
            pHitWall = new ParticleType(P_HitWall)
            {
                Color  = Calc.HexToColor(data.Attr("attackParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("attackParticleColor2"))
            };
            pStomp = new ParticleType(P_Stomp)
            {
                Color  = Calc.HexToColor(data.Attr("attackParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("attackParticleColor2"))
            };
            pRegen = new ParticleType(P_Regen)
            {
                Color  = Calc.HexToColor(data.Attr("regenParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("regenParticleColor2"))
            };
            trailColor = Calc.HexToColor(data.Attr("trailColor"));

            self = new DynData <Seeker>(this);
        }
Example #32
0
    public void SpawnParticle(ParticleType type, Vector3 position)
    {
        switch (type)
        {
        case ParticleType.BOOM:
        {
            Particle_Boom.transform.GetChild(boom_index).GetComponent <Particle>().Play(position);

            boom_index++;
            if (boom_index > Particle_Boom.childCount - 1)
            {
                boom_index = 0;
            }
            break;
        }

        case ParticleType.SMOKE:
        {
            Particle_Smoke.transform.GetChild(smoke_index).GetComponent <Particle>().Play(position);

            smoke_index++;
            if (smoke_index > Particle_Smoke.childCount - 1)
            {
                smoke_index = 0;
            }
            break;
        }
        }
    }
Example #33
0
    public void SpawnParticle(ParticleType type, Vector3 position, Color c)
    {
        switch (type)
        {
        case ParticleType.BOOM:
        {
            Particle_Boom.transform.GetChild(boom_index).GetComponent <Particle>().Play(position, c);

            boom_index++;
            if (boom_index > Particle_Boom.childCount - 1)
            {
                boom_index = 0;
            }
            break;
        }

        case ParticleType.ONLINEHITBASE:
        {
            Partilce_OnLineHitBase.transform.GetChild(onLineHitBase_index).GetComponent <Particle>().Play(position, c);

            onLineHitBase_index++;
            if (onLineHitBase_index > Partilce_OnLineHitBase.childCount - 1)
            {
                onLineHitBase_index = 0;
            }
            break;
        }
        }
    }
Example #34
0
 public Particle(Vector3 Position, Vector3 Velocity, Color3 Color, float LifeBar, ParticleType type)
 {
     this.Position = Position;
     this.Velocity = Velocity;
     this.Color = Color;
     this.LifeBar = LifeBar;
     this.ParticleType = type;
 }
Example #35
0
 public Particle(int x, int y, double xVel, double yVel, ParticleType type)
 {
     Point p = new Point(x, y);
     Vector v = new Vector(xVel, yVel);
     this.velocity = v;
     this.position = p;
     this.pType = type;
 }
Example #36
0
 public ParticleEffect(Texture2D texture, ParticleType pType, BlendState blend, Camera camera)
 {
     mCamera = camera;
     mParticles = new List<Particle>();
     particleTexture = texture;
     m_pType = pType;
     mBlendType = blend;
 }
 public void AddSpot(Vector2 location, ParticleType type)
 {
     SpotList[spotListIndex] = new ParticleSpot(location, type);
     spotListIndex++;
     if (spotListIndex>=255)
     {
         spotListIndex = 0;
     }
 }
Example #38
0
    private BaseParticleSys CreateAndStartParticles(ParticleType type)
    {
        BaseParticleSys part = particlesPool[type].TryGet();
        if (part == null){
            part = (BaseParticleSys) Instantiate(particlePrefabDict[type]);
        }
        part.gameObject.SetActive(true);

        return part;
    }
Example #39
0
 public void Draw(SpriteBatch sb, ParticleType type)
 {
     for (int i = 0; i < particles.Count; i++)
     {
         Particle p = particles[i];
         if (p.type == type)
         {
             sb.Draw(texture, p.position, sources[p.source], p.color * (1f - (p.current / p.duration)), p.rotation, p.origin, p.scale, SpriteEffects.None, 1f);
         }
     }
 }
 public void changeParticle(ParticleType particleNumber)
 {
     foreach (GameObject targetParticle in particleObjects)
     {
         targetParticle.SetActive(false);
     }
     if (particleNumber != ParticleType.PARTICLE_NONE)
     {
         particleObjects[(int)particleNumber].SetActive(true);
     }
 }
Example #41
0
    public void CreateParticlesAt(ParticleType type, Vector2 pos)
    {
        BaseParticleSys part = CreateAndStartParticles(type);

        if (part != null){
            part.transform.position = pos;
            part.transform.SetParent(systemContainer.transform);

            StartCoroutine(PlayCR(type, part));
        }
    }
Example #42
0
    public BaseParticleSys AttachParticlesTo(ParticleType type, Transform parent)
    {
        BaseParticleSys part = CreateAndStartParticles(type);

        if (part != null){
            part.transform.SetParent(parent);
            part.transform.localPosition = Vector2.zero;

            StartCoroutine(PlayCR(type, part));
        }
        return part;
    }
Example #43
0
        /// <summary>
        /// 粒子を作成する
        /// </summary>
        /// <param name="id">他の粒子と識別するための固有番号</param>
        /// <param name="d">直径</param>
        /// <param name="material">材質</param>
        /// <param name="type">粒子の種類</param>
        public Particle(ulong id, double d, Material material, ParticleType type)
        {
            // 各物性値を初期化
            this.X = new Vector();
            this.U = new Vector();
            this.A = new Vector();

            // 各パラメーターを設定
            this.ID = id;
            this.D = d;
            this.Material = material;
            this.Type = type;
        }
        public Particle(ParticleType type, Vector2 location)
        {
            this.location = location;

            if (type==ParticleType.fire)
            {
                texture = SpriteBank.particle_flame;
            }
            if (type==ParticleType.ice)
            {
                texture = SpriteBank.particle_ice;
            }

            velocity = new Vector2(Globs.rand.Next(-5, 5) / 15.0f, Globs.rand.Next(-5, 5) / 15.0f);
        }
        public Particle(float PositionX, float PositionY, float PositionZ, Color Color, float XForce, float YForce, float ZForce, ParticleType Type, int Lifetime, float StartingSize, float EndingSize)
        {
            posX = PositionX;
            posY = PositionY;
            posZ = PositionZ;
            color = Color;
            xForce = XForce;
            yForce = YForce;
            zForce = ZForce;
            type = Type;
            alpha = 255;
            lifeTime = Lifetime;
            startingLifetime = Lifetime;
            startingSize = StartingSize;
            endingSize = EndingSize;
            size = endingSize - ((lifeTime * 100 / startingLifetime) * (endingSize - startingSize * 1 / 100) / 100) + startingSize;

            sides = 9;
        }
Example #46
0
        public void createParticle(ParticleType type, Vector2 location, Vector2 offsets, float direction, float speed, float size, float growth, float alphablend, float dim, float life,
            byte r = 255, byte g = 255, byte b = 255)
        {
            switch(type){
                case ParticleType.Bubble:
                    bubblePool[bubblePoolIndex].set(location, offsets, direction, speed, size, growth, alphablend, dim, life, r, g, b);
                    if (++bubblePoolIndex >= BUBBLE_POOL_SIZE)
                        bubblePoolIndex = 0;
                    break;

                case ParticleType.HitSpark:
                    hitSparkPool[hitSparkPoolIndex].set(location, offsets, direction, speed, size, growth, alphablend, dim, life, r, g, b);
                    if (++hitSparkPoolIndex >= HITSPARK_POOL_SIZE)
                        hitSparkPoolIndex = 0;
                    break;
                default:
                    break;
            }
        }
Example #47
0
 public void Add(ParticleType type, Vector2 spawnPos, float landingHeight, Vector2 velocity, float life, bool affectedbygravity, Rectangle sourcerect, float rot, Color col)
 {
     foreach (Particle p in Particles)
         if (!p.Active)
         {
             p.Type = type;
             p.Position = spawnPos;
             p.LandingHeight = landingHeight;
             p.Velocity = velocity;
             p.Life = life;
             p.AffectedByGravity = affectedbygravity;
             p.SourceRect = sourcerect;
             p.Alpha = 1f;
             p.Active = true;
             //p.RotationSpeed = rot;
             p.Color = col;
             p.Rotation = rot;
             break;
         }
 }
 public void ToggleParticle(ParticleType pType)
 {
     FundamentalParticleBehaviour currentParticle = null;
     switch (pType)
     {
         case ParticleType.Nucleon:
             {
                 nucleon.enabled = !nucleon.enabled;
                 currentParticle = nucleon;
                 break;
             }
         case ParticleType.Quark:
             {
                 quark.enabled = !quark.enabled;
                 currentParticle = quark;
                 break;
             }
         case ParticleType.Lepton:
             {
                 lepton.enabled = !lepton.enabled;
                 currentParticle = lepton;
                 break;
             }
         case ParticleType.Higgs:
             {
                 higgs.enabled = !higgs.enabled;
                 currentParticle = higgs;
                 break;
             }
         case ParticleType.Photon:
             {
                 photon.enabled = !photon.enabled;
                 currentParticle = photon;
                 break;
             }
     }
     if (currentParticle!=null)
         audio.PlayOneShot(currentParticle.sound);
 }
Example #49
0
 public void Add(ParticleType type, Vector2 spawnPos, Vector2 speed, float life, bool affectedbygravity, Rectangle sourcerect, float rot, Color col, float zindex)
 {
     foreach (Particle p in Particles)
         if (!p.Active)
         {
             p.Type = type;
             p.Tex = (type == ParticleType.Cloud) ? _texClouds[Helper.Random.Next(10)] : _texParticles;
             p.Position = spawnPos;
             p.Speed = speed;
             p.Life = life;
             p.ZIndex = zindex;
             p.Scale = 0.5f+(0.3333f + (zindex / 3f));
             p.AffectedByGravity = affectedbygravity;
             p.SourceRect = (type == ParticleType.Cloud) ?new Rectangle(0,0,p.Tex.Width,p.Tex.Height):sourcerect;
             p.Alpha = 0.3333f + (zindex / 3f);
             p.Active = true;
             //p.RotationSpeed = rot;
             p.Color = col;
             p.Rotation = rot;
             break;
         }
 }
Example #50
0
 protected Particle(ParticleType particleType, Level level)
     : this((int) particleType, level)
 {
 }
Example #51
0
 public void CreateTileParticleEffect(Tile tile, Player.Player player)
 {
     CurrentParticle = ParticleType.TileParticle;
     Texture = tile.Texture;
     CollRectangle = new Rectangle(player.GetCollRectangle().Center.X - 2, player.GetCollRectangle().Y + player.GetCollRectangle().Height, 8, 8);
     SourceRectangle = new Rectangle(tile.SourceRectangle.X, tile.SourceRectangle.Y, 4, 4);
     SourceRectangle.X += (GameWorld.RandGen.Next(0, 4) * Main.Tilesize / 4);
     Velocity.X = (-player.GetVelocity().X / 2) * (float)GameWorld.RandGen.NextDouble();
     Velocity.Y = GameWorld.RandGen.Next(-1, 1);
     Opacity = 1;
 }
Example #52
0
 public void CreateTookDamage(Entity entity)
 {
     CurrentParticle = ParticleType.TookDamage;
     Texture = ContentHelper.LoadTexture("Sparkles");
     CollRectangle = new Rectangle(GameWorld.RandGen.Next(entity.GetCollRectangle().X, entity.GetCollRectangle().Right - 8), GameWorld.RandGen.Next(entity.GetCollRectangle().Y, entity.GetCollRectangle().Bottom - 8), 8, 8);
     SourceRectangle = new Rectangle(0, 0, 8, 8);
     Velocity.X = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-4, 5));
     Velocity.Y = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-1, 2));
     Position = new Vector2(CollRectangle.X, CollRectangle.Y);
     Opacity = 1;
     color = Color.Red;
 }
Example #53
0
 public void CreateWeaponBurstEffect(Player.Player player, Projectile proj, ContentManager content)
 {
     //position = player.weapon.tipPos;
     Velocity = new Vector2(0, 0);
     int maxTanSpeed = 10;
     Velocity.X = (float)(GameWorld.RandGen.Next((int)(proj.GetVelocity().X - maxTanSpeed), (int)(proj.GetVelocity().X + maxTanSpeed + 1)));
     Velocity.Y = (float)(GameWorld.RandGen.Next((int)(proj.GetVelocity().Y - maxTanSpeed), (int)(proj.GetVelocity().Y + maxTanSpeed + 1)));
     CurrentParticle = ParticleType.WeaponBurst;
     Texture = ContentHelper.LoadTexture("Effects/laser_burst");
     int randSize = GameWorld.RandGen.Next(2, 5);
     CollRectangle = new Rectangle((int)Position.X, (int)Position.Y, randSize, randSize);
     SourceRectangle = new Rectangle(0, 0, Texture.Width, Texture.Height);
     Opacity = 1;
 }
Example #54
0
 public ExplosionParticle(Vector2 pos, ParticleType pt)
     : base(pos)
 {
     this.pos = pos;
     angle = (float)(GameConst.rand.NextDouble() * Math.PI * 2);
     rotation = (float)(GameConst.rand.NextDouble() * Math.PI * 2);
     rotSpeed = (float)((GameConst.rand.NextDouble() * Math.PI  ) - Math.PI / 2);
     speed = maxSpeed - GameConst.rand.Next((int)maxSpeed) ;
     type = pt;
     life = 10;
     int s;
     switch (type)
     {
         case ParticleType.Circle:
             s = 25 + GameConst.rand.Next(-5, 5);
             size = new Vector2(s, s);
             texture = TextureManager.Map["explosion-circle"];
             break;
         case ParticleType.Smoke:
             s = 50 + GameConst.rand.Next(-30, 30);
             size = new Vector2(s, s);
             texture = TextureManager.Map["explosion-smoke"];
             break;
         case ParticleType.RedSmoke:
             s = 50 + GameConst.rand.Next(-30, 30);
             size = new Vector2(s, s);
             texture = TextureManager.Map["explosion-smoke"];
             speed = speed - GameConst.rand.Next((int)speed);
             break;
         case ParticleType.BlueSmoke:
             s = 50 + GameConst.rand.Next(-30, 30);
             size = new Vector2(s, s);
             texture = TextureManager.Map["explosion-smoke"];
             speed = speed - GameConst.rand.Next((int)speed);
             break;
         case ParticleType.Lens:
             size = new Vector2(50 + GameConst.rand.Next(50), 20);
             texture = TextureManager.Map["explosion-lens"];
             speed -= maxSpeed / 3;
             break;
     }
     int c = GameConst.rand.Next(4);
     if (type == ParticleType.Circle || type == ParticleType.Lens)
     {
         switch (c)
         {
             case 0:
                 color = new Color(100, 75, 0);
                 break;
             case 1:
                 color = new Color(100, 20, 0);
                 break;
             case 2:
                 color = new Color(140, 0, 0);
                 break;
             case 3:
                 color = new Color(75, 0, 0);
                 break;
         }
     }
     else if (type == ParticleType.RedSmoke)
     {
         int b = GameConst.rand.Next(100);
         color = new Color((byte)b, 0, 0, 50);
     }
     else if (type == ParticleType.BlueSmoke)
     {
         int b = GameConst.rand.Next(75);
         color = new Color(0, 0, (byte)b, 50);
     }
     else
     {
         color = new Color(0, 0, 0, 50);
     }
     //byte cMod = (byte)GameConst.rand.Next(-10, 10);
     //color.R += cMod;
     //color.G += cMod;
     //color.B += cMod;
 }
        public void pushParticle(ParticleType newType, Vector2 newPos, Vector2 offsetVelocity, float direction, float acceldir, Color tint)
        {
            for (int i = 0; i < pool.Length; i++)
            {
                if (pool[i].active == false)
                {
                    pool[i].active = true;
                    pool[i].type = newType;

                    pool[i].startPosition = newPos;

                    switch (newType)
                    {
                        case ParticleType.RedSpark:
                            pool[i].bounce = true;
                            pool[i].pos = newPos;
                            pool[i].posPrevA = newPos;
                            pool[i].posPrevB = newPos;
                            pool[i].posPrevC = newPos;
                            pool[i].posPrevD = newPos;
                            pool[i].velocity.X = (float)(blueSparkVelocity * Math.Cos(direction));
                            pool[i].velocity.Y = (float)(blueSparkVelocity * Math.Sin(direction));
                            pool[i].accel = Vector2.Zero;
                            pool[i].timeActive = 0;
                            pool[i].color = Game1.gameRandom.Next() % 2 == 0 ? redSparkColorA : redSparkColorB;
                            pool[i].colorPrevA = pool[i].color;
                            pool[i].colorPrevB = pool[i].color;
                            pool[i].colorPrevC = pool[i].color;
                            pool[i].colorPrevD = pool[i].color;
                            pool[i].currentFrame = 0;
                            pool[i].lastFrameIncrement = 0;
                            pool[i].frameCount = AnimationFactory.getAnimationFrameCount(dansAnim);
                            pool[i].frameSpeed = AnimationFactory.getAnimationSpeed(dansAnim);
                            if (pool[i].velocity.X * offsetVelocity.X >= 0)
                            {
                                pool[i].velocity.X += offsetVelocity.X;
                            }
                            break;
                        case ParticleType.BlueSpark:
                            pool[i].bounce = true;
                            pool[i].pos = newPos;
                            pool[i].posPrevA = newPos;
                            pool[i].posPrevB = newPos;
                            pool[i].posPrevC = newPos;
                            pool[i].posPrevD = newPos;
                            pool[i].velocity.X = (float)(blueSparkVelocity * Math.Cos(direction));
                            pool[i].velocity.Y = (float)(blueSparkVelocity * Math.Sin(direction));
                            pool[i].accel = Vector2.Zero;
                            pool[i].timeActive = 0;
                            pool[i].color = Game1.gameRandom.Next() % 2 == 0 ? blueSparkColorA : blueSparkColorB;
                            pool[i].colorPrevA = pool[i].color;
                            pool[i].colorPrevB = pool[i].color;
                            pool[i].colorPrevC = pool[i].color;
                            pool[i].colorPrevD = pool[i].color;
                            pool[i].currentFrame = 0;
                            pool[i].lastFrameIncrement = 0;
                            pool[i].frameCount = AnimationFactory.getAnimationFrameCount(dansAnim);
                            pool[i].frameSpeed = AnimationFactory.getAnimationSpeed(dansAnim);
                            if (pool[i].velocity.X * offsetVelocity.X >= 0)
                            {
                                pool[i].velocity.X += offsetVelocity.X;
                            }
                            break;
                        case ParticleType.SweatDrops:
                            pool[i].bounce = false;
                            pool[i].pos = newPos;
                            pool[i].posPrevA = newPos;
                            pool[i].posPrevB = newPos;
                            pool[i].posPrevC = newPos;
                            pool[i].posPrevD = newPos;
                            pool[i].velocity.X = (float)((sweatDropVelocity * Math.Cos(direction)) / 2.5f);
                            pool[i].velocity.Y = (float)(sweatDropVelocity * Math.Sin(direction));
                            pool[i].accel = new Vector2(0, sweatDropAccel);
                            pool[i].timeActive = 0;
                            pool[i].color = tint;
                            pool[i].colorPrevA = pool[i].color;
                            pool[i].colorPrevB = pool[i].color;
                            pool[i].colorPrevC = pool[i].color;
                            pool[i].colorPrevD = pool[i].color;
                            pool[i].currentFrame = 2;
                            pool[i].lastFrameIncrement = 0;
                            pool[i].frameCount = AnimationFactory.getAnimationFrameCount(dansAnim);
                            pool[i].frameSpeed = AnimationFactory.getAnimationSpeed(dansAnim);
                            if (pool[i].velocity.Y > 0)
                            {
                                pool[i].velocity.Y *= -1;
                            }
                            break;
                        case ParticleType.ColouredSpark:
                            pool[i].bounce = false;
                            pool[i].pos = newPos;
                            pool[i].color = tint;
                            pool[i].velocity.X = (float)(colouredSparkVelocity * Math.Cos(direction));
                            pool[i].velocity.Y = (float)(colouredSparkVelocity * Math.Sin(direction));
                            pool[i].accel = Vector2.Zero;
                            pool[i].timeActive = 0;
                            pool[i].currentFrame = 2;
                            pool[i].lastFrameIncrement = 0;
                            pool[i].frameCount = AnimationFactory.getAnimationFrameCount(dansAnim);
                            pool[i].frameSpeed = AnimationFactory.getAnimationSpeed(dansAnim);
                            break;
                        default:
                            break;
                    }

                    break;
                }
            }
        }
Example #56
0
 public void createParticle(ParticleType particleType)
 {
     switch (particleType)
     {
         case ParticleType.Dust:
             createDust();
             break;
         case ParticleType.Explosion:
             createExplosion();
             break;
         case ParticleType.Knockback:
             createKnockback();
             break;
     }
 }
 public Effect(Int64 StartingPoint, int ParticleSystemLifetime, int DirectionOffset, int MinLifetime, int MaxLifetime, int MinForce, int MaxForce, int TickDelay, int TickAmount, float X, float Y, float Z, float MinSizeStarting, float MaxSizeStarting, float MinSizeEnding, float MaxSizeEnding, Color Color, int Direction, ParticleType Type)
 {
     startingPoint = StartingPoint;
     particleSystemLifetime = ParticleSystemLifetime;
     directionOffset = DirectionOffset;
     minLifetime = MinLifetime;
     maxLifetime = MaxLifetime;
     tickDelay = TickDelay;
     tickAmount = TickAmount;
     x = X;
     y = Y;
     z = Z;
     minSizeStarting = MinSizeStarting;
     maxSizeStarting = MaxSizeStarting;
     minSizeEnding = MinSizeEnding;
     maxSizeEnding = MaxSizeEnding;
     minForce = MinForce;
     maxForce = MaxForce;
     direction = Direction;
     type = Type;
     color = Color;
 }
Example #58
0
 public static string ToString(ParticleType type)
 {
     switch (type)
     {
         case ParticleType.Point:
             return "Point";
         case ParticleType.Sprite:
             return "Sprite";
         case ParticleType.Disc:
             return "Disc";
         case ParticleType.Billboard:
             return "Billboard";
         case ParticleType.Model:
             return "Model";
         default:
             throw new ArgumentOutOfRangeException(nameof(type), type, null);
     }
 }
 public void CreateParticleSystem(float X, float Y, float Z, int[] Dir, int directionOffset, ParticleType type, Color c, Color c2, float minSizeStarting, float maxSizeStarting, float minSizeEnding, float maxSizeEnding, int minLifeTime, int maxLifeTime, int minForce, int maxForce, int TickDelay, int TickAmount, int ParticleSystemLifetime)
 {
     lParticleSystems.Add(new ParticleSystem(X, Y, Z, Dir, directionOffset, type, bColor.BackColor));
     lParticleSystems[lParticleSystems.Count - 1].SetExtraParameters(minSizeStarting, maxSizeStarting, minSizeEnding, maxSizeEnding, minLifeTime, maxLifeTime, minForce, maxForce, TickDelay, TickAmount, ParticleSystemLifetime);
     lParticleSystems[lParticleSystems.Count - 1].SetColorMode(ColorMode.Gradient_Color_Frozen, new Color[] { c, c2 });
     lbParticleSystemsID.Items.Add(lParticleSystems.Count - 1);
     lbParticleSystemsID.SelectedIndex = lbParticleSystemsID.Items.Count - 1;
 }
Example #60
0
 public ParticleState(Vector2 velocity, ParticleType type, float lengthMultiplier = 1f)
 {
     Velocity = velocity;
     Type = type;
     LengthMultiplier = lengthMultiplier;
 }