Наследование: MonoBehaviour
Пример #1
0
    public void ToogleTrack(Sounds sound)
    {
        switch(sound)
        {
        case Sounds.KICK:
            sounds[0].mute = !sounds[0].mute;
            break;

        case Sounds.CLAP:
            sounds[1].mute = !sounds[1].mute;
            break;

        case Sounds.SNARE:
            sounds[2].mute = !sounds[2].mute;
            break;

        case Sounds.FBASS:
            sounds[3].mute = !sounds[3].mute;
            break;

        case Sounds.SYNTH:
            sounds[4].mute = !sounds[4].mute;
            break;

        case Sounds.SYNTH2:
            sounds[5].mute = !sounds[5].mute;
            break;
        }
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     health = startingHealth;
     sharkEyeAnimator = GameObject.Find ("shark_eye").GetComponent<Animator> ();
     sharkTailAnimator = GameObject.Find ("shark_body").GetComponent<Animator> ();
     sounds = GameObject.FindObjectOfType<Sounds> ();
 }
Пример #3
0
    // ----------
    public void PlaySound(Sounds sound, Vector3 emitterPos)
    {
        emitter.transform.position = emitterPos;

        switch(sound){
            case Sounds.fire:
                sourceOld.clip = fire;
                break;

            case Sounds.bgm:
                sourceOld.clip = backgroundMusic;
                break;

            case Sounds.explosion:
                int r = Random.Range(0,10);
                if(r < 5){
                    sourceOld.clip = explosion1;
                }
                else{
                    sourceOld.clip = explosion2;
                }
                break;
        }

        sourceOld.Play();
    }
Пример #4
0
		public static string GetSoundPath(Sounds sound)
		{
			switch (sound) {
				case Sounds.Won: return "Sounds/Effects/won";
				case Sounds.Lost: return "Sounds/Effects/lost";

				case Sounds.YouDied: return "Sounds/Effects/youdied";
				case Sounds.YouKilled: return "Sounds/Effects/youkilled";
				case Sounds.AllyDied: return "Sounds/Effects/allydied";
				case Sounds.EnemyDied: return "Sounds/Effects/enemydied";

				case Sounds.ManMega_1: return "Sounds/Effects/manmega_1";
				case Sounds.ManMega_2: return "Sounds/Effects/manmega_2";
				case Sounds.ManMega_3: return "Sounds/Effects/manmega_3";
				case Sounds.ManMega_4: return "Sounds/Effects/manmega_4";
				case Sounds.ManMega_Revive: return "Sounds/Effects/manmega_revive";
				case Sounds.ManMega_Death: return "Sounds/Effects/manmega_death";

				case Sounds.Zero_1: return "Sounds/Effects/zero_1";
				case Sounds.Zero_2: return "Sounds/Effects/zero_2";
				case Sounds.Zero_3: return "Sounds/Effects/zero_3";
				case Sounds.Zero_4: return "Sounds/Effects/zero_4";
				case Sounds.Zero_Revive: return "Sounds/Effects/zero_revive";
				case Sounds.Zero_Death: return "Sounds/Effects/zero_death";

				case Sounds.LeftTowerShot: return "Sounds/Effects/lefttowershot";
				case Sounds.RightTowerShot: return "Sounds/Effects/righttowershot";
				case Sounds.Explosion: return "Sounds/Effects/explosion";

				case Sounds.OpenMenu: return "Sounds/Effects/openmenu";
				case Sounds.CloseMenu: return "Sounds/Effects/closemenu";
			}

			throw new NotImplementedException();
		}
Пример #5
0
    void Start()
    {
        // Stop reorientation weirdness
        // http://answers.unity3d.com/questions/14655/unity-iphone-black-rect-when-i-turn-the-iphone
        Screen.autorotateToPortrait = false;
        Screen.autorotateToPortraitUpsideDown = false;
        Screen.autorotateToLandscapeRight = false;
        Screen.autorotateToLandscapeLeft = false;

        sounds = new Sounds(gameObject);
        sounds.Start();

        var loopTracker = new LoopTracker(sounds);

        var textLabel = new GameObject("prompt text");
        textLabel.SetActive(false);
        var text = textLabel.AddComponent<GUIText>();
        textLabel.transform.position = new Vector3(0f, 0.06f, -9.5f);
        var font = (Font) Resources.Load("sierra_agi_font/sierra_agi_font", typeof(Font));
        text.font = font;

        messageBox = new MessageBox(font);
        var prompt = new Prompt(textLabel, text).build();

        sceneManager = new SceneManager(loopTracker, new MessagePromptCoordinator(prompt, messageBox));
    }
Пример #6
0
        public static string GetResourceName(Sounds sound)
        {
            if (sound == Sounds.IncomingMessage)
                return AppData.SoundsResourcePath + "incoming-message.mp3";

            return "";
        }
Пример #7
0
    public AudioSource GetSound(Sounds sound)
    {
        switch(sound)
        {
        case Sounds.KICK:
            return sounds[0];

        case Sounds.CLAP:
            return sounds[1];

        case Sounds.SNARE:
            return sounds[2];

        case Sounds.FBASS:
            return sounds[3];

        case Sounds.SYNTH:
            return sounds[4];

        case Sounds.SYNTH2:
            return sounds[5];
        }

        return null;
    }
Пример #8
0
        internal static void Play(Sounds sound)
        {
            if (!Sounds.ContainsKey(sound))
                Sounds.Add(sound, CreateInstance(sound.ToString()));

            if (Sounds[sound] != null && Settings.SoundEnabled)
                Sounds[sound].Play();
        }
Пример #9
0
 /// <summary>
 /// Plays specified sound.
 /// </summary>
 /// <param name="sound">Sound to play</param>
 public void Play(Sounds sound)
 {
     if (inited)
     {
         sounds[sound].CurrentPosition = 0;
         sounds[sound].Play();
     }
 }
 public PushoverPriorityRule(ConditionExpression condition, Priority priority, Sounds sound, int retryIntervalSeconds, int retryPeriodSeconds)
 {
     this.Condition = condition;
     this.Priority = priority;
     this.Sound = sound;
     this.RetryIntervalSeconds = retryIntervalSeconds;
     this.RetryPeriodSeconds = retryPeriodSeconds;
 }
