Exemplo n.º 1
0
 private void Start()
 {
     attributes        = GetComponent <PlayerAttributes>();
     generator         = particleSource.GetComponent <ParticleGenerator>();
     generator.enabled = false;
     pourTime          = 0;
 }
Exemplo n.º 2
0
        public void Build()
        {
            ParticleGenerator.CreateBuildingRing(this.mStateMgr.SceneMgr, (this.Position + new Vector3(0.5f, 0, 0.5f) * this.Size - Vector3.UNIT_Z) * Cst.CUBE_SIDE,
                                                 new Vector2(this.Size.x, this.Size.z), this.RTS.Faction);

            if (!this.mIsCreated)
            {
                this.Create();
            }
            this.mIsland.stopCleaning();
            for (int x = 0; x < this.Size.x; x++)
            {
                for (int y = 0; y < this.Size.y; y++)
                {
                    for (int z = 0; z < this.Size.z; z++)
                    {
                        Vector3 pos = this.RealPos + new Vector3(x, 0, z) * this.mSymetricFactor + Vector3.UNIT_Y * y;
                        if (this.mBuilding[x, y, z] == 99)
                        {
                            this.mIsland.removeBlock(pos);
                        }
                        else if (this.mBuilding[x, y, z] != 0)
                        {
                            string name = VanillaChunk.staticBlock[VanillaChunk.byteToString[this.mBuilding[x, y, z]]].getName();
                            this.mIsland.setBlockAt(pos, name, true);
                        }
                    }
                }
            }
            this.OnBuild();
            this.mIsland.clean();
        }
Exemplo n.º 3
0
        public void onBlockEnter(Vector3 blockCoord, Entity e)
        {
            if (d.ContainsKey(blockCoord))
            {
                foreach (string s in d[blockCoord])
                {
                    new Script.Parser(this.mStateMgr).Parse(s);
                }
            }

            if (blockCoord.y >= 200)
            {
                if (n == null)
                {
                    n = ParticleGenerator.mkParticle(this.mStateMgr.SceneMgr, Vector3.NEGATIVE_UNIT_Y * 250, "Snow", e.getNode());
                }
            }
            else if (n != null)
            {
                this.getSceneMgr().DestroyParticleSystem((ParticleSystem)n.GetAttachedObject(0));
                n.RemoveAndDestroyAllChildren();
                this.getSceneMgr().DestroySceneNode(n);
                n = null;
            }

            this.mIslandLoaded.getBlock(blockCoord, false).onBlockEnter(e, blockCoord);
        }
Exemplo n.º 4
0
        public override string GenerateSharedPixelShader(ShaderStage stage, int methodIndex, int optionIndex)
        {
            var gen      = new ParticleGenerator();
            var bytecode = gen.GenerateSharedPixelShader(stage, methodIndex, optionIndex).Bytecode;

            return(D3DCompiler.Disassemble(bytecode));
        }
Exemplo n.º 5
0
        public override string GenerateSharedVertexShader(VertexType vertex, ShaderStage stage)
        {
            var gen      = new ParticleGenerator();
            var bytecode = gen.GenerateSharedVertexShader(vertex, stage).Bytecode;

            return(D3DCompiler.Disassemble(bytecode));
        }
Exemplo n.º 6
0
        public void NewParticleGenerator(string particleImagePath)
        {
            using (var fileStream = new FileStream(particleImagePath, FileMode.Open))
            {
                var particleImage = Texture2D.FromStream(_graphicsDeviceManager.GraphicsDevice, fileStream);

                var particleSprite = new Sprite(new FbonizziMonoGame.Assets.SpriteDescription()
                {
                    Name   = "particle",
                    Width  = particleImage.Width,
                    Height = particleImage.Height,
                    X      = 0,
                    Y      = 0
                }, particleImage);

                ParticleGenerator = new ParticleGenerator(
                    particleSprite: particleSprite,
                    density: 6,
                    minNumParticles: 6, maxNumParticles: 12,
                    minInitialSpeed: 80, maxInitialSpeed: 100,
                    minAcceleration: 1, maxAcceleration: 5,
                    minRotationSpeed: -3, maxRotationSpeed: 3,
                    minLifetime: TimeSpan.FromMilliseconds(700), maxLifetime: TimeSpan.FromMilliseconds(900),
                    minScale: 0.1f, maxScale: 0.7f,
                    minSpawnAngle: -45, maxSpawnAngle: 235);

                ParticleGeneratorTimedEffect = new FbonizziMonoGame.Particles.ParticleGeneratorTimedEffect(
                    ParticleGenerator,
                    new Vector2(300, 300),
                    TimeSpan.FromMilliseconds(155),
                    null);
            }
        }
Exemplo n.º 7
0
 private void Awake()
 {
     if (Instance == null) // NOT initialized
     {
         Instance = this;  // Initializing the instance
     }
 }
