Exemplo n.º 1
0
    /// <summary>
    /// updates individul unit.
    /// </summary>
    /// <param name="unit"></param>
    void UpdateUnit(Unit unit, ref int topUnit, ref int index, ref bool allDead, int i)
    {
        if (unit.alive)
        {
            allDead = false;
            unit.ManualUpdate();

            int zPosition = (int)unit.position.z;
            if (zPosition > topUnit)
            {
                topUnit = zPosition;
                index   = i;
            }
        }
        else
        {
            if (unit.hit)
            {
                ParticleSystem particleSystem = ParticleSystemFactory.CreateParticleEffectSystem(ParticleSystemFactory.ParticleEffect.Death, unit.colour);
                particleSystem.transform.position = new Vector3(unit.position.x, particleSystem.transform.position.y, unit.position.z);
                _particles.Add(particleSystem);

                unit.hit = false;
            }
        }
    }
Exemplo n.º 2
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            var textBlock = new TextBlock()
            {
                Text = "Touch the screen to control fireball",
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Margin    = new WaveEngine.Framework.UI.Thickness(20),
                DrawOrder = 0.1f
            };

            this.EntityManager.Add(textBlock);

            var smoke = EntityManager.Find("meteor.smoke");

            smoke.AddComponent(new ParticleSystemRenderer2D());
            smoke.AddComponent(ParticleSystemFactory.CreateSmokeParticle());

            var fire = EntityManager.Find("meteor.fire");

            fire.AddComponent(new ParticleSystemRenderer2D());
            fire.AddComponent(ParticleSystemFactory.CreateFireParticle());

            var explosionParticles = EntityManager.Find("explosion.explosionParticles");

            explosionParticles.AddComponent(new ParticleSystemRenderer2D());
            explosionParticles.AddComponent(ParticleSystemFactory.CreateExplosion());

            var dinos = EntityManager.Find("explosion.dinos");

            dinos.AddComponent(new ParticleSystemRenderer2D());
            dinos.AddComponent(ParticleSystemFactory.CreateDinosaurs());
        }
        public ParticleSystemFactory _getFactory()
        {
            global::System.IntPtr cPtr = OgrePINVOKE.ParticleSystemManager__getFactory(swigCPtr);
            ParticleSystemFactory ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ParticleSystemFactory(cPtr, false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 4
0
    /// <summary>
    /// Creates all of entities here and initializes them.
    /// </summary>
    void Start()
    {
        PrefabFactory.Initialize();
        ParticleSystemFactory.Initialize();

        GenerateRegions();

        GeneratePlayers();

        SetupSpotLights();

        SetupCamera();

        AudioManager.instance.PlaySoundEffect(AudioManager.SoundEffect.RoundStart);
    }
Exemplo n.º 5
0
 void frame_MouseClick(Element sender, MouseEventArgs e)
 {
     if (e.isClicked(MouseButtons.Left))
     {
         var rad = 25;
         PhysicsManager.AddParticleSystems(ParticleSystemFactory.GetDirtyBomb(e.CurrentPosition, rad));
         PhysicsManager.AddInstantaneousForceField(new InstantaneousForceField(e.CurrentPosition, rad, DefaultForces.GenerateExplosiveField(rad, 1)));
     }
     if (e.isClicked(MouseButtons.Right))
     {
     }
     if (e.isClicked(MouseButtons.Middle))
     {
     }
 }
Exemplo n.º 6
0
        void Astroid_Collided(IRigidBody impactB)
        {
            if ((impactB is Player || impactB is Astroid) && isRoid)
            {
                var PE = ((GameStates.IPlayable)GameEngine.Singleton
                          .FindGameState(x => x is GameStates.IPlayable))
                         .PhysicsManager;

                this.Destroy();

                var brad      = this.Radius * 1.2f;
                var explosion = ParticleSystemFactory.GetDirtyBomb(this.Position, brad);
                PE.AddParticleSystems(explosion);
                PE.AddInstantaneousForceField(new InstantaneousForceField(this.Position, brad, DefaultForces.GenerateExplosiveField(brad, 1)));
            }
        }
Exemplo n.º 7
0
        void frame_MouseClick(Element sender, MouseEventArgs e)
        {
            if (e.isClicked(MouseButtons.Right))
            {
                var pfire = new ParticleSystem(new Vector2(e.CurrentMouseState.X, e.CurrentMouseState.Y), 15, 100, 1, 10, 1, 3f, fire);
                pfire.InitVelocities(0, 110);
                PE.AddParticleSystem(pfire);

                var psmoke = new ParticleSystem(new Vector2(e.CurrentMouseState.X, e.CurrentMouseState.Y), 25, 100, 2f, 20, 1, 1f, smoke);
                psmoke.InitVelocities(0, 200);
                PE.AddParticleSystem(psmoke);
            }
            else if (e.isClicked(MouseButtons.Left))
            {
                PE.AddParticleSystems(ParticleSystemFactory.GetDirtyBomb(new Vector2(e.CurrentMouseState.X, e.CurrentMouseState.Y), 50));
            }
        }
Exemplo n.º 8
0
        public void Detonate(float damageConstant)
        {
            if (this.Parent == null)
            {
                return;
            }

            var PE = ((PlayableState)GameEngine.Singleton
                      .FindGameState(x => x is PlayableState))
                     .PhysicsManager;

            var explosion = ParticleSystemFactory.GetDirtyBomb(this.Position, BlastRadius);

            PE.AddParticleSystems(explosion);

            var forcefield = new InstantaneousForceField(this.Position, BlastRadius, DefaultForces.GenerateExplosiveField(BlastRadius, BlastStrength));

            PE.AddInstantaneousForceField(forcefield);

            if (this.Parent is IHealthable)
            {
                ((IHealthable)this.Parent).CurrentHealth = 0.0f;
            }
            this.Parent.Destroy();

            var inRange = PE.QTbodies.Query(Region.FromCircle(this.Position, BlastRadius));

            foreach (Actor actor in inRange)
            {
                if (actor is IHealthable)
                {
                    var damage = forcefield.GetForce(actor.Position - forcefield.SourcePos).Length();
                    ((IHealthable)actor).Hurt(damage * damageConstant);
                }
            }
        }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ParticleSystemFactory obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 10
0
        protected override IEnumerator ProcessPayload(VisualPayload payload)
        {
            foreach (var entry in Scope.GetEntries(payload.Data))
            {
                var newSystem = ParticleSystemFactory.GenerateParticleSystem(ParticleSystemPrefabName.GetValue(entry));

                var mainColor = MainColor.GetValue(entry);

                newSystem.startColor = mainColor;

                if (OverrideColorGradient.GetValue(entry))
                {
                    var newGradient = new Gradient();
                    newGradient.colorKeys = new []
                    {
                        new GradientColorKey(mainColor, 0f),
                        new GradientColorKey(mainColor, 1f),
                    };
                    newGradient.alphaKeys = new []
                    {
                        new GradientAlphaKey(1f, 0f),
                        new GradientAlphaKey(1f, .15f),
                        new GradientAlphaKey(0f, 1f)
                    };

                    var col = newSystem.colorOverLifetime;
                    col.enabled = true;
                    col.color   = new ParticleSystem.MinMaxGradient(
                        newGradient);
                }


                newSystem.startLifetime = LifeTime.GetValue(entry);

                // this allegedly works, see http://forum.unity3d.com/threads/enabling-emission.364258/#post-2356966
                var emission = newSystem.emission;
                emission.rate = new ParticleSystem.MinMaxCurve(EmitRate.GetValue(entry));


                var newBound = newSystem.GetComponent <BoundingBox>();
                if (newBound == null)
                {
                    newBound = newSystem.gameObject.AddComponent <BoundingBox>();
                }

                payload.VisualData.Bound.ChildWithinBound(newBound.transform);

                var newVisualizer = newSystem.GetComponent <ParticleSystemVisualizer>();
                if (newVisualizer == null)
                {
                    newVisualizer = newSystem.gameObject.AddComponent <ParticleSystemVisualizer>();
                }

                var newPayload = new VisualPayload(entry.Last(), new VisualDescription(newBound));

                newVisualizer.Initialize(this, newPayload);

                var perParticleSystemIterator = PerParticleSystem.Transmit(newPayload);
                while (perParticleSystemIterator.MoveNext())
                {
                    yield return(null);
                }
            }

            var defaultIterator = DefaultState.Transmit(payload);

            while (defaultIterator.MoveNext())
            {
                yield return(null);
            }
        }