Beispiel #1
0
        public static void Load()
        {
            _inventory = new Inventory();
            ButtonBar  = new ButtonBar();
            HotBar.Initialize();
            _minimap = new Minimap();
            _minimap.StartUpdating();

            for (var i = 1; i <= Construction.Length; i++)
            {
                Construction[i - 1] = new SoundFx("Sounds/Level Editor/construct" + i);
            }
            _destruction = new SoundFx("Sounds/Level Editor/destroy1");

            _wallMode = new SoundFx("Sounds/Level Editor/changeMode");
            _close    = new SoundFx("Sounds/Level Editor/open");
            _open     = new SoundFx("Sounds/Level Editor/close");
            _select   = new SoundFx("Sounds/Level Editor/select");


            foreach (Player player in GameWorld.GetPlayers())
            {
                player.SetPosition(player.RespawnPos);
            }

            Cursor.Show();
        }
Beispiel #2
0
    /// <summary>
    /// 特效声音的播放, 需要管理内存, 第三个参数支持循环播放声效
    /// </summary>
    /// <param name="fx">Fx.</param>
    public int SoundFxPlay(SoundFx fx, System.Action SoundFinished = null, bool loop = false)
    {
        int layer = -1;

        if (!bMute)
        {
            string fileName = getSoundFx(fx);
            if (string.IsNullOrEmpty(fileName))
            {
                ConsoleEx.DebugLog("Can't find Sound Effect. Sound Type = " + fx.ToString());
            }
            else
            {
                AudioClip clip = null;
                clip  = PrefabLoader.loadFromUnPack(AUDIO_ROOT_PATH + fileName, false, cached) as AudioClip;
                layer = Core.SoundEng.PlayClip(clip, AUDIO_EFFECT, loop);

                if (SoundFinished != null)
                {
                    AsyncTask.QueueOnMainThread(SoundFinished, clip.length);
                }

                mAudioLoader.RefAsset(AUDIO_ROOT_PATH + fileName);
            }
        }
        return(layer);
    }
Beispiel #3
0
    /// <summary>
    /// 新手引导过程播放的声音,使用完就释放
    /// </summary>
    /// <returns>The fx play.</returns>
    /// <param name="fx">Fx.</param>
    /// <param name="SoundFinished">Sound finished.</param>
    /// <param name="DefaultLayer">Default layer.</param>
    public int GuideFxPlay(SoundFx fx, System.Action SoundFinished = null, int DefaultLayer = 0x02)
    {
        int layer = -1;

        if (!bMute)
        {
            string fileName = getSoundFx(fx);
            if (string.IsNullOrEmpty(fileName))
            {
                ConsoleEx.DebugLog("Can't find Button Sound Effect. Button Type = " + fx.ToString());
            }
            else
            {
                AudioClip clip = null;
                clip  = PrefabLoader.loadFromUnPack(AUDIO_ROOT_PATH + fileName, false, cached) as AudioClip;
                layer = Core.SoundEng.PlayClipForce(clip, DefaultLayer, false, 1.0f);

                if (SoundFinished != null)
                {
                    AsyncTask.QueueOnMainThread(SoundFinished, clip.length);
                }

                clip = null;
            }
        }
        return(layer);
    }
Beispiel #4
0
        private void OnCollisionEnter(Collision other)
        {
            if (!other.collider.CompareTag("Mecha"))
            {
                return;
            }

            soulMate.GetComponent <SphereCollider>().enabled = false;
            GetComponent <SphereCollider>().enabled          = false;
            IsGlowing = true;
            soulMate.GetComponent <Creator>().IsGlowing = true;
            Instantiate(Ender, new Vector3((transform.position.x + other.transform.position.x) / 2,
                                           (transform.position.y + other.transform.position.y) / 2, 0), Quaternion.identity);
            heart = GameObject.FindWithTag("Heart");
            if (heart == null)
            {
                return;
            }

            SoundFx.Whoosh(0.5f);
            soulMate.transform.parent = heart.transform;
            transform.parent          = heart.transform;
            isEnded = true;
            soulMate.GetComponent <Creator>().isEnded = true;
        }