Пример #11
0
	void Awake () 
	{
		if (instance == null)
						instance = this;
				else if (instance != this)
						Destroy (gameObject);
		DontDestroyOnLoad (gameObject);
	}
Пример #12
0
 public void RefreshLoadout()
 {
     hissoundsyst = chara.GetComponentInChildren<Sounds>();
     gui.soundsys = hissoundsyst;
     hiscam = chara.FindChild("camhook");
     hislight = chara.GetComponentInChildren<Light>();
     cont = chara.GetComponent<CharacterController>();
     isonline = true;
 }
Пример #13
0
        public static void PlaySound(Sounds sound)
        {
            if (!Program.Settings.EnableSounds)
                return;

            Stream stream = Resources.ResourceManager.GetStream(sound.ToString().ToLower());
            SoundPlayer sp = new SoundPlayer(stream);
            sp.Play();
        }
 public void Play(Sounds soundsToPlay)
 {
     // check each enum value. If that value is set, play the sound...
     foreach (SoundBuffer buffer in sounds) {
         bool on = ((buffer.Sound & soundsToPlay) != 0);
         buffer.Play(on);
     }
     lastSound = soundsToPlay;
 }
Пример #15
0
 protected virtual void Start()
 {
     _scoreScript = GameObject.FindWithTag(Tags.UITag).GetComponent<Score>();
     _cameraShakeScript = GameObject.FindWithTag(Tags.mainCameraTag).GetComponent<CameraShake>();
     _objectPoolScript = GameObject.FindWithTag(Tags.objectPoolTag).GetComponent<ObjectPool>();
     _sounds = GameObject.FindWithTag("SoundsObject").GetComponent<Sounds>();
     source = _sounds.GetComponent<AudioSource>();
     soundDelegate = playSound;
 }
Пример #16
0
	/// Animate in the text JUGGLEBALL, then animate out after titleAnimateTime 
	public void ShowTitle() {
		sfx = GetComponent<Sounds>();
		
		titleText.gameObject.SetActive(true);
		titleText.transform.localScale = Vector3.zero;
		titleText.transform.DOScale(Vector3.one, titleAnimateTime).SetEase(Ease.OutBounce);
		Invoke("ShowSubtitle", titleAnimateTime * 0.6f);
		Invoke("HideTitles", titleDisplayTime);
		sfx.Play(sfx.tumble);
	}
Пример #17
0
    // Use this for initialization
    void Start()
    {
        // Add initial force.
        rigidbody.AddForce (0, 1250, 0);

        // This connects the missile to the speedy ship when fired.
        playerSpeedy = GameObject.Find ("Player Speedy").GetComponent < PlayerSpeedy > ();

        soundManager = Camera.main.GetComponent<Sounds>();
    }
Пример #18
0
    // Use this for initialization
    void Start()
    {
        // Add initial force.
        rigidbody.AddForce (0, 800, 0);

        // This connects the missile to the normal ship when fired.
        playerTank = GameObject.Find ("Player Tank").GetComponent < PlayerTank > ();

        soundManager = Camera.main.GetComponent<Sounds>();
    }
Пример #19
0
 //новый аудио поток площади
 public static AudioSource GetLoopSource(GameObject target, Sounds.Area sound)
 {
     AudioSource source = target.AddComponent<AudioSource>();
     AudioClip clip = Util.Audio.Get(sound);
     if (clip!=null && clip.isReadyToPlay) {
         source.clip = clip;
         source.loop = true;
         source.Play();
     }
     return source;
 }
Пример #20
0
        // load sounds on demand
        public void playSound(Sounds sound)
        {
            if (mSoundEffects[sound] != null)
                mSoundEffects[sound].Play();

            else
            {
                mSoundEffects[sound] = mCm.Load<SoundEffect>(mAssetNames[sound]).CreateInstance();
                mSoundEffects[sound].Play();
            }
        }
Пример #21
0
 /// <summary>
 /// Play the specified sound in the robot.
 /// See http://www.neatorobotics.com/programmers-manual/table-of-robot-application-commands/detailed-command-descriptions/#PlaySound for more info.
 /// </summary>
 /// <param name="flag">
 /// TODO: Sound state.
 /// </param>
 public void PlaySound(Sounds flag)
 {
     if (flag.Equals(Sounds.Stop))
     {
         this.neato.Connection.SendCommand("PlaySound STOP", true);
     }
     else
     {
         this.neato.Connection.SendCommand("PlaySound " + (int)flag, true);
     }
 }
Пример #22
0
        public Mp3Player(Sounds sound)
        {
            _resourceName = SoundsHelper.GetResourceName(sound);
            _waveOutDevice = new WaveOut();

            _waveOutDevice.PlaybackStopped += (sender, args) =>
            {
                _ms.Dispose();
                _mainOutputStream.Dispose();
            };
        }
        public SoundBuffer(Device soundDevice, string filename, Sounds thisSound, bool looping)
        {
            this.thisSound = thisSound;
            this.looping = looping;

            try {
                buffer = new SecondaryBuffer(filename, soundDevice);
            }
            catch (Exception e) {
                throw new Exception(String.Format("Error opening {0}", filename), e);
            }
        }
Пример #24
0
 void InitSounds()
 {
   s_sounds = new Sounds();
   string baseFolder = Path.Combine(Path.Combine(Application.dataPath, "WebPlayerTemplates"), "HappyFunTimes");
   string soundFolder = Path.Combine(baseFolder, "sounds");
   if (Directory.Exists(soundFolder))
   {
     AddSoundFiles(baseFolder, Directory.GetFiles(soundFolder, "*.mp3"));
     AddSoundFiles(baseFolder, Directory.GetFiles(soundFolder, "*.wav"));
     AddJSFXSounds(Directory.GetFiles(soundFolder, "*.jsfx.txt"));
   }
 }
    void AddBuffer(string filename, Sounds thisSound, bool looping, int volume)
    {
        SoundBuffer buffer;

        buffer = new SoundBuffer(
            soundDevice,
            filename,
            thisSound,
            looping);
        sounds.Add(buffer);
        buffer.Volume = volume;
    }