Exemplo n.º 8
0
    void Update()
    {
        for (int i = 0; i < particleSpawners.Length; i++)
        {
            particlegenerator = particleSpawners [i].GetComponent <ParticleGenerator> ();

            if (activated && rotating)                                                                                          //Lever is activated
            {
                particlegenerator.spawn = true;
                //transform.Rotate(new Vector3(0, 0, 50) * Time.deltaTime);
                StartCoroutine("RotateRight");
            }
            if (!activated && !rotating)                                                                                        //Lever is deactivated
            {
                particlegenerator.spawn = false;
                StartCoroutine("RotateLeft");
            }
        }
        for (int i = 0; i < movingPlatforms.Length; i++)
        {
            platformcontroller = movingPlatforms [i].GetComponent <PlatformController> ();

            if (activated)                                                                                      //Lever is activated
            {
                platformcontroller.platformActivator = false;
                transform.localRotation = Quaternion.Euler(0, 0, -327.2233f);
            }
            if (!activated)                                                                                     //Lever is deactivated
            {
                platformcontroller.platformActivator = true;
                transform.localRotation = Quaternion.Euler(0, 0, 327.2233f);
            }
        }
    }
Exemplo n.º 9
0
 public override void Load()
 {
     btnPlay                 = new Button(GameResources.MainMenuButton, new Vector2(600, 20), 3);
     btnExplication          = new Button(GameResources.ExplicationMainButton, new Vector2(600, 200), 3);
     rain                    = new ParticleGenerator(GameResources.Rain, m_GraphicsDeviceManager.GraphicsDevice.Viewport.Width, 80);
     MediaPlayer.IsRepeating = true;
     //MediaPlayer.Play(GameResources.SongImageTitre);
 }
Exemplo n.º 10
0
 public void Update(GameTime gt)
 {
     if (_appearBadGuy && a == null)
     {
         a = new BadGuy(_position, _scene);
         _scene.GameObjects.AddGameObject("BadGuy", a);
         Particle p = new Particle(new Vector2(0, 0), new Vector2(10, 10), Color.Blue, 3f);
         p.AddComponent("Color", new SinglePixelParticleDrawer(p));
         ColorLerper lerp = (ColorLerper)p.AddComponentAndReturnComponent("lerper", new ColorLerper(p));
         lerp.AddColor(Color.Red, 1f);
         lerp.AddColor(Color.Blue, 1f);
         lerp.AddColor(Color.Yellow, 1f);
         p.AddComponent("Movement", new RandomMovementEffect(p, 15, 20));
         gen                    = new ParticleGenerator(a.Position, new Vector2(-10, 10), new Vector2(-10, 10), 27, p, _scene);
         p.Generator            = gen;
         gen.Enabled            = true;
         gen.IgnoreSafeSpawning = false;
     }
     if (gen != null)
     {
         gen.Update(gt);
         _badguyopacityTime += (float)gt.ElapsedGameTime.TotalSeconds;
         Sprite sprite = (Sprite)a.GetComponents("BadGuySprite").ElementAt(0);
         sprite.Color = Color.White * (_badguyopacityTime / 2f);
         if (_badguyopacityTime > 1.84f)
         {
             gen.Enabled = false;
         }
         if (!gen.particles.Any() && gen.Enabled == false)
         {
             this.Done = true;
         }
     }
     this._scene.Camera.Target = _position;
     _time += (Single)gt.ElapsedGameTime.TotalSeconds;
     if (!(_time >= TimePerMessage))
     {
         return;
     }
     if (Input.IsKeyDown(Keys.Space) || Input.IsKeyDown(Keys.Enter) || Input.IsKeyDown(Keys.Escape))
     {
         if (Input.WasKeyUp(Keys.Space))
         {
             Finish();
             return;
         }
         if (Input.WasKeyUp(Keys.Enter))
         {
             Finish();
             return;
         }
         if (Input.WasKeyUp(Keys.Escape))
         {
             Finish();
             return;
         }
     }
 }
 public ShurikenReceiver(Transform transform, AABB shurikenBounds, int impactBufferSize)
 {
     m_transform = transform;
     m_shurikenBounds = shurikenBounds;
     m_impacts = new Sprite[impactBufferSize];
     m_helper = new GeometryHelper();
     m_hitParticles = new ParticleSystem(Globals.TheGame, 2);
     m_generator = new ParticleGenerator<PhysicsParticle>(Globals.TheGame, m_hitParticles);
 }
 public ShurikenReceiver(Transform transform, AABB shurikenBounds, int impactBufferSize)
 {
     m_transform      = transform;
     m_shurikenBounds = shurikenBounds;
     m_impacts        = new Sprite[impactBufferSize];
     m_helper         = new GeometryHelper();
     m_hitParticles   = new ParticleSystem(Globals.TheGame, 2);
     m_generator      = new ParticleGenerator <PhysicsParticle>(Globals.TheGame, m_hitParticles);
 }