Beispiel #5
0
 public void PlaySound(SoundFx fx)
 {
     if ((int)fx < sources.Length)
     {
         sources[(int)fx].Play();
     }
 }
Beispiel #6
0
        public MachineGun(Tile sourceTile)
        {
            AttackBox = new Rectangle(sourceTile.DrawRectangle.X, sourceTile.DrawRectangle.Y - Main.Tilesize * 5, Main.Tilesize, Main.Tilesize * 5);
            CollRectangle = sourceTile.DrawRectangle;

            _firingSound = new SoundFx("Sounds/Machine Gun/fire",this);
        }
 public void PlayClip(SoundFx clip)
 {
     if (clip == null)
     {
         return;
     }
     if (clipTimeDic.ContainsKey(clip) == false)
     {
         clipTimeDic.Add(clip,
                         new ClipRequest {
             time = Time.time, isPlayed = false
         });
     }
     else
     {
         var   request            = clipTimeDic[clip];
         float previousPlayedTime = request.time;
         bool  isPlayed           = request.isPlayed;
         if (previousPlayedTime + clip.minGap < Time.time)
         {
             request.time     = Time.time;
             request.isPlayed = false;
         }
     }
 }
Beispiel #8
0
    void Start()
    {
        chronometerGO     = GameObject.FindObjectOfType <Chronometer>().gameObject;
        chronometerScript = chronometerGO.GetComponent <Chronometer>();

        soundFxGO     = GameObject.FindObjectOfType <SoundFx>().gameObject;
        soundFxScript = soundFxGO.GetComponent <SoundFx>();
    }
        public void PlayOneShot2D(SoundFx soundFx)
        {
            var clip = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn<PooledAudioSource>(this.transform);

            audioSource.PlayAs2DAudio();
            audioSource.PlayAndGoBackToPool(clip);
        }
        public void PlayOneShot2D(SoundFx soundFx)
        {
            var clip        = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn <PooledAudioSource>(this.transform);

            audioSource.PlayAs2DAudio();
            audioSource.PlayAndGoBackToPool(clip);
        }
Beispiel #11
0
        public Chest(Tile tile)
        {
            _openSound            = new SoundFx("Sounds/Chest/open");
            _collRectangle        = new Rectangle(tile.DrawRectangle.X, tile.DrawRectangle.Y, TMBAW_Game.Tilesize * 2, TMBAW_Game.Tilesize);
            tile.AnimationStopped = true;

            CanBeLinkedToOtherInteractables = true;
            CanBeLinkedByOtherInteractables = true;
        }
        public void PlayOneShot(SoundFx soundFx, Vector3 position)
        {
            var clip = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn<PooledAudioSource>(this.transform);

            audioSource.PlayAs3DAudio();
            audioSource.transform.position = position;
            audioSource.PlayAndGoBackToPool(clip);
        }
        public void PlayOneShot(SoundFx soundFx, Vector3 position)
        {
            var clip        = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn <PooledAudioSource>(this.transform);

            audioSource.PlayAs3DAudio();
            audioSource.transform.position = position;
            audioSource.PlayAndGoBackToPool(clip);
        }
Beispiel #14
0
 public Item()
 {
     CanTakeDamage          = false;
     OnPlayerPickUp        += SpawnSparkles;
     CollidedWithTerrain   += Item_CollidedWithTerrain;
     CollidedWithTileBelow += Item_CollidedWithTileBelow;
     BounceSound            = new SoundFx("Sounds/Items/item_pop", this);
     Weight = 70;
 }
Beispiel #15
0
 public Chest(Tile tile)
 {
     //hello
     _openSound = new SoundFx("Sounds/Chest/open");
     _collRectangle = new Rectangle(tile.DrawRectangle.X, tile.DrawRectangle.Y, Main.Tilesize * 2, Main.Tilesize);
     _sourceTile = tile;
     _sourceTile.OnTileUpdate += Update;
     _sourceTile.OnTileDestroyed += SourceTile_OnTileDestroyed;
     _sourceTile.AnimationStopped = true;
 }