Пример #26
0
	void Awake() {
		thisRigidbody2D = GetComponent<Rigidbody2D>();
		thisSpriteRenderer = GetComponent<SpriteRenderer>();
		eyeControl = GetComponent<EyeControl>();
		gameMaster = GameObject.Find("SCRIPTS").GetComponent<GameMaster>();
		sfx = gameMaster.gameObject.GetComponent<Sounds>();
		
		screenBottomLeft = Camera.main.ScreenToWorldPoint(Vector3.zero);
		screenTopRight = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth, Camera.main.pixelHeight));
		
		gravityScale = thisRigidbody2D.gravityScale; // grab this so it can be reverted to when unfrozen
	}
Пример #27
0
    protected override void LoadContent()
    {
        var spriteRenderer = new SpriteRenderer(graphics, Content);
        prompt = new Prompt(spriteRenderer, Content);
        messageBox = new MessageBox(Content, spriteRenderer);
        var sounds = new Sounds();
        sceneManager = new SceneManager(new LoopTracker(sounds),
                                        new MessagePromptCoordinator(prompt, messageBox));
        var sceneFactory = new SceneFactory(sceneManager, spriteRenderer);

        // create the scene objects and preload their content
        sceneManager.LoadAndStart(sceneFactory);
    }
Пример #28
0
 // load sounds on demand
 public void playSound(Sounds sound, float volume)
 {
     if (mSoundEffects[sound] != null)
     {
         if (!mSoundEffects[sound].State.Equals(SoundState.Playing))
         {
             mSoundEffects[sound].Play();
         }
     }
     else
     {
         mSoundEffects[sound] = mCm.Load<SoundEffect>(mAssetNames[sound]).CreateInstance();
         mSoundEffects[sound].Volume = volume;
         mSoundEffects[sound].IsLooped = true;
         mSoundEffects[sound].Play();
     }
 }
    public SoundBuffer(Microsoft.DirectX.DirectSound.Device soundDevice, string filename, Sounds thisSound, bool looping)
    {
        this.thisSound = thisSound;
        this.looping = looping;

        BufferDescription bufferDesc = new BufferDescription();
        bufferDesc.Flags = BufferDescriptionFlags.ControlVolume;

        try {
            buffer = new Microsoft.DirectX.DirectSound.Buffer(
                filename,
                bufferDesc,
                soundDevice);
        }
        catch (Exception e) {
            throw new Exception(
                String.Format("Error opening {0}; ",
                filename), e);
        }
    }
Пример #30
0
	/// Can't use Start() because splash screen means the game runs behind >:(
	public void StartAfterSplashscreen () {
		UIController = GetComponent<UIControl>();
		SetupSlots();
		UIController.SetupScoreText();
		
		UIController.ShowTitle();
		string nextMethod;
		if (PlayerPrefs.GetInt("HasCompletedARound", 0) == 0) {
			// if is first run go straight into a timed round
			gameMode = Mode.Timed;
			nextMethod = "StartRound";
		} else {
			// otherwise allow the player to select timed or lives modes
			nextMethod = "ShowModeSelectScreen";
		}
		Invoke(nextMethod, UIController.titleAnimateTime * 1.5f + UIController.titleDisplayTime + gameStartDelay);
		
		sfx = GetComponent<Sounds>();
		
		LBHandler = GetComponent<LeaderboardHandler>();
	}
 /// <summary>
 /// Controls what happens on application close
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected override async void OnExit(object sender, EventArgs e)
 {
     //stop and delete the music
     Sounds.StopBackgroundMusic();
     await DiskOperations.DeleteMusicFromDisk();
 }
Пример #32
0
 private void Start()
 {
     sounds         = FindObjectOfType <Sounds>();
     gameController = FindObjectOfType <GameController>();
 }
Пример #33
0
 private void DoAutoRepair()
 {
     HostShip.Damage.FlipFaceupCritFacedown(HostShip.Damage.GetFaceupCrits().First());
     Sounds.PlayShipSound("Chewbacca");
     Triggers.FinishTrigger();
 }
Пример #34
0
 void Awake()
 {
     listener = Camera.main.GetComponent <AudioListener>();
     instance = this;
 }
Пример #35
0
 public LoopTracker(Sounds sounds)
 {
     this.sounds = sounds;
 }
Пример #36
0
 void Awake()
 {
     pewAudio = Sounds.AddAudio(gameObject, pewClip);
 }