Exemplo n.º 13
0
        public TotemSection(SectionType type)
            : base()
        {
            m_type                = type;
            m_physics             = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass        = Mass;
            m_physics.Restitution = Bounciness;
            m_generator           = new ParticleGenerator <Soul>(Program.TheGame, Game1.Souls);

            m_explosion = new ParticleGenerator <Explosion>(Program.TheGame, Game1.Explosions);
        }
Exemplo n.º 14
0
    //public GameObject parentObject;
    //public Vector3 offsetFromPlatform;
    //GameObject playerFlowerCollider;

    void Start()
    {
        rigid                 = transform.rigidbody2D;
        animT                 = transform.FindChild("Animator");
        ator                  = animT.GetComponent <Animator>();
        stamina               = GetComponent <Stamina>();
        camFollow             = GetComponent <CameraFollowing>();
        doubleJumpParticleGen = GameObject.Find("Double Jump Particle Generator").GetComponent <ParticleGenerator>();
        dustParticleGen       = GameObject.Find("Dust Particle Generator").GetComponent <ParticleGenerator>();
        dashParticleGen       = GameObject.Find("Dash Particle Generator").GetComponent <ParticleGenerator>();
        soundHandler          = GameObject.Find("Sound Handler").GetComponent <SoundHandler>();

        animT.localPosition = new Vector3(-0.18f, 0.04f, 1.0f);
        padInput            = Vector2.zero;
        onGround            = false;
        idleTimer           = 0.0f;


        //basic
        moveAccel            = 35.0f; //movement accel. and decel.
        moveDecel            = 40.0f;
        moveSpeed            = 4.0f;  //max move speed
        jumpStrength         = 5.8f;
        airFriction          = 9.0f;  //velocity.x slow down in air
        deadZone             = 0.3f;
        allowInput           = true;
        allowCameraFollowing = true;


        //while gliding
        gliding = false;                //gliding state
        glideDefaceDirection   = Vector3.zero;
        glideDeFaceThreshold   = 3.99f; //direction can't be changed when (-glideDeFaceThreshold < velocity.x < glideDeFaceThreshold)
        glideAllowDeFace       = true;  //allow changing direction
        glideSteepness         = 0.25f; //how much the player descends while gliding
        glideControl           = 8.0f;  //how much the gliding speed can be affected by input
        glideZeroAcc           = 6.0f;  //acceleration from zero velocity
        glideGravityResistance = 15.0f; //how much gravity resistance when starting to glide while falling
        glideHitWallTimer      = 0.0f;
        glideHitWallPenalty    = 0.6f;


        //dashing
        dashing       = false;
        dashTimer     = 0.0f;
        dashLength    = 0.3f;
        dashSpeed     = 8.0f;
        faceDirection = new Vector3(1.0f, 0.0f, 0.0f);


        //boost
        allowBoost    = true;      //clears after boosting, sets when touching ground or ?
        boostStrength = 5.7f;
    }
Exemplo n.º 15
0
        public GenerateDustOnClick(GameModel gameModel, MouseInputs mouse)
        {
            Dictionary <string, int> particlesDico = new Dictionary <string, int>
            {
                { "dustParticle", 100 }
            };

            _particleGenerator = new ParticleGenerator(particlesDico, 0, 360, 0, 1, 80);
            _gameModel         = gameModel;
            _mouse             = mouse;
        }
Exemplo n.º 16
0
        public TestParticleGenerator()
        {
            Dictionary <string, int> dictionary = new Dictionary <string, int>
            {
                { "dustParticle", 100 },
                { "SpriteTest", 0 }
            };

            _particleGenerator = new ParticleGenerator(400, 300, dictionary, Direction.Right, 0, 999, 0.2f, 10);
            GeneratorUpdater.AddGenerator(_particleGenerator);
            GeneratorUpdater.AddGenerator(new ParticleGenerator(250, 250, dictionary, Direction.Top, new Angle(45), 10, 0.5f, 4));
        }
        public ParticleFilter(int particle_count, ParticleGenerator generator)
        {
            mParticleCount = particle_count;

            mParticles = new IParticle[mParticleCount];
            for (int i = 0; i < mParticleCount; ++i)
            {
                mParticles[i] = generator();
            }

            mAccumulatedParticleWeights = new double[mParticleCount];
            mParticleWeights            = new double[mParticleCount];
        }
Exemplo n.º 18
0
 public Emitter(Vector2 location, TimeSpan ttl, ParticleGenerator generator, int rate, int max, params IEmitterModifier[] modifiers)
 {
     EmitterLocation = location;
     EmissionPoint   = location;
     Particles       = new List <Particle>();
     Ttl             = new Tween(ttl, 0f, 1f);
     EmmisionRate    = rate;
     EmmitVal        = new Tween(TimeSpan.FromSeconds(1), 0, 1);
     Generator       = generator;
     OnStart         = p => { };
     OnEnd           = p => { };
     Modifiers       = new List <IEmitterModifier>(modifiers);
     Max             = max;
 }