Beispiel #16
0
    void PlayCollectionSounds()
    {
        SoundFx sfx = SoundFx.Instance;

        foreach (var clip in sounds)
        {
            sfx.PlayOneShot(clip);
            ZeldaHaptics.Instance.RumbleSimple_Both();
        }
    }
Beispiel #17
0
    public string getSoundFx(SoundFx fx)
    {
        string    fileName = string.Empty;
        SoundData sound    = null;

        if (soundConfig.TryGetValue((int)fx, out sound))
        {
            fileName = sound.name;
        }
        return(fileName);
    }
Beispiel #18
0
        public DialogueBox()
        {
            _container = new Container(LINE_WIDTH + BOX_PADDING * 2, 150);
            _container.ChangeStyle(Container.Style.GameUnique);
            _container.Opacity = .8f;
            _smallFont         = ContentHelper.LoadFont("Fonts/x16");
            _bigFont           = ContentHelper.LoadFont("Fonts/x32");
            _letterPopSound    = new SoundFx("Sounds/Menu/letterPop");

            GraphicsRenderer.OnResolutionChanged += SetShownAndHiddenPositions;
            SetShownAndHiddenPositions(0, 0);
        }
Beispiel #19
0
        public Hellboar(int x, int y)
        {
            CollRectangle = new Rectangle(x, y, 50 * 2, 76);
            SourceRectangle = new Rectangle(0, 0, 68, 60);
            Texture = ContentHelper.LoadTexture("Enemies/hellboar_spritesheet");

            _playerSeen = new SoundFx("Sounds/Hellboar/playerSeen", this);
            _fire = new SoundFx("Sounds/Hellboar/fire", this);
            _crash = new SoundFx("Sounds/Hellboar/crash", this);
            _breath = new SoundFx("Sounds/Hellboar/breath", this);
            _tweet = new SoundFx("Sounds/Hellboar/tweet", this);
        }
Beispiel #20
0
        private void OnTimerComplete()
        {
            if (!inhaled)
            {
                return;
            }
            SoundFx.Stop();
            SoundFx.Inhale();
            inhaled = false;

            GamepadHelper.StopVibration();
        }
Beispiel #21
0
    void Start()
    {
        gameOverScreen = GameObject.FindGameObjectWithTag("gameOver");
        gameOverScreen.SetActive(false);
        carGO         = GameObject.FindGameObjectWithTag("Player");
        soundFxGO     = GameObject.FindObjectOfType <SoundFx>().gameObject;
        soundFxScript = soundFxGO.GetComponent <SoundFx>();

        searchRoads();
        generateRoad();
        getScreenSize();
    }
Beispiel #22
0
        public CheckPoint(int x, int y)
        {
            Texture = ContentHelper.LoadTexture("Objects/checkPoint");
            SourceRectangle = new Rectangle(0, 0, 16, 48);
            CollRectangle = new Rectangle(x - 50, y - Main.Tilesize * 2, 100, DrawRectangle.Height);

            _opening = new AnimationData(32, 4, 0, AnimationType.PlayOnce);
            _animation = new Animation(Texture, DrawRectangle, SourceRectangle);

            _quack = new SoundFx("Backgrounds/Splash/quack");
            _openSound = new SoundFx("Sounds/Menu/checkPoint");
        }
Beispiel #23
0
 public void AddSoundRef(string name, string filePath)
 {
     if (_source != null)
     {
         SoundFx sound = new SoundFx(filePath, _source);
         _sounds.Add(name, sound);
     }
     else
     {
         SoundFx sound = new SoundFx(filePath);
         _sounds.Add(name, sound);
     }
 }
Beispiel #24
0
 public void AddSoundRef(string name, string location)
 {
     if (_source != null)
     {
         SoundFx sound = new SoundFx(location, _source);
         _sounds.Add(name, sound);
     }
     else
     {
         SoundFx sound = new SoundFx(location);
         _sounds.Add(name, sound);
     }
 }
        public override void OnDestroy(EventManager eventManager = null)
        {
            if (IsDisabled)
            {
                eventManager.Trigger("AppendMessage", new DefaultEvent($"{SoundFx.ThreatDestroyed()}{Name} exploded, but our stasis beam prevented damage to our ship. "));
                return;
            }

            eventManager.Trigger("AppendMessage", new DefaultEvent($"{SoundFx.ThreatDestroyed()} "));
            var eventArgs = new DamageShipEvent(Name, Damage, $"{Name} exploded");

            eventManager.Trigger("DamageShip", eventArgs);
        }