Пример #37
0
        /// <summary>
        /// When a message is received in the room.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="id">The message Id</param>
        /// <param name="from">
        /// The from.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="receiveTime">
        /// The receive Time.
        /// </param>
        /// <param name="messageType">
        /// The message type.
        /// </param>
        private void RoomOnMessageReceived(object sender, string id, User @from, string message, DateTime receiveTime, LobbyMessageType messageType)
        {
            var theFrom    = from;
            var theMessage = message;
            var therTime   = receiveTime;
            var themType   = messageType;
            var theId      = id;

            if (string.IsNullOrWhiteSpace(theFrom.UserName))
            {
                theFrom.UserName = "******";
            }
            if (theFrom.UserName.Equals("octgn-gap", StringComparison.InvariantCultureIgnoreCase))
            {
                var cl = theMessage.IndexOf(':');
                theFrom.UserName = "******" + theMessage.Substring(0, cl) + "]";
                theMessage       = theMessage.Substring(cl + 1, theMessage.Length - cl - 1).Trim();
            }

            if (theMessage.ToLowerInvariant().Contains(Program.LobbyClient.Me.UserName.ToLowerInvariant()))
            {
                Sounds.PlayMessageSound();
            }

            Dispatcher.Invoke(
                new Action(
                    () =>
            {
                // Got mostly from http://stackoverflow.com/questions/13456441/wpf-richtextboxs-conditionally-scroll
                keepScrolledToBottom = false;

                var offset = Chat.VerticalOffset + Chat.ViewportHeight;
                // How far the scroll bar is up from the bottom
                if (Math.Abs(offset - Chat.ExtentHeight) <= 15)
                {
                    // We should auto scroll
                    keepScrolledToBottom = true;
                    this.shouldDisplayMissedMessagesBreak = false;
                    //Chat.ScrollToEnd();
                }
                else
                {
                    var contentIsLargerThatViewport = Chat.ExtentHeight > Chat.ViewportHeight;
                    // How far the scroll bar is up from the bottom
                    if (Math.Abs(Chat.VerticalOffset - 0) < 15 && contentIsLargerThatViewport)
                    {
                        // We should auto scroll
                        keepScrolledToBottom = true;
                        this.shouldDisplayMissedMessagesBreak = false;
                        //Chat.ScrollToEnd();
                    }
                    else
                    {
                        // We shouldn't auto scroll, instead show the missed message thingy
                        if (!this.shouldDisplayMissedMessagesBreak)
                        {
                            var missed = new MissedMessagesBreak();
                            ChatRowGroup.Rows.Add(missed);
                            this.shouldDisplayMissedMessagesBreak = true;
                        }
                    }
                }

                var ctr = new ChatTableRow(theFrom, theId, theMessage, therTime, themType);
                //var ctr = new ChatTableRow { User = theFrom, Message = theMessage, MessageDate = therTime, MessageType = themType };

                ctr.OnMouseUsernameEnter += ChatTableRow_MouseEnter;
                ctr.OnMouseUsernameLeave += ChatTableRow_MouseLeave;
                ChatRowGroup.Rows.Add(ctr);
                if (ChatRowGroup.Rows.Count > Prefs.MaxChatHistory)
                {
                    var remlist =
                        ChatRowGroup.Rows.Take(ChatRowGroup.Rows.Count - Prefs.MaxChatHistory).ToArray();
                    foreach (var r in remlist)
                    {
                        ChatRowGroup.Rows.Remove(r);
                    }
                }
            }));
            Dispatcher.BeginInvoke(new Action(
                                       () =>
            {
                if (keepScrolledToBottom)
                {
                    Chat.ScrollToEnd();
                }
            }));
        }
Пример #38
0
        public override float OnGettingBroken(IPlayer player, BlockSelection blockSel, ItemSlot itemslot, float remainingResistance, float dt, int counter)
        {
            if (Variant["state"] == "harvested")
            {
                dt /= 2;
            }
            else if (player.InventoryManager.ActiveTool != EnumTool.Knife)
            {
                dt /= 3;
            }
            else
            {
                float mul;
                if (itemslot.Itemstack.Collectible.MiningSpeed.TryGetValue(EnumBlockMaterial.Plant, out mul))
                {
                    dt *= mul;
                }
            }

            float resistance = RequiredMiningTier == 0 ? remainingResistance - dt : remainingResistance;

            if (counter % 5 == 0 || resistance <= 0)
            {
                double posx = blockSel.Position.X + blockSel.HitPosition.X;
                double posy = blockSel.Position.Y + blockSel.HitPosition.Y;
                double posz = blockSel.Position.Z + blockSel.HitPosition.Z;
                player.Entity.World.PlaySoundAt(resistance > 0 ? Sounds.GetHitSound(player) : Sounds.GetBreakSound(player), posx, posy, posz, player, true, 16, 1);
            }

            return(resistance);
        }
Пример #39
0
 public void AddSound(Sound sound)
 {
     Sounds.Add(sound);
 }
Пример #40
0
 public void Play(Sounds id)
 => Invoke((int)id, 0ul, 0ul);
Пример #41
0
 public override void Die()
 {
     this.Health = 0;
     this.OnUpdateTile(EntityType.Key);
     Sounds.Win();
 }
Пример #42
0
        public Hellboar(int x, int y)
        {
            Behavior = new HellboarBehavior();
            Weight   = 100;
            Behavior.Initialize(this);

            Texture = ContentHelper.LoadTexture("Enemies/hellboar");
            SetPosition(new Vector2(x, y));
            CollRectangle   = new Rectangle(0, 0, 88, 60);
            SourceRectangle = new Rectangle(0, 0, 68, 60);

            _complexAnimation.AddAnimationData("still", new ComplexAnimData()
            {
                Priority       = 1,
                Texture        = Texture,
                DeltaRectangle = new Rectangle(15 * 2, 30 * 2, CollRectangle.Width, CollRectangle.Height),
                StartingY      = 0,
                Width          = SourceRectangle.Width,
                Height         = SourceRectangle.Height,
                Speed          = 125,
                FrameCount     = 4,
                IsRepeating    = true,
            });

            _complexAnimation.AddAnimationData("walk", new ComplexAnimData()
            {
                Priority       = 10,
                Texture        = Texture,
                DeltaRectangle = new Rectangle(15 * 2, 30 * 2, CollRectangle.Width, CollRectangle.Height),
                StartingY      = SourceRectangle.Height * 1,
                Width          = SourceRectangle.Width,
                Height         = SourceRectangle.Height,
                Speed          = 125,
                FrameCount     = 4,
                IsRepeating    = true,
            });

            _complexAnimation.AddAnimationData("angry", new ComplexAnimData()
            {
                Priority       = 100,
                Texture        = Texture,
                DeltaRectangle = new Rectangle(15 * 2, 30 * 2, CollRectangle.Width, CollRectangle.Height),
                StartingY      = SourceRectangle.Height * 2,
                Width          = SourceRectangle.Width,
                Height         = SourceRectangle.Height,
                Speed          = 125,
                FrameCount     = 4,
                IsRepeating    = false,
            });

            _complexAnimation.AddAnimationData("charge", new ComplexAnimData()
            {
                Priority       = 1000,
                Texture        = Texture,
                DeltaRectangle = new Rectangle(15 * 2, 30 * 2, CollRectangle.Width, CollRectangle.Height),
                StartingY      = SourceRectangle.Height * 3,
                Width          = SourceRectangle.Width,
                Height         = SourceRectangle.Height,
                Speed          = 125,
                FrameCount     = 5,
                IsRepeating    = true,
            });


            Sounds.AddSoundRef("idle", "Sounds/Hellboar/hellboar_breath");
            Sounds.AddSoundRef("scream", "Sounds/Hellboar/hellboar_scream");
            Sounds.AddSoundRef("fire", "Sounds/Hellboar/hellboar_fire");
        }