Exemplo n.º 19
0
    void Start()
    {
        pGenPos    = new Vector3(0.05812454f, 0.362566f, 0.0f);
        pGenPrefab = Resources.Load <GameObject>("Checkpoint/Checkpoint Particle Generator");
        pGen       = null;

        pGenObj = Instantiate(pGenPrefab, transform.position + pGenPos, Quaternion.identity) as GameObject;
        pGenObj.transform.parent = transform;
        pGenObj.name             = "Checkpoint Particle Generator " + transform.position.x;

        pGen = pGenObj.GetComponent <ParticleGenerator>();


        activated = false;
    }
Exemplo n.º 20
0
        public override string GeneratePixelShader(ShaderStage stage, List <int> shaderOptions)
        {
            var albedo                = (Albedo)shaderOptions[0];
            var blend_mode            = (Blend_Mode)shaderOptions[1];
            var specialized_rendering = (Specialized_Rendering)shaderOptions[2];
            var lighting              = (Lighting)shaderOptions[3];
            var render_targets        = (Render_Targets)shaderOptions[4];
            var depth_fade            = (Depth_Fade)shaderOptions[5];
            var black_point           = (Black_Point)shaderOptions[6];
            var fog               = (Fog)shaderOptions[7];
            var frame_blend       = (Frame_Blend)shaderOptions[8];
            var self_illumination = (Self_Illumination)shaderOptions[9];

            var gen      = new ParticleGenerator(albedo, blend_mode, specialized_rendering, lighting, render_targets, depth_fade, black_point, fog, frame_blend, self_illumination);
            var bytecode = gen.GeneratePixelShader(stage).Bytecode;

            return(D3DCompiler.Disassemble(bytecode));
        }
Exemplo n.º 21
0
        //        public Scene1()		//(string name) : base(name)
        //        {
        //            Init();
        //        }
        public void Init()
        {
            JGL.Heirarchy.Object box = null;
            AddRange(
                new Origin(),
                new Tree1() { Position = new Vector3d(3, 0, -13), Rotation = new Vector3d(0.15, 68, 0) },
                new Tree1() { Position = new Vector3d(-2, -0.12, -10), Rotation = new Vector3d(-0.2, -30, 0) },
                new Tree1() { Position = new Vector3d(1.25, -0.3, -8), Rotation = new Vector3d(1, 2, 0) },
                new WhiteLight() { Position = new Vector3d(3.5, 3.5, -1) },
                new WhiteLight(0.68f, 0.22f, 0.338f) { Position = new Vector3d(-0.2, 1.8, 2) },
                box = new Box(3, 2, 1)
                {
                    Position = new Vector3d(-2, 1, 0.5),
                    Material = new Material("White")
                    {
                        TextureAmbient = Resource.Get<Texture>("test1.png")				//new Texture("test1.png")
                    },
                    TwoSided = true
                },
                new Quad(7.8, 7.2)
                {
                    Position = new Vector3d(+1.2, -0.042, -0.55),
                    Material = new Material("tex2") { TextureAmbient = Resource.Get<Texture>("tex2.png") },				//new Texture("tex2.png") },
                    TwoSided = true
                });
            DefaultCamera.Position = new Vector3d(0.5, 0.75, 8);

            ParticleGenerator pg = new ParticleGenerator()
            {
                Particle = new Triangle(01.5, 00.42)
                {
                    TwoSided = true,
                    Material  = new Material("blue") { Ambient = Color4.Aqua, Diffuse = Color4.Aquamarine }
                },
                Gravity = new Gravity()
            };
            pg.Entities.Add(box);

            Behaviours.Add(pg);
            Behaviours.Add(pg.Gravity);
        }
