Exemple #1
0
        public MainMenuState(
            StateManager manager_,
            GraphicsDevice device_,
            FontManager fontManager_,
            InputController <SimpleMenu> controller_)
            : base(manager_)
        {
            menu             = new SimpleMenu(device_, fontManager_, new Vector2(512.0f, 300.0f));
            menu.OnSelected += new SimpleMenu.MenuEntryCallBack(this.OnMenuSeletection);
            controller       = controller_;

            scrollDirection = new Vector2(1.0f, 0.0f);
            scrollDistance  = 0.0f;

            emitter = new SmokeEmitter
                      (
                Manager.ParticleSystem.Content.Load <Texture2D>("particle_puff"),
                1.5f, Color.Orange, Color.DarkGray, 1.0f, 500
                      );

            Vector2 direction = new Vector2(0.0f, 1.0f);
            Vector2 position  = new Vector2(526.0f, 125.0f);

            emitter.Direction = direction;
            emitter.Position  = position;

            Manager.ParticleSystem.AddEmitter(emitter);
        }
Exemple #2
0
    public void StopTrain()
    {
        Debug.Log($"{name} stops driving");
        isDriving = false;
        SmokeEmitter smokeScript = GetComponent <SmokeEmitter>();

        if (smokeScript)
        {
            smokeScript.smokeActive = true;
        }
    }
Exemple #3
0
    private void StartTrain()
    {
        Debug.Log($"{name} starts driving");
        isDriving = true;
        SmokeEmitter smokeScript = GetComponent <SmokeEmitter>();

        if (smokeScript)
        {
            smokeScript.smokeActive = true;
        }
    }
        public StingerRocketProjectile(ICanyonShooterGame game, Vector3 startPosition, Vector3 direction, StingerRocket owner, WeaponHolderType weaponHolderType)
            : base(game, startPosition, direction, "RocketLaunch", weaponHolderType)
        {
            this.game  = game;
            this.owner = owner;
            // assign a Model
            SetModel("Stinger");

            // effect light
            light        = new PointLight(game, Color.Azure, 1.0f);
            light.Parent = this;
            game.World.AddPointLight(light);



            // rotate the projectile into the direction
            Vector3 defaultDirection = new Vector3(0, 0, -1);

            if (defaultDirection != Direction && defaultDirection != -Direction)
            {
                Direction.Normalize();
                defaultDirection.Normalize();
                Vector3 rotationAxe = Vector3.Cross(defaultDirection, Direction);
                rotationAxe.Normalize();
                float angle = (float)Math.Acos(Vector3.Dot(Direction, defaultDirection));
                LocalRotation = Quaternion.CreateFromAxisAngle(rotationAxe, angle);
            }

            // set speed and direction of the projectile:
            velocity = Direction * owner.ProjectileSpeed + owner.Velocity;
            Velocity = velocity;

            InfluencedByGravity = false;

            // create smoke effect
            SmokeEmitter = game.Effects.CreateEffect("RocketSmoke");

            // connect the smoke to the this projectile-object:
            SmokeEmitter.Parent = this;

            // place the smoke at the end of the rocket:
            SmokeEmitter.LocalPosition = new Vector3(0, 0, 3.5f);

            // add smoke to the world
            game.World.AddEffect(SmokeEmitter);

            // Loop Smoke until Destruction
            SmokeEmitter.Play();
        }
        public Bomb(EntityState es, string name, XmlParser xp)
            : base(es, name)
        {
            string path = es.Name + "->" + "Bomb";

            Name = Name + ID;

            Body = new Body(this, "Body");
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            Collision = new Collision(this, "Collision");
            Collision.CollideEvent += CollisionHandler;
            AddComponent(Collision);

            ImageRender = new ImageRender(this, "ImageRender");
            AddComponent(ImageRender);

            _explodeanim = new Animation(this, "ExplodeAnim");
            _explodeanim.LastFrameEvent += Destroy;
            AddComponent(_explodeanim);

            _explodesound = new Sound(this, "ExplodeSound");
            AddComponent(_explodesound);

            _explosionemitter = new ExplosionEmitter(this);
            AddComponent(_explosionemitter);

            _smokeemitter = new SmokeEmitter(this);
            AddComponent(_smokeemitter);

            ParseXml(xp, path);

            //TODO: Hook up Collision.CollideEvent to a handler
            _explodeanim.Origin = new Vector2(_explodeanim.TileSize.X / 2.0f, _explodeanim.TileSize.Y / 2.0f);
            ImageRender.Origin = new Vector2(ImageRender.Texture.Width / 2f, ImageRender.Texture.Height / 2f);
        }