Пример #43
0
        }     // Play(soundName)

        /// <summary>
        /// Play
        /// </summary>
        /// <param name="sound">Sound</param>
        public static void Play(Sounds sound)
        {
            Play(sound.ToString());
        } // Play(sound)
Пример #44
0
    // Update is called once per frame
    public void Play(string name)
    {
        Sounds s = Array.Find(mySounds, sounds => sounds.name == name);

        s.source.Play();
    }
Пример #45
0
    void OnMouseDown()
    {
        //check to see if it's got the required components:
        //filter
        if ((filter = GetFilter()) == null)
        {
            return;
        }
        //script
        if ((filterScript = filter.GetComponent <FilterController>()) == null)
        {
            return;
        }
        //if the filter is locked
        if (!filterScript.locked)
        {
            return;
        }
        //if there's a cup attached to the bottom
        if ((cup = GetCup()) == null)
        {
            return;
        }
        //if the cup has a script
        if ((cupScript = cup.GetComponent <CupController>()) == null)
        {
            return;
        }
        //if the cup has a lid on it
        if (cupScript.hasLid)
        {
            return;
        }
        //if it's in the middle of a pour animation already
        if (filterScript.pouring)
        {
            return;
        }
        //make sure it has coffee grounds in it
        if (!filterScript.hasGrounds)
        {
            return;
        }

        //and now enable the pour animation
        filterScript.cupScript = this.cupScript;
        filterScript.AnimatePour(sizes[cupScript.size]);
        //and change the cup contents accordingly
        if (filterScript.doubleShot)
        {
            cupScript.drink.AddEspressoShots(2);
        }
        else
        {
            cupScript.drink.AddEspressoShots(1);
        }

        Sounds.PourSound();

        //remove the espresso grounds from the filter so they have to be added again
        filterScript.RemoveGrounds();
    }
Пример #46
0
    private bool Fire()
    {
        if (cooldownTimer > 0f)
        {
            return(false);
        }
        if (RaiseTimer > 0f)
        {
            return(false);
        }
        if (HolsterTimer > 0f)
        {
            return(false);
        }
        if (UsesAmmo >= 0)
        {
            if (character.ammunition[UsesAmmo] < AmmoUseAmount)
            {
                Messaging.GUI.ScreenMessage.Invoke("OUT OF AMMO", Color.red);
                Sounds.CreateSound(EmptySound);
                cooldownTimer = .4f;
                return(false);
            }

            character.ammunition[UsesAmmo] -= AmmoUseAmount;
        }

        cooldownTimer = attackCooldown;

        Sounds.CreateSound(FireSound, transform.position);

        if (MuzzlePrefab != null)
        {
            GameObject muzzle = Instantiate(MuzzlePrefab);

            if (swap)
            {
                //muzzle.transform.rotation = _weaponPrefab1.transform.rotation * Quaternion.Euler(MuzzleRotation);
                muzzle.transform.position = _weaponPrefab1.transform.position + _weaponPrefab2.transform.TransformDirection(MuzzlePosition);
                muzzle.transform.SetParent(_weaponPrefab1.transform);
                muzzle.transform.localRotation = Quaternion.Euler(MuzzleRotation);
            }
            else
            {
                //muzzle.transform.rotation = _weaponPrefab2.transform.rotation * Quaternion.Euler(MuzzleRotation);
                muzzle.transform.position = _weaponPrefab2.transform.position + _weaponPrefab2.transform.TransformDirection(MuzzlePosition);
                muzzle.transform.SetParent(_weaponPrefab2.transform);
                muzzle.transform.localRotation = Quaternion.Euler(MuzzleRotation);
            }
        }

        if (BulletPrefab != null)
        {
            Bullet bullet = Instantiate(BulletPrefab, LevelLoader.DynamicObjects);
            bullet.owner      = character;
            bullet.Damage     = BulletDamage;
            bullet.damageType = BulletDamageType;
            bullet.LifeTime   = BulletLifeTime;
            bullet.Force      = BulletForce;
            bullet.Speed      = BulletSpeed;

            //make a special raycasting move from character to barrel
            bullet.transform.position = character.transform.position;

            if (swap)
            {
                bullet.InitialMove((_weaponPrefab1.transform.position + _weaponPrefab1.transform.rotation * BulletPosition) - character.transform.position);
            }
            else
            {
                bullet.InitialMove((_weaponPrefab2.transform.position + _weaponPrefab2.transform.rotation * BulletPosition) - character.transform.position);
            }

            if (AttackDirection == Vector2.zero)
            {
                bullet.transform.rotation = character.LookDirection;
            }
            else
            {
                bullet.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(AttackDirection.x, -AttackDirection.y) * Mathf.Rad2Deg);
            }

            //add spread
            float firstRoll  = Random.Range(-spread, spread);
            float secondRoll = Random.Range(-spread, spread);

            bullet.transform.rotation *= Quaternion.Euler(0, 0, Mathf.Abs(firstRoll) < Mathf.Abs(secondRoll) ? firstRoll : secondRoll);

            bullet.GetComponent <SaveGameObject>().SpawnName = BulletDesignation;
        }

        swap = !swap;

        OnFire.Invoke();

        return(true);
    }
