Exemple #1
0
        protected override bool OnPerish(ActorBase collider)
        {
            PlaySound("Break");

            Vector3 pos = Transform.Pos;

            for (int i = 0; i < 10; i++)
            {
                float fx = MathF.Rnd.NextFloat(-18f, 18f);
                float fy = MathF.Rnd.NextFloat(-8f, 0.2f);

                ActorBase actor = api.EventSpawner.SpawnEvent(ActorInstantiationFlags.None, EventType.Gem, pos + new Vector3(fx * 2f, fy * 4f, 10f), new ushort[] { 0 });
                actor.AddExternalForce(fx, fy);
                api.AddActor(actor);
            }

            return(base.OnPerish(collider));
        }