Beispiel #26
0
        public Crystal(Tile sourceTile, byte gemId)
        {
            this._gemId      = gemId;
            this._sourceTile = sourceTile;

            _collRectangle = sourceTile.DrawRectangle;

            int rand = TMBAW_Game.Random.Next(1, 9);

            _breakSound = new SoundFx("Sounds/Crystal/Glass_0" + rand, GameWorld.GetPlayers()[0]);
            Light       = new Light(new Vector2(_collRectangle.X + 16, _collRectangle.Y + 16), Gem.GetGemColor(gemId), 80);
            Initialize();
        }
Beispiel #27
0
        /// <summary>
        /// Creates new food based on enemy killed.
        /// </summary>
        /// <param name="enemy"></param>
        public Food(Enemy enemy)
        {
            CollRectangle = new Rectangle(enemy.GetCollRectangle().X, enemy.GetCollRectangle().Y, 32, 32);
            Velocity.Y    = -10f;

            _hitGround   = new SoundFx("Sounds/Items/item_pop", this);
            _pickUpSound = ContentHelper.LoadSound("Player/eatSound");

            _healAmount = 0;

            OnPlayerPickUp        += Food_OnPlayerPickUp;
            CollidedWithTileBelow += OnCollisionWithTerrainBelow;
        }
Beispiel #28
0
        public Crystal(Tile sourceTile, byte gemId)
        {
            this._gemId = gemId;
            this._sourceTile = sourceTile;

            sourceTile.OnTileDestroyed += SourceTile_OnTileDestroyed;
            sourceTile.OnTileUpdate += Update;

            _collRectangle = sourceTile.DrawRectangle;

            int rand = GameWorld.RandGen.Next(1, 9);
            _breakSound = new SoundFx("Sounds/Crystal/Glass_0" + rand, GameWorld.Instance.Player);
        }
Beispiel #29
0
        public Lost(int x, int y)
        {
            _maxVelocity = new Vector2(1, 1);

            Texture = ContentHelper.LoadTexture("Enemies/lost");
            _ghost = new SoundFx("Sounds/Lost/ghost");
            _ghost2 = new SoundFx("Sounds/Lost/ghost2");

            CollRectangle = new Rectangle(x, y, 48 - 8, 80 - 12);
            SourceRectangle = new Rectangle(0, 0, 24, 40);

            _timerEnd = GameWorld.RandGen.Next(3, 8);
        }
Beispiel #30
0
        public FallingBoulder(int x, int y)
        {
            GravityStrength = Main.Gravity ;
            Texture = GameWorld.SpriteSheet;
            _fallingSound = new SoundFx("Sounds/Boulder/boulder_fall", this);

            CollRectangle = new Rectangle(x, y, Main.Tilesize * 2, Main.Tilesize * 2);
            SourceRectangle = new Rectangle(12 * 16, 26 * 16, 32, 32);
            CurrentDamageType = DamageType.Bottom;
            IsCollidable = true;
            _originalY = DrawRectangle.Y;

            CollidedWithTileBelow += OnCollisionWithTerrainBelow;
        }
        public void LoopPlay(string id, SoundFx soundFx, Transform parent)
        {
            if (loopedAudioSources.ContainsKey(id)) return;

            var clip = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn<PooledAudioSource>(this.transform);
            loopedAudioSources.Add(id, audioSource);

            audioSource.PlayAs3DAudio();
            audioSource.transform.parent = parent;
            audioSource.transform.localPosition = Vector3.zero;

            audioSource.LoopPlay(clip);
        }