Пример #47
0
 private Alarm(DateTime alarmTime, bool partOfIntervalSet, bool enabled, string message, Sounds sound,
               int intervalSetId)
 {
     AlarmTime         = alarmTime;
     PartOfIntervalSet = partOfIntervalSet;
     Enabled           = enabled;
     Message           = message;
     Sound             = sound;
     IntervalSetId     = intervalSetId;
 }
Пример #48
0
 public static void Play(this SoundTypeId self) =>
 Sounds.Play(self);
Пример #49
0
 /// <summary>Moves the air brake handle to the specified state</summary>
 /// <param name="Train">The train</param>
 /// <param name="State">The state</param>
 internal static void ApplyAirBrakeHandle(Train Train, AirBrakeHandleState State)
 {
     if (Train.Cars[Train.DriverCar].Specs.BrakeType == CarBrakeType.AutomaticAirBrake)
     {
         if (State != Train.Handles.AirBrake.Handle.Driver)
         {
             // sound when moved to service
             if (State == AirBrakeHandleState.Service)
             {
                 Sounds.SoundBuffer buffer = Train.Cars[Train.DriverCar].Sounds.Brake.Buffer;
                 if (buffer != null)
                 {
                     OpenBveApi.Math.Vector3 pos = Train.Cars[Train.DriverCar].Sounds.Brake.Position;
                     Sounds.PlaySound(buffer, 1.0, 1.0, pos, Train, Train.DriverCar, false);
                 }
             }
             // sound
             if ((int)State < (int)Train.Handles.AirBrake.Handle.Driver)
             {
                 // brake release
                 if ((int)State > 0)
                 {
                     // brake release (not min)
                     Sounds.SoundBuffer buffer = Train.Cars[Train.DriverCar].Sounds.BrakeHandleRelease.Buffer;
                     if (buffer != null)
                     {
                         OpenBveApi.Math.Vector3 pos = Train.Cars[Train.DriverCar].Sounds.BrakeHandleRelease.Position;
                         Sounds.PlaySound(buffer, 1.0, 1.0, pos, Train, Train.DriverCar, false);
                     }
                 }
                 else
                 {
                     // brake min
                     Sounds.SoundBuffer buffer = Train.Cars[Train.DriverCar].Sounds.BrakeHandleMin.Buffer;
                     if (buffer != null)
                     {
                         OpenBveApi.Math.Vector3 pos = Train.Cars[Train.DriverCar].Sounds.BrakeHandleMin.Position;
                         Sounds.PlaySound(buffer, 1.0, 1.0, pos, Train, Train.DriverCar, false);
                     }
                 }
             }
             else if ((int)State > (int)Train.Handles.AirBrake.Handle.Driver)
             {
                 // brake
                 Sounds.SoundBuffer buffer = Train.Cars[Train.DriverCar].Sounds.BrakeHandleApply.Buffer;
                 if (buffer != null)
                 {
                     OpenBveApi.Math.Vector3 pos = Train.Cars[Train.DriverCar].Sounds.BrakeHandleApply.Position;
                     Sounds.PlaySound(buffer, 1.0, 1.0, pos, Train, Train.DriverCar, false);
                 }
             }
             // apply
             Train.Handles.AirBrake.Handle.Driver = State;
             Game.AddBlackBoxEntry(Game.BlackBoxEventToken.None);
             // plugin
             if (Train.Plugin != null)
             {
                 Train.Plugin.UpdatePower();
                 Train.Plugin.UpdateBrake();
             }
         }
     }
 }
Пример #50
0
 void Awake()
 {
     lockedAudio = Sounds.AddAudio(gameObject, lockedClip);
 }
Пример #51
0
 private void DiscardCrit(GenericDamageCard critCard)
 {
     Selection.ActiveShip.Damage.FlipFaceupCritFacedown(critCard);
     Sounds.PlayShipSound("R2D2-Proud");
     ConfirmDecision();
 }
Пример #52
0
 public abstract void BizSetSoundMask(IntPtr ctx, Sounds mask);
Пример #53
0
        public Point MakeTurn(Map map, out Action doit)
        {
            Tile[,] tiles = map.tiles;
            Debug.Assert(actionsLeft > 0);
            reachableTiles = CalcReach(tilePosition, movementRange, false);
            skillReachable = CalcReach(tilePosition, skillRange + movementRange, true);
            if (currAmmo == 0)
            {
                //find tile with cover move to there
                doit = () => {
                    currAmmo = maxAmmo;
                    UsedSkill();
                    Debug.WriteLine(name + " is Reloading");
                    Map.damagePopup.Show(this, "Reloading");
                };
                return(tilePosition);
            }
            else
            {
                //Find attack or healing possibility, can not move
                List <Tuple <Actor, int> > targetPossibilities = new List <Tuple <Actor, int> >(12);

                foreach (Point p in skillReachable)
                {
                    Actor a = tiles[p.X, p.Y].actorOnTop;
                    if (a != null)
                    {
                        if (a.faction == Faction.Enemy)
                        {
                            if (a.HP == a.maxHP)
                            {
                                continue;
                            }
                        }

                        int score = int.MaxValue;

                        if (a.faction == Faction.Enemy)
                        {
                            score = (a.maxHP - a.HP) - GetCurrentHealing() / 2;
                            if (score <= 0)
                            {
                                score = 0;
                            }
                        }
                        else
                        {
                            score = a.HP - GetCurrentDamage();
                            if (score < 0)
                            {
                                score = 0;
                            }
                        }
                        targetPossibilities.Add(new Tuple <Actor, int>(a, score));
                    }
                }

                if (targetPossibilities.Count == 0)
                {
                    doit = () => { currAmmo = maxAmmo; UsedSkill(); Debug.WriteLine(name + " is Reloading and maybe random walking"); };
                    // just reload, maybe still move somewhere?
                    foreach (Point p in map.IterateNeighboursFourDir(tilePosition))
                    {
                        if (tiles[p.X, p.Y].IsWalkable() && map.random.NextDouble() <= 0.5)
                        {
                            return(p);
                        }
                    }
                    return(tilePosition);
                }
                else
                {
                    targetPossibilities.Sort((a, b) => a.Item2 - b.Item2);  //is this right? the smaller number shall be sorted first. if a.item2 is smaller than b, than its negative number, tehrefore smaller?
                    Actor target = targetPossibilities[0].Item1;

                    if (target.faction == Faction.User)
                    {
                        doit = () => { map.Attack(this, target); };
                    }
                    else
                    {
                        doit = () => {
                            target.TakeDamage(-GetCurrentHealing());
                            Sounds.Play("healing");
                            Effects.ShowEffect("healing", target.realPosition);
                            UsedSkill();
                        };
                    }

                    skillReachable = CalcReach(tilePosition, skillRange, true);
                    if (skillReachable.Contains(target.tilePosition))
                    {
                        return(tilePosition);
                    }
                    else
                    {
                        Point pos = tilePosition;

                        foreach (Point p in reachableTiles)
                        {
                            if (p != tilePosition && tiles[p.X, p.Y].IsWalkable() && (p - target.tilePosition).ToVector2().Length() <= skillRange)
                            {
                                pos            = p;
                                skillReachable = CalcReach(pos, skillRange, true);
                                break;
                            }
                        }

                        if (pos == tilePosition)
                        {
                            doit = () => { UsedSkill(); Map.damagePopup.Show(this, "Bug"); };
                        }

                        return(pos); //here find a tile from where can attack
                    }
                }
            }
        }