Exemplo n.º 22
0
        private bool OnStart()
        {
            // Create layer that can hold our renderable elements.
            layer = Layers.CreateDynamic("base");

            var andy = ResourceManager.Load <Texture2D>("andy");

            var autoscales = new Sprite(300.0f, 300.0f, andy);

            layer.Add(autoscales);

            c      = new Circle(400.0f, 400.0f, 128.0f, Circle.RoughCircle);
            c.Fill = Color.White;
            //c.Texture = ResourceManager.Load<Texture2D>("andy");
            c.BorderThickness = 32.0f;
            layer.Add(c);

            // Create triangles.
            for (var i = 0; i < 2; i++)
            {
                var triangle = new Triangle(Vector2.Zero, new Vector2(128.0f));
                triangle.BorderThickness = 8.0f;
                triangle.BorderFill      = Color.Blue;
                triangle.Fill            = Color.White;
                triangle.Texture         = andy;

                var transform = triangle.Transform;
                transform.position.x = 200.0f + 128.0f * i;
                transform.position.y = 200.0f;
                triangle.Transform   = transform;

                layer.Add(triangle);
            }

            // Test sprite..
            var manscales = new Sprite(new Vector2(300.0f), new Vector2(128.0f), andy);

            layer.Add(manscales);

            // Create 3 rectangles.
            for (var i = 0; i < 3; i++)
            {
                layer.Add(new Rectangle(100 + 48.0f * i, 100, 32.0f, 32.0f)
                {
                    BorderThickness = 8.0f
                });
            }

            // Create particle emitter.
            ParticleGenerator gen = ParticleGenerator.Empty();

            gen.flags |= GeneratorFlags.VaryingVelocity;
            gen.flags |= GeneratorFlags.VaryingDecayTime;
            gen.flags |= GeneratorFlags.VaryingSpawnLocation;
            gen.flags |= GeneratorFlags.VaryingAngularVelocity;
            gen.flags |= GeneratorFlags.VaryingScale;
            gen.flags |= GeneratorFlags.UseScaleVelocity;

            gen.startVelocity    = new Vector2(-0.325f, -0.25f);
            gen.velocityVariance = new Vector2(0.625f, 0.25f);

            gen.baseDecayTime     = 550.0f;
            gen.decayTimeVariance = 350.0f;

            gen.spawnLocationMinOffset = new Vector2(-32.0f, 0.0f);
            gen.spawnLocationMaxOffset = new Vector2(32.0f, 0.0f);

            gen.baseAngularVelocity     = 0.001f;
            gen.angularVelocityVariance = 0.01f;

            gen.baseScale     = new Vector2(1.0f, 1.0f);
            gen.scaleVariance = new Vector2(0.5f, 0.5f);

            gen.baseScaleVelocity     = new Vector2(0.001f, 0.001f);
            gen.scaleVelocityVariance = new Vector2(0.005f, 0.005f);

            gen.framesToFade         = 16;
            gen.framesToFadeVariance = 4;

            // TODO: paska osuu tuulettimeen
            var x = 1280.0f / 2.0f;
            var y = 600.0f;

            ParticleEmitter emitter = new ParticleEmitter(gen, andy, new Vector2(x, y), 1024);

            layer.Add(emitter);

            var vars = CVars.GetCVars();

            Console.WriteLine("CVARS C: {0}", vars.Length);

            foreach (var cvar in vars)
            {
                Console.WriteLine(cvar.ToString() + "\n");
            }

            return(true);
        }
Exemplo n.º 23
0
 void Start()
 {
     particlegenerator = gameObject.GetComponent <ParticleGenerator>();
     spriterenderer    = gameObject.transform.GetChild(0).GetComponent <SpriteRenderer>();
 }
Exemplo n.º 24
0
        public TotemSection(SectionType type)
            : base()
        {
            m_type = type;
            m_physics = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = Mass;
            m_physics.Restitution = Bounciness;
            m_generator = new ParticleGenerator<Soul>(Program.TheGame, Game1.Souls);

            m_explosion = new ParticleGenerator<Explosion>(Program.TheGame, Game1.Explosions);
        }
Exemplo n.º 25
0
    public bool EnzymesExist = false;           //!< used to tell whether we already have an enzyme spawned.
    //!< can only have one enzyme active at once
    //!< currently you have to kill the current enzyme to spawn a new one

    /**
     * Use this for initialization
     */
    void Start()
    {
        generator = objectGenerator.GetComponent <ParticleGenerator> ();        // find the particle generator we're using
    }
Exemplo n.º 26
0
 public void mkParticleAt(int x, int y, int z, string name)
 {
     ParticleGenerator.mkParticle(st.SceneMgr, new Vector3(x, y, z), name);
 }
Exemplo n.º 27
0
 // Start is called before the first frame update
 void Start()
 {
     sprite            = GetComponent <SpriteRenderer>();
     particleGenerator = GetComponent <ParticleGenerator>();
 }
Exemplo n.º 28
0
 private void OnEnable()
 {
     particleGenerator = (ParticleGenerator)target;
 }