Beispiel #32
0
        /// <summary>
        ///     Displays text in dialog format to the player and lets them choose a response.
        /// </summary>
        public Dialog()
        {
            _dialogueContainer = new Container(850, 150);
            _dialogueContainer.SetPosition(TMBAW_Game.DefaultUiWidth / 2 - _dialogueContainer.Size.X / 2, 40);
            _dialogueContainer.ChangeStyle(Container.Style.GameUnique);

            _optionsContainer = new Container(850, 150);
            _optionsContainer.SetPosition(TMBAW_Game.DefaultUiWidth / 2 - _optionsContainer.Size.X / 2, TMBAW_Game.DefaultUiHeight - 200);
            _optionsContainer.ChangeStyle(Container.Style.GameUnique);

            var origin = new Vector2(_dialogueContainer.Size.X / 2f, _dialogueContainer.Size.Y / 2f);

            _font           = ContentHelper.LoadFont("Fonts/x16");
            _letterPopSound = new SoundFx("Sounds/Menu/letterPop");
        }
Beispiel #33
0
        /// <summary>
        ///     Displays text in dialog format to the player and lets them choose a response.
        /// </summary>
        public Dialog()
        {
            _dialogBoxTexture = GameWorld.SpriteSheet;
            _nonPlayerDialogBox = new Rectangle(Main.UserResWidth/2, 40, 600, 200);
            _dialogBoxSourceRectangle = new Rectangle(16*16, 14*16, 16*3, 16);

            var origin = new Vector2(_nonPlayerDialogBox.Width/2f, _nonPlayerDialogBox.Height/2f);
            _nonPlayerDialogBox.X -= (int) origin.X;

            _playerDialogBox = _nonPlayerDialogBox;
            _playerDialogBox.Y = Main.UserResHeight - 40 - _playerDialogBox.Height;

            _font = ContentHelper.LoadFont("Fonts/x24");
            _popSound = new SoundFx("Sounds/message_show");
            _letterPopSound = new SoundFx("Sounds/Menu/letterPop");
        }
        public void LoopPlay2D(string id, SoundFx soundFx)
        {
            if (loopedAudioSources.ContainsKey(id))
            {
                return;
            }

            var clip        = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn <PooledAudioSource>(this.transform);

            loopedAudioSources.Add(id, audioSource);

            audioSource.PlayAs2DAudio();

            audioSource.LoopPlay(clip);
        }
Beispiel #35
0
    IEnumerator StunCoroutine()
    {
        SoundFx sfx = SoundFx.Instance;

        sfx.PlayOneShot3D(transform.position, sfx.enemyStun);

        PauseAnimation();
        IsStunned = true;

        SendMessage("OnStun", SendMessageOptions.DontRequireReceiver);

        yield return(new WaitForSeconds(StunDuration));

        ResumeAnimation();
        IsStunned = false;
    }
Beispiel #36
0
        public SoundEmitter2D(SoundFx sound, Body body, float far, float close = 1, float panFactor = .3f)
        {
            Close = close;
            _panFactor = panFactor;
            Far = far;

            _range = far - close;

            _body = body;
            _sound = sound;

            _lowpass = new LowPassFilter();
            _sound.Filters.Add(_lowpass);

            _interp = new Interpolation(0, 1, 0, 1, Quart.EaseIn);
        }
Beispiel #37
0
    void UpdateRupeeCountAnimation()
    {
        if (_displayedRupeeCount > _targetRupeeCount)
        {
            _displayedRupeeCount--;
        }
        else if (_displayedRupeeCount < _targetRupeeCount)
        {
            _displayedRupeeCount++;
        }

        UpdateDisplayedRupeesCountText(_displayedRupeeCount);

        SoundFx sfx = SoundFx.Instance;

        sfx.PlayOneShot(sfx.text);
    }