Пример #54
0
 // Start is called before the first frame update
 void Start()
 {
     countDown = GetComponent <Text>();
     sounds    = GetComponent <Sounds>();
     clock     = GetComponent <AudioSource>();
 }
Пример #55
0
        public void PlaySound(Sounds sound)
        {
            if (audioSource == null)
            {
                return;
            }
            AudioClip clip = null;

            switch (sound)
            {
            case Sounds.FoodPoisoning:
                clip = FoodPoisoningSound;
                break;

            case Sounds.MotivationDeath:
                clip = MotivationDeathSound;
                break;

            case Sounds.Victory:
                audioSource.Stop();
                clip = VictorySound;
                break;

            case Sounds.Bottle:
                clip = BottleSound;
                break;

            case Sounds.Drink:
                clip = DrinkSound;
                break;

            case Sounds.Eat:
                clip = EatSound;
                break;

            case Sounds.Game:
                clip = GameSound;
                break;

            case Sounds.Study:
                clip = StudySound;
                break;

            case Sounds.Vending:
                clip = VendingSound;
                break;

            case Sounds.Work:
                clip = WorkSound;
                break;

            case Sounds.PsychosisDeath:
                clip = PsychosisDeathSound;
                break;
            }

            if (clip != null)
            {
                if (audioSource.isPlaying)
                {
                    audioSource.Stop();
                }
                audioSource.PlayOneShot(clip);
            }
        }
Пример #56
0
        public static void Main(string[] args)
        {
#if !DEBUG
            MemoryControl.Start();
#endif
            FileStream fs = new FileStream("csum", FileMode.OpenOrCreate);
            fs.Close();
            string HUDLOC    = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            string lastCsums = System.IO.File.ReadAllText("csum");
            int    lastCsum  = string.IsNullOrEmpty(lastCsums) ? 0 : int.Parse(lastCsums);
#if !DEBUG
            // impossible to Run in debugger with Namecheck and Stuff
            if (System.AppDomain.CurrentDomain.FriendlyName == "PoeHUD.exe" || System.AppDomain.CurrentDomain.FriendlyName == "ExileHUD.exe" || System.AppDomain.CurrentDomain.FriendlyName == "ExileBuddy.exe")
            {
                MessageBox.Show("Please rename the HUD for your safety.");
                return;
            }
            if (HashCheck.GetCSum(HUDLOC) == 0 | HashCheck.GetCSum(HUDLOC) == lastCsum)
            {
                MessageBox.Show("Running the Scrambler for your safety. LastCsum = " + lastCsums);
                System.IO.StreamWriter store = new System.IO.StreamWriter("csum");
                store.WriteLine(HashCheck.GetCSum(HUDLOC));
                store.Close();
                if (!File.Exists("config/scrambler.txt") || (new FileInfo("config/scrambler.txt").Length == 0))
                {
                    FileStream Ccreator = new FileStream("config/scrambler.txt", FileMode.OpenOrCreate);
                    Ccreator.Close();
                }

                System.IO.StreamWriter Cwriter = new System.IO.StreamWriter("config/scrambler.txt");
                Cwriter.WriteLine(System.AppDomain.CurrentDomain.FriendlyName);
                Cwriter.Close();
                System.Diagnostics.Process.Start("Scrambler.exe", "fromHUD");
                return;
            }
            else
            {
                System.IO.StreamWriter store = new System.IO.StreamWriter("csum");
                store.WriteLine(HashCheck.GetCSum(HUDLOC));
                store.Close();
            }
#endif
            Offsets offs;
            int     pid = FindPoeProcess(out offs);

            if (pid == 0)
            {
                MessageBox.Show("Path of Exile is not running!");
                return;
            }

            Sounds.LoadSounds();

            AppDomain.CurrentDomain.UnhandledException += (sender, exceptionArgs) =>
            {
                MessageBox.Show("Program exited with message:\n " + exceptionArgs.ExceptionObject.ToString());
                Environment.Exit(1);
            };


            using (Memory memory = new Memory(offs, pid))
            {
                offs.DoPatternScans(memory);
                GameController gameController = new GameController(memory);
                gameController.RefreshState();

                Func <bool> gameEnded = () => memory.IsInvalid();
                var         overlay   = new ExternalOverlay(gameController, gameEnded);
                Application.Run(overlay);
            }
        }