Exemplo n.º 29
0
        public CutscenePlayer()
            : base()
        {
            m_ascendSound = SoundEffectLibrary.Get("ascend").CreateInstance();
            m_cloud       = new Prop("cloud");
            m_sword       = new Prop("sword");

            m_shlingSprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("shling"), new Transform(m_transform, true));

            m_sprite                 = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("player_cutscene", 1, 4), new Transform(m_transform, true));
            m_sprite.Origin          = new Vector2(0.5f, 0.5f);
            m_sprite.PixelCorrection = false;

            m_moveToCrowd = new MoveToTransform(Program.TheGame, m_transform, null, null, 1);
            m_moveToCrowd.Timer.Interval = 0.1f;
            MoveToStaticAction carryMovement = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(0, CarryHeight - 5), 1);

            carryMovement.Interpolator   = new PBounceInterpolation(1.0f);
            carryMovement.StartPosition  = new Vector2(0, CarryHeight);
            carryMovement.Timer.Interval = 0.2f;
            MethodAction action = new MethodAction(delegate() { carryMovement.StartPosition = new Vector2(0, CarryHeight); });

            Sequence bounceAnimation = new Sequence(-1);

            bounceAnimation.AddAction(carryMovement);
            bounceAnimation.AddAction(action);

            m_carryAnimation = new Sequence(1);
            m_carryAnimation.AddAction(m_moveToCrowd);
            m_carryAnimation.AddAction(bounceAnimation);


            //Sword movement
            Transform start = new Transform(m_transform, true);
            Transform end   = new Transform(m_transform, true);

            m_swordMovement = new MoveToTransform(Program.TheGame, m_sword.Transform, start, end, 1);
            end.PosX        = SwordOffsetToPlayerX;
            end.PosY        = SwordOffsetToPlayerY;
            m_swordDelay    = new DelayAction(Program.TheGame, AscendDuration * SwordStartTimeRatio);

            //Cloud movement
            m_cloudMovement = new MoveToStaticAction(Program.TheGame, m_cloud.Transform, new Vector2(CloudOffsetToPlayerX, CloudOffsetToPlayerY), 1);
            m_cloudMovement.StartPosition = new Vector2(CloudStartX, 0);
            m_cloudMovement.Interpolator  = new PSquareInterpolation(0.25f);

            //Delay of the ascend, then sword/cloud movement
            Sequence swordAndCloudMovement = new Sequence(1);

            swordAndCloudMovement.AddAction(m_swordDelay);
            swordAndCloudMovement.AddAction(new Concurrent(new PastaGameLibrary.Action[] { m_swordMovement, m_cloudMovement }));

            m_ascendMovement = new MoveToTransform(Program.TheGame, m_transform, new Transform(), new Transform(), 1);
            m_ascendMovement.Interpolator = new PSquareInterpolation(0.5f);

            MethodAction showPlayer = new MethodAction(delegate()
            {
                m_sprite.Transform.PosY -= 1;
                Game1.player.ShowPlayer();
                isVisible         = false;
                m_cloud.IsVisible = false;
                m_sword.IsVisible = false;
            });

            //Shling!
            ScaleToAction shlingScale = new ScaleToAction(Program.TheGame, m_shlingSprite.Transform, new Vector2(ShlingScale, ShlingScale), 1);

            shlingScale.Timer.Interval = ShlingTime;
            shlingScale.StartScale     = Vector2.Zero;
            shlingScale.Interpolator   = new PSquareInterpolation(2);

            RotateToStaticAction shlingRotate = new RotateToStaticAction(Program.TheGame, m_shlingSprite.Transform, ShlingSpin, 1);

            shlingRotate.Timer.Interval = ShlingTime;
            m_shling = new Concurrent(new PastaGameLibrary.Action[] { shlingScale, shlingRotate });

            Sequence readyAnim = new Sequence(1);

            readyAnim.AddAction(new DelayAction(Program.TheGame, 0.5f));
            readyAnim.AddAction(new MethodAction(delegate() {
                Cutscenes.GetReady();
                SoundEffectLibrary.Get("sword_slash").Play();
            }));

            Concurrent shlingReady = new Concurrent(new PastaGameLibrary.Action[] {
                m_shling,
                readyAnim,
            });

            m_ascend = new Sequence(1);
            m_ascend.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime));
            m_ascend.AddAction(new MethodAction(delegate() { m_ascendSound.Play(); }));
            Concurrent ascendAndSword = new Concurrent(new PastaGameLibrary.Action[] { m_ascendMovement, swordAndCloudMovement });

            m_ascend.AddAction(ascendAndSword);
            m_ascend.AddAction(showPlayer);
            m_ascend.AddAction(shlingReady);

            m_physics      = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = 3.0f;

            m_jumpFromTotem           = new Sequence(1);
            m_decelerate              = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1);
            m_decelerate.Interpolator = new PSquareInterpolation(0.5f);
            m_jumpFromTotem.AddAction(m_decelerate);
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.2f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                m_physics.OnBounce = null;
                m_physics.Throw(1.0f, -2.0f, 0);
                Game1.CurrentMusic.StopDynamicMusic();
                SoundEffectLibrary.Get("sword_slash").Play();
            }));
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.75f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                Game1.SetupNextRound();
                if (Game1.CurrentTotem == null)
                {
                    Cutscenes.GoToCliff();
                }
                else
                {
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                }
            }));
            m_actionManager = new SingleActionManager();

            m_hitSpikes = new Sequence(1);

            m_moveToCrashingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), new Transform(), 1);
            m_moveToCrashingPlayer.Timer.Interval = 0.2f;

            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_hitSpikes.AddAction(m_moveToCrashingPlayer);
            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_hitSpikes.AddAction(new MethodAction(delegate() {
                if (Game1.CurrentTotem == null)
                {
                    Cutscenes.GoToCliff();
                }
                else
                {
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                }
                m_sprite.SetFrame(0);
                m_physics.OnBounce = null;
                m_physics.Throw(0, -3, 0);
                m_transform.PosY = m_physics.GroundLevel;
            }));

            m_auraParticles = new ParticleSystem(Program.TheGame, 100);
            m_soulParticles = new ParticleSystem(Program.TheGame, 500);

            m_levitate       = new Sequence(1);
            m_moveToCliffTip = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(Cutscenes.InitialCharacterPosition + 10, -8), 1);
            m_moveToCliffTip.Interpolator   = new PSmoothstepInterpolation();
            m_moveToCliffTip.Timer.Interval = 1.0f;
            m_levitate.AddAction(m_moveToCliffTip);
            m_levitate.AddAction(new MethodAction(delegate() { m_generateSouls = true; }));

            m_particleGenerator                    = new ParticleGenerator <GlitterParticle>(Program.TheGame, m_auraParticles);
            m_particleGenerator.Automatic          = true;
            m_particleGenerator.GenerationInterval = 0.01f;
            m_soulParticleGenerator                = new ParticleGenerator <SoulParticle>(Program.TheGame, m_soulParticles);

            m_jumpInMouth = new Sequence(1);
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { m_generateSouls = false; }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { JumpInMonsterMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.25f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.monster.CloseMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 2.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.crowd.PushNewGuy(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.StartMainMenu(); }));
        }