Beispiel #38
0
        public override SkillResponse HandleSyncRequest(AlexaRequestInformation <SkillRequest> information)
        {
            var game = (Game)information.Context;

            if (!game.IsGameInProgress)
            {
                return(ResponseCreator.Ask("You can ask for more time when you're playing the game. Say new game to begin. ", "To start, say new game. ", information.SkillRequest.Session));
            }
            string message = "When ready, say Alexa to issue your next command. ";

            message += SoundFx.MoreTime();;

            string reprompt = "If you need more time, say more time. ";

            game.Message = message;

            return(ResponseCreator.Ask(game.Message, reprompt, information.SkillRequest.Session));
        }
        public void LoopPlay(string id, SoundFx soundFx, Transform parent)
        {
            if (loopedAudioSources.ContainsKey(id))
            {
                return;
            }

            var clip        = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn <PooledAudioSource>(this.transform);

            loopedAudioSources.Add(id, audioSource);

            audioSource.PlayAs3DAudio();
            audioSource.transform.parent        = parent;
            audioSource.transform.localPosition = Vector3.zero;

            audioSource.LoopPlay(clip);
        }
Beispiel #40
0
        /// <summary>
        /// Creates new food based on enemy killed.
        /// </summary>
        /// <param name="enemy"></param>
        public Food(Enemy enemy)
        {
            CollRectangle = new Rectangle(enemy.GetCollRectangle().X, enemy.GetCollRectangle().Y, 32, 32);
            Velocity.Y = -10f;

            _hitGround = new SoundFx("Sounds/Items/item_pop", this);
            _pickUpSound = ContentHelper.LoadSound("Player/eatSound");

            switch (enemy.Id)
            {
                case 201: // Snake
                    _healAmount = 10;
                    Texture = ContentHelper.LoadTexture("Objects/Food/snake_chest_v1");
                    break;
                case 202: // Frog
                    _healAmount = 5;
                    Texture = ContentHelper.LoadTexture("Objects/Food/frog_leg_v2");
                    break;
                case 204: // Lost
                    _healAmount = 10;
                    break;
                case 205: // Hellboar
                    _healAmount = 40;
                    break;
                case 207: // Bat
                    _healAmount = 10;
                    break;
                case 208: // Duck
                    _healAmount = 5;
                    break;
                case 209: // Being of Sight
                    _healAmount = 30;
                    break;
                default:
                    break;
            }

            OnPlayerPickUp += Food_OnPlayerPickUp;
            CollidedWithTileBelow += OnCollisionWithTerrainBelow;
        }