Пример #57
0
 private void Start()
 {
     sfx         = FindObjectOfType <Sounds>();
     myTransform = GetComponent <Transform> ();
 }
Пример #58
0
            internal override Region ReadEntry(BinaryReaderEx br)
            {
                RegionType type = br.GetEnum32 <RegionType>(br.Position + 8);

                switch (type)
                {
                case RegionType.Region0:
                    var region0 = new Region.Region0(br);
                    Region0s.Add(region0);
                    return(region0);

                case RegionType.InvasionPoint:
                    var invasionPoint = new Region.InvasionPoint(br);
                    InvasionPoints.Add(invasionPoint);
                    return(invasionPoint);

                case RegionType.EnvironmentMapPoint:
                    var environmentMapPoint = new Region.EnvironmentMapPoint(br);
                    EnvironmentMapPoints.Add(environmentMapPoint);
                    return(environmentMapPoint);

                case RegionType.Sound:
                    var sound = new Region.Sound(br);
                    Sounds.Add(sound);
                    return(sound);

                case RegionType.SFX:
                    var sfx = new Region.SFX(br);
                    SFXs.Add(sfx);
                    return(sfx);

                case RegionType.WindSFX:
                    var windSFX = new Region.WindSFX(br);
                    WindSFXs.Add(windSFX);
                    return(windSFX);

                case RegionType.SpawnPoint:
                    var spawnPoint = new Region.SpawnPoint(br);
                    SpawnPoints.Add(spawnPoint);
                    return(spawnPoint);

                case RegionType.WalkRoute:
                    var walkRoute = new Region.WalkRoute(br);
                    WalkRoutes.Add(walkRoute);
                    return(walkRoute);

                case RegionType.WarpPoint:
                    var warpPoint = new Region.WarpPoint(br);
                    WarpPoints.Add(warpPoint);
                    return(warpPoint);

                case RegionType.ActivationArea:
                    var activationArea = new Region.ActivationArea(br);
                    ActivationAreas.Add(activationArea);
                    return(activationArea);

                case RegionType.Event:
                    var evt = new Region.Event(br);
                    Events.Add(evt);
                    return(evt);

                case RegionType.EnvironmentMapEffectBox:
                    var environmentMapEffectBox = new Region.EnvironmentMapEffectBox(br);
                    EnvironmentMapEffectBoxes.Add(environmentMapEffectBox);
                    return(environmentMapEffectBox);

                case RegionType.WindArea:
                    var windArea = new Region.WindArea(br);
                    WindAreas.Add(windArea);
                    return(windArea);

                case RegionType.MufflingBox:
                    var mufflingBox = new Region.MufflingBox(br);
                    MufflingBoxes.Add(mufflingBox);
                    return(mufflingBox);

                case RegionType.MufflingPortal:
                    var mufflingPortal = new Region.MufflingPortal(br);
                    MufflingPortals.Add(mufflingPortal);
                    return(mufflingPortal);

                case RegionType.Region23:
                    var region23 = new Region.Region23(br);
                    Region23s.Add(region23);
                    return(region23);

                case RegionType.Region24:
                    var region24 = new Region.Region24(br);
                    Region24s.Add(region24);
                    return(region24);

                case RegionType.PartsGroup:
                    var partsGroup = new Region.PartsGroup(br);
                    PartsGroups.Add(partsGroup);
                    return(partsGroup);

                case RegionType.AutoDrawGroup:
                    var autoDrawGroup = new Region.AutoDrawGroup(br);
                    AutoDrawGroups.Add(autoDrawGroup);
                    return(autoDrawGroup);

                case RegionType.Other:
                    var other = new Region.Other(br);
                    Others.Add(other);
                    return(other);

                default:
                    throw new NotImplementedException($"Unimplemented region type: {type}");
                }
            }
 private void Start()
 {
     goldenCubeScore = FindObjectOfType <GoldenCubeScore>();
     sounds          = FindObjectOfType <Sounds>();
 }
Пример #60
0
        //play a selected sound
        public void playSound(Sounds sound)
        {
            switch (sound)
            {
            case Sounds.ArrowImpact:
                playSoundFromFile(Properties.Resources.LaserShoot);
                break;

            case Sounds.ArrowMiss:
                playSoundFromFile(Properties.Resources.ArrowMiss);
                break;

            case Sounds.BatCall:
                playSoundFromFile(Properties.Resources.UfoNear);
                break;

            case Sounds.BatsInCave:
                playSoundFromFile(Properties.Resources.UfoTeleport);
                break;

            case Sounds.MonsterDie:
                playSoundFromFile(Properties.Resources.MonsterDie2);
                break;

            case Sounds.MonsterGrowl:
                playSoundFromFile(Properties.Resources.MonsterGrowl);
                break;

            case Sounds.MonsterRoar:
                playSoundFromFile(Properties.Resources.MonsterRoar2);
                break;

            case Sounds.MonsterWalk:
                playSoundFromFile(Properties.Resources.MonsterTeleport);
                break;

            case Sounds.NoError:
                playSoundFromFile(Properties.Resources.NoError2);
                break;

            case Sounds.PlayerDie:
                playSoundFromFile(Properties.Resources.PlayerDie);
                break;

            case Sounds.PlayerWalk:
                playSoundFromFile(Properties.Resources.ShipMove);
                break;

            case Sounds.ScaryScream:
                playSoundFromFile(Properties.Resources.ScaryScream2);
                break;

            case Sounds.ScarySound:
                playSoundFromFile(Properties.Resources.ScarySound3);
                break;

            case Sounds.TriviaRight:
                playSoundFromFile(Properties.Resources.TriviaRight2);
                break;

            case Sounds.TriviaWrong:
                playSoundFromFile(Properties.Resources.TriviaWrong2);
                break;

            case Sounds.MainMenu:
                playSoundFromFile(Properties.Resources.MainMenu3);
                break;

            case Sounds.BackgroundMusic:
                playSoundFromFile(Properties.Resources.BackgroundMusicRepeat);
                //change
                break;
            }
        }