Exemplo n.º 30
0
        public CutscenePlayer()
            : base()
        {
            m_ascendSound = SoundEffectLibrary.Get("ascend").CreateInstance();
            m_cloud = new Prop("cloud");
            m_sword = new Prop("sword");

            m_shlingSprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("shling"), new Transform(m_transform, true));

            m_sprite = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("player_cutscene", 1, 4), new Transform(m_transform, true));
            m_sprite.Origin = new Vector2(0.5f, 0.5f);
            m_sprite.PixelCorrection = false;

            m_moveToCrowd = new MoveToTransform(Program.TheGame, m_transform, null, null, 1);
            m_moveToCrowd.Timer.Interval = 0.1f;
            MoveToStaticAction carryMovement = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(0, CarryHeight - 5), 1);
            carryMovement.Interpolator = new PBounceInterpolation(1.0f);
            carryMovement.StartPosition = new Vector2(0, CarryHeight);
            carryMovement.Timer.Interval = 0.2f;
            MethodAction action = new MethodAction(delegate() { carryMovement.StartPosition = new Vector2(0, CarryHeight); });

            Sequence bounceAnimation = new Sequence(-1);
            bounceAnimation.AddAction(carryMovement);
            bounceAnimation.AddAction(action);

            m_carryAnimation = new Sequence(1);
            m_carryAnimation.AddAction(m_moveToCrowd);
            m_carryAnimation.AddAction(bounceAnimation);

            //Sword movement
            Transform start = new Transform(m_transform, true);
            Transform end = new Transform(m_transform, true);
            m_swordMovement = new MoveToTransform(Program.TheGame, m_sword.Transform, start, end, 1);
            end.PosX = SwordOffsetToPlayerX;
            end.PosY = SwordOffsetToPlayerY;
            m_swordDelay = new DelayAction(Program.TheGame, AscendDuration * SwordStartTimeRatio);

            //Cloud movement
            m_cloudMovement = new MoveToStaticAction(Program.TheGame, m_cloud.Transform, new Vector2(CloudOffsetToPlayerX, CloudOffsetToPlayerY), 1);
            m_cloudMovement.StartPosition = new Vector2(CloudStartX, 0);
            m_cloudMovement.Interpolator = new PSquareInterpolation(0.25f);

            //Delay of the ascend, then sword/cloud movement
            Sequence swordAndCloudMovement = new Sequence(1);
            swordAndCloudMovement.AddAction(m_swordDelay);
            swordAndCloudMovement.AddAction(new Concurrent(new PastaGameLibrary.Action[] { m_swordMovement, m_cloudMovement }));

            m_ascendMovement = new MoveToTransform(Program.TheGame, m_transform, new Transform(), new Transform(), 1);
            m_ascendMovement.Interpolator = new PSquareInterpolation(0.5f);

            MethodAction showPlayer = new MethodAction(delegate()
            {
                m_sprite.Transform.PosY -= 1;
                Game1.player.ShowPlayer();
                isVisible = false;
                m_cloud.IsVisible = false;
                m_sword.IsVisible = false;
            });

            //Shling!
            ScaleToAction shlingScale = new ScaleToAction(Program.TheGame, m_shlingSprite.Transform, new Vector2(ShlingScale, ShlingScale), 1);
            shlingScale.Timer.Interval = ShlingTime;
            shlingScale.StartScale = Vector2.Zero;
            shlingScale.Interpolator = new PSquareInterpolation(2);

            RotateToStaticAction shlingRotate = new RotateToStaticAction(Program.TheGame, m_shlingSprite.Transform, ShlingSpin, 1);
            shlingRotate.Timer.Interval = ShlingTime;
            m_shling = new Concurrent(new PastaGameLibrary.Action[] { shlingScale, shlingRotate });

            Sequence readyAnim = new Sequence(1);
            readyAnim.AddAction(new DelayAction(Program.TheGame, 0.5f));
            readyAnim.AddAction(new MethodAction(delegate() {
                    Cutscenes.GetReady();
                    SoundEffectLibrary.Get("sword_slash").Play();
                }));

            Concurrent shlingReady = new Concurrent(new PastaGameLibrary.Action[] {
                m_shling,
                readyAnim,
            });

            m_ascend = new Sequence(1);
            m_ascend.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime));
            m_ascend.AddAction(new MethodAction(delegate() { m_ascendSound.Play(); }));
            Concurrent ascendAndSword = new Concurrent(new PastaGameLibrary.Action[] { m_ascendMovement, swordAndCloudMovement });
            m_ascend.AddAction(ascendAndSword);
            m_ascend.AddAction(showPlayer);
            m_ascend.AddAction(shlingReady);

            m_physics = new PhysicsComponent(Program.TheGame, m_transform);
            m_physics.Mass = 3.0f;

            m_jumpFromTotem = new Sequence(1);
            m_decelerate = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1);
            m_decelerate.Interpolator = new PSquareInterpolation(0.5f);
            m_jumpFromTotem.AddAction(m_decelerate);
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.2f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
                {
                    m_physics.OnBounce = null;
                    m_physics.Throw(1.0f, -2.0f, 0);
                    Game1.CurrentMusic.StopDynamicMusic();
                    SoundEffectLibrary.Get("sword_slash").Play();
                }));
            m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.75f));
            m_jumpFromTotem.AddAction(new MethodAction(delegate()
            {
                Game1.SetupNextRound();
                if (Game1.CurrentTotem == null)
                    Cutscenes.GoToCliff();
                else
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
            }));
            m_actionManager = new SingleActionManager();

            m_hitSpikes = new Sequence(1);

            m_moveToCrashingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), new Transform(), 1);
            m_moveToCrashingPlayer.Timer.Interval = 0.2f;

            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_hitSpikes.AddAction(m_moveToCrashingPlayer);
            m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_hitSpikes.AddAction(new MethodAction(delegate() {
                if(Game1.CurrentTotem == null)
                    Cutscenes.GoToCliff();
                else
                    Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0);
                m_sprite.SetFrame(0);
                m_physics.OnBounce = null;
                m_physics.Throw(0, -3, 0);
                m_transform.PosY = m_physics.GroundLevel;
            }));

            m_auraParticles = new ParticleSystem(Program.TheGame, 100);
            m_soulParticles = new ParticleSystem(Program.TheGame, 500);

            m_levitate = new Sequence(1);
            m_moveToCliffTip = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(Cutscenes.InitialCharacterPosition + 10, -8), 1);
            m_moveToCliffTip.Interpolator = new PSmoothstepInterpolation();
            m_moveToCliffTip.Timer.Interval = 1.0f;
            m_levitate.AddAction(m_moveToCliffTip);
            m_levitate.AddAction(new MethodAction(delegate() { m_generateSouls = true; }));

            m_particleGenerator = new ParticleGenerator<GlitterParticle>(Program.TheGame, m_auraParticles);
            m_particleGenerator.Automatic = true;
            m_particleGenerator.GenerationInterval = 0.01f;
            m_soulParticleGenerator = new ParticleGenerator<SoulParticle>(Program.TheGame, m_soulParticles);

            m_jumpInMouth = new Sequence(1);
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { m_generateSouls = false; }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { JumpInMonsterMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.25f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.monster.CloseMouth(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 2.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.crowd.PushNewGuy(); }));
            m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 1.0f));
            m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.StartMainMenu(); }));
        }
Exemplo n.º 31
0
 private void Awake()
 {
     pg = GetComponent <ParticleGenerator>();
 }
Exemplo n.º 32
0
 private void OnEnable()
 {
     script = (ParticleGenerator)target;
 }
Exemplo n.º 33
0
    void Start()
    {
        standard = GameObject.Find ("StandardObject");
        sob = standard.GetComponent<StandardObject> ();

        relativeScaling = sob.getStandardScaling();
        psfx = gameObject.GetComponent<PlayerSoundFX> ();
        pg = particleGenObj.GetComponent<ParticleGenerator> ();
        peh = primEventObj.GetComponent<PrimaryEventHandler> ();
        GameObject pgdg = GameObject.Find (preservedDataName);
        if (pgdg == null) {
            pgd = null;
        } else {
            pgd = pgdg.GetComponent<PreservedGameData> ();
        }
        if (pgd != null && pgd.getSavedVolume () >= 0) {
            currentVolume = pgd.getSavedVolume ();
        } else {
            currentVolume = VolumeCalculator.newGetVolume(this.gameObject, this.type);
        }
        updateScale(false);
    }