Beispiel #41
0
        public Player(Main game1)
        {
            _game1 = game1;

            script.Initialize(this);

            var edenTexture = ContentHelper.LoadTexture("Characters/adam_eden_darker");
            var idlePoop = ContentHelper.LoadTexture("Characters/adam_poop");
            var ninjaDash = ContentHelper.LoadTexture("Characters/adam_ninja");
            var fallStandTexture = ContentHelper.LoadTexture("Characters/adam_fall");
            var fightTexture = ContentHelper.LoadTexture("Characters/adam_punch");

            AttackSound = new SoundFx("Player/attackSound");

            ComplexAnim.AnimationEnded += ComplexAnim_AnimationEnded;
            ComplexAnim.AnimationStateChanged += ComplexAnim_AnimationStateChanged;
            ComplexAnim.FrameChanged += ComplexAnim_FrameChanged;

            // Animation textures.
            ComplexAnim.AddAnimationData("idle",
                new ComplexAnimData(0, edenTexture, new Rectangle(6, 7, 12, 66), 0, 24, 40, 400, 4, true));
            ComplexAnim.AddAnimationData("smellPoop",
                new ComplexAnimData(1, idlePoop, new Rectangle(6, 7, 12, 66), 0, 24, 40, 125, 21, false));
            ComplexAnim.AddAnimationData("sleep",
                new ComplexAnimData(1, edenTexture, new Rectangle(6, 7, 12, 66), 200, 24, 40, 125, 4, true));
            ComplexAnim.AddAnimationData("fightIdle",
                new ComplexAnimData(50, fightTexture, new Rectangle(6, 7, 12, 66), 40, 24, 40, 125, 4, true));
            ComplexAnim.AddAnimationData("walk",
                new ComplexAnimData(100, edenTexture, new Rectangle(6, 7, 12, 66), 40, 24, 40, 125, 4, true));
            ComplexAnim.AddAnimationData("run",
                new ComplexAnimData(150, edenTexture, new Rectangle(6, 7, 12, 66), 240, 24, 40, 125, 4, true));
            ComplexAnim.AddAnimationData("slide",
               new ComplexAnimData(153, edenTexture, new Rectangle(6, 7, 12, 66), 280, 24, 40, 125, 4, true));
            ComplexAnim.AddAnimationData("standup",
                new ComplexAnimData(155, fallStandTexture, new Rectangle(15, 7, 12, 66), 0, 45, 40, 125, 3, false));
            ComplexAnim.AddAnimationData("duck",
                new ComplexAnimData(156, fallStandTexture, new Rectangle(15, 7, 12, 66), 40, 45, 40, 125, 3, false));
            ComplexAnim.AddAnimationData("jump",
                new ComplexAnimData(200, edenTexture, new Rectangle(6, 7, 12, 66), 80, 24, 40, 125, 4, false));
            ComplexAnim.AddAnimationData("climb",
                new ComplexAnimData(900, edenTexture, new Rectangle(6, 7, 12, 66), 160, 24, 40, 125, 4, true));
            ComplexAnim.AddAnimationData("fall",
                new ComplexAnimData(1000, edenTexture, new Rectangle(6, 7, 12, 66), 120, 24, 40, 125, 4, true));
            ComplexAnim.AddAnimationData("ninjaDash",
                new ComplexAnimData(1100, ninjaDash, new Rectangle(19, 8, 12, 66), 0, 48, 40, 200, 1, false));
            ComplexAnim.AddAnimationData("punch",
                new ComplexAnimData(1110, fightTexture, new Rectangle(6, 7, 12, 66), 0, 24, 40, 75, 4, false));
            ComplexAnim.AddAnimationData("punch2",
                new ComplexAnimData(1111, fightTexture, new Rectangle(6, 7, 12, 66), 80, 24, 40, 75, 4, false));
            ComplexAnim.AddAnimationData("death",
                new ComplexAnimData(int.MaxValue, edenTexture, new Rectangle(6, 7, 12, 66), 280, 24, 40, 125, 4, true));

            // Sounds
            Sounds.AddSoundRef("hurt", "Player/hurtSound");
            Sounds.AddSoundRef("jump", "Player/jumpSound");
            Sounds.AddSoundRef("stomp", "Player/jumpSound");
            Sounds.AddSoundRef("punch", "Sounds/punch");
            Sounds.AddSoundRef("fail", "Sounds/Menu/level_fail");

            ComplexAnim.AddToQueue("idle");

            InitializeInput();
            Initialize(0, 0);

            PlayerAttacked += OnPlayerAttack;
            HasFinishedDying += OnPlayerDeath;
            HasTakenDamage += OnDamageTaken;
            HasRevived += OnPlayerRevive;
        }
Beispiel #42
0
 public Apple(int x, int y)
 {
     _collRectangle      = new Rectangle(x, y, TMBAW_Game.Tilesize, TMBAW_Game.Tilesize);
     _levelFinishedSound = new SoundFx("Sounds/Menu/level_complete");
 }
Beispiel #43
0
 public Apple(int x, int y)
 {
     _collRectangle = new Rectangle(x, y, Main.Tilesize, Main.Tilesize);
     _levelFinishedSound = new SoundFx("Sounds/Menu/level_complete");
     _levelFinishedSound.MaxVolume = .2f;
 }
Beispiel #44
0
 protected void Initialize()
 {
     Font = ContentHelper.LoadFont("Fonts/x32");
     ScrollSound = new SoundFx("Sounds/Level Editor/scroll");
 }
Beispiel #45
0
 public FlameSpitter(Tile sourceTile)
 {
     _flameSound = new SoundFx("Sounds/Flame Spitter/flame", this);
     CollRectangle = sourceTile.DrawRectangle;
 }
Beispiel #46
0
 public ObjectiveTracker()
 {
     _completeSound = new SoundFx("Sounds/Menu/quest_complete");
     _newObjective = new SoundFx("Sounds/Menu/quest_new");
     Objectives = new List<Objective>();
 }
Beispiel #47
0
 public override void OnDestroy(EventManager eventManager = null)
 {
     // trigger explosion
     eventManager.Trigger("AppendMessage", new DefaultEvent(SoundFx.ThreatDestroyed()));
 }
Beispiel #48
0
        public void Load()
        {
            _miniMap = new Minimap();
            _miniMap.StartUpdating();
            OnInventory = false;
            _tileScroll.Load();
            _tileScroll.TileSelected += TileScroll_TileSelected;

            _entityScroll.Load();
            _entityScroll.TileSelected += EntityScroll_TileSelected;

            for (int i = 1; i <= _construction.Length; i++)
            {
                _construction[i - 1] = new SoundFx("Sounds/Level Editor/construct" + i);
            }
            _destruction = new SoundFx("Sounds/Level Editor/destroy1");

            _wallMode = new SoundFx("Sounds/Level Editor/changeMode");
            _close = new SoundFx("Sounds/Level Editor/open");
            _open = new SoundFx("Sounds/Level Editor/close");
            _select = new SoundFx("Sounds/Level Editor/select");

            EditorRectangle = new Rectangle(GameWorld.Instance.WorldData.LevelWidth * Main.Tilesize / 2, GameWorld.Instance.WorldData.LevelHeight * Main.Tilesize / 2, Main.DefaultResWidth, Main.DefaultResHeight);
        }
Beispiel #49
0
        public MachineGunParticle(Entity source, int xCoor)
        {
            SourceRectangle = new Rectangle(264, 96, 8, 8);
            Texture = GameWorld.SpriteSheet;
            CollRectangle = new Rectangle(source.GetCollRectangle().X + xCoor - 4, source.GetCollRectangle().Y + 4, 8, 8);
            Position = new Vector2(CollRectangle.X, CollRectangle.Y);
            Opacity = 1f;
            Velocity.Y = -8f;
            _hitSound = new SoundFx("Sounds/Machine Gun/bulletHit",this);

            light = new DynamicPointLight(this, .05f, false, Color.White, .5f);
            GameWorld.Instance.LightEngine.AddDynamicLight(light);
        }
Beispiel #50
0
 public Item()
 {
     OnPlayerPickUp += SpawnSparkles;
     CollidedWithTerrain += Item_CollidedWithTerrain;
     BounceSound = new SoundFx("Sounds/Items/item_pop",this);
 }
Beispiel #51
0
 public SoundStateRecorder(SoundFx sound, string name)
     : base(name)
 {
     _sound = sound;
     Init();
 }
Beispiel #52
0
 /// <summary>
 /// Creates an instance of the message box that can be used to show a message to the player.
 /// </summary>
 public MessageBox()
 {
     Button = new OkButton(DrawRectangle);
     _attentionSound = new SoundFx("Sounds/message_show");
 }
Beispiel #53
0
 public override void OnSpawn(EventManager eventManager = null)
 {
     eventManager.Trigger("AppendMessage", new DefaultEvent(SoundFx.SpawnExternalThreat()));
     base.OnSpawn(eventManager);
 }
Beispiel #54
0
 public static SoundEmitter2D Attach(this Node node, Body body, SoundFx sound, float far, float close = 1, float panFactor = .3f)
 {
     return node.Add(new SoundEmitter2D(sound, body, far, close, panFactor));
 }
Beispiel #55
0
        /// Sound

        /**
         * Construct this entry.
         * @param name The name of the type.
         * @param age The maximum age for these messages.
         * @param sound The sound to play.
         */
        public NewsTypeData(string name, byte age, SoundFx sound)
        {
            this.name  = name;
            this.age   = age;
            this.sound = sound;
        }
        public void LoopPlay2D(string id, SoundFx soundFx)
        {
            if (loopedAudioSources.ContainsKey(id)) return;

            var clip = soundFxClips[soundFx];
            var audioSource = PoolManager.instance.Spawn<PooledAudioSource>(this.transform);
            loopedAudioSources.Add(id, audioSource);

            audioSource.PlayAs2DAudio();

            audioSource.LoopPlay(clip);
        }