private void Start()
    {
        _soundEvents = FindObjectOfType <SoundEvents>();
        _caps        = FindObjectOfType <Caps>();

        Draw();
    }
Exemple #2
0
 private void Start()
 {
     _soundEvents = FindObjectOfType <SoundEvents>();
     _isCollected = false;
     _caps        = FindObjectOfType <Camera>().GetComponent <Caps>();
     Destroy(gameObject, 7f);
 }
    void Start()
    {
        if (m_fIncrement == 0)
        {
            m_fIncrement = 1;
        }
        if (!m_bWarpToNextLevel)
        {
            GetObjectsAround();

            FindMaterials();
        }

        if (m_bSoundLB)
        {
            m_StartEmitter = SoundEvents.Play_EB_Emitter;

            m_StopEmitter = SoundEvents.Stop_EB_Emitter;

            m_Activation = SoundEvents.Play_EB_Activation;
        }
        else
        {
            m_StartEmitter = SoundEvents.Play_LV_Emitter;

            m_StopEmitter = SoundEvents.Stop_LV_Emitter;

            m_Activation = SoundEvents.Play_LV_Activation;
        }

        SoundManager.Instance.PlayEvent(m_StartEmitter, this.gameObject);
        m_GroundParticle = transform.FindChild("Ground").GetComponent <ParticleSystem>();

        m_Ray = transform.FindChild("GodRays").gameObject;
    }
    public void MovePieceToCell(Cell to)
    {
        TargetCell = to;
        if (!TargetCell)
        {
            transform.position = CurrentCell.gameObject.transform.position;
            return;
        }

        SoundEvents.PlayMoveSound();

        //PieceManager.PieceMoveEvent(this, CurrentCell, TargetCell);
        //SendMoveMsg(this, CurrentCell, TargetCell);
        //SendMove(this, CurrentCell, TargetCell);

        //TargetCell.RemovePiece();

        CurrentCell.currentPiece = null;

        CurrentCell = TargetCell;
        CurrentCell.currentPiece = this;

        transform.position = CurrentCell.transform.position;
        TargetCell         = null;

        PieceManager.SwitchSides();
    }
Exemple #5
0
    public void PlaySound(SoundEvents i_ID, bool allowInterrupt = false)
    {
        if (logSounds)
        {
            Debug.Log("Playing Sound: " + i_ID.ToString());
        }
        SoundEventData dataForSound;

        if (database.TryGetValue(i_ID, out dataForSound))
        {
            if (dataForSound.isEnabled && dataForSound.clips.Count > 0)
            {
                if (!allowInterrupt && audioSource.isPlaying && lastSoundPlayed == i_ID)
                {
                    return;
                }

                AudioClip clip = dataForSound.clips[Random.Range(0, dataForSound.clips.Count)];
                if (clip)
                {
                    audioSource.PlayOneShot(clip);
                    lastSoundPlayed = i_ID;
                }
            }
        }
    }
Exemple #6
0
    public void PieceMoveEvent(BasePiece piece, Cell currentCell, Cell targetCell)
    {
        var toX   = (byte)targetCell.boardPosition.x;
        var toY   = (byte)(7 - targetCell.boardPosition.y);
        var fromX = (byte)currentCell.boardPosition.x;
        var fromY = (byte)(7 - currentCell.boardPosition.y);

        if (engine.MovePiece(
                fromX, fromY, toX, toY))
        {
            var move = new EngineMove
            {
                MoveContent = engine.GetMoveHistory().ToArray()[0],
                Message     = "Ход Игрока\n"
            };

            queuedMoves.Enqueue(move);
        }
        else
        {
            SoundEvents.PlayRejectSound();
            StaticEvents.LogMsgEvent("Недопустимый ход!", LogType.Warning);
            piece.Place(board.AllCells[currentCell.boardPosition.x,
                                       currentCell.boardPosition.y]);
        }
    }
Exemple #7
0
    private void SpawnSpring()
    {
        animator.SetTrigger("Spawn");
        SoundEvents.Play("ItemDrop");
        var newSpring = Instantiate(spring, GetSpawnPosition(), spawnTransform.rotation);

        newSpring.spawn = transform;
    }
Exemple #8
0
    private void SpawnParachute()
    {
        animator.SetTrigger("Spawn");
        SoundEvents.Play("ItemDrop");
        var newParachute = Instantiate(parachute, GetSpawnPosition(), spawnTransform.rotation);

        newParachute.spawn = transform;
    }
Exemple #9
0
    /// <summary>
    /// Public method that plays the sound effect corresponding to the event that has been passed as parameter and destorys the newly created object to free memory
    /// </summary>
    /// <param name="soundEvent"></param>
    public void PlaySound(SoundEvents soundEvent)
    {
        GameObject  soundObject      = new GameObject("Sound");
        AudioSource soundAudioSource = soundObject.AddComponent <AudioSource>();

        soundAudioSource.PlayOneShot(GetAudioClip(soundEvent));

        Destroy(soundObject, 3f);
    }
Exemple #10
0
        public void PlayEvent(SoundEvents SoundEvent)
        {
            string SoundFile;

            if (SoundEffects.TryGetValue(SoundEvent, out SoundFile))
            {
                player.Play(Directory + SoundFile);
            }
        }
Exemple #11
0
        private void SaveSoundsDataEvent(SoundEvents sound, string lang, string file)
        {
            SoundsDataEvent ev = this.CreateSoundsDataEvent();

            ev.IsEnabled = true;
            ev.ID        = -1;
            ev.File      = this.CreateFileString(lang, file);
            ev.Event     = sound.ToString();
            this.Save(ev);
        }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!lever && collision.CompareTag("Character"))
     {
         lever = true;
         animator.SetBool("Switch", true);
         resetTime = TimeKeeper.GetTime() + resetDelay;
         SoundEvents.Play("Switch");
         PotatoSwitchEvents.SwitchTriggered();
     }
 }
Exemple #13
0
 /// <summary>
 /// Helper function that gets the event passed as parameter and maps a sound clip to it
 /// </summary>
 /// <param name="soundEvent"></param>
 /// <returns></returns>
 AudioClip GetAudioClip(SoundEvents soundEvent)
 {
     foreach (SoundClip soundClip in sounds)
     {
         if (soundClip.soundEvent == soundEvent)
         {
             return(soundClip.audioClip);
         }
     }
     Debug.LogError("Sound" + soundEvent + "not found");
     return(null);
 }
Exemple #14
0
 private void SpawnPotatoIfNeeded()
 {
     if (potatoesLeft > 0 && TimeKeeper.GetTime() > nextPotato)
     {
         animator.SetTrigger("Spawn");
         SoundEvents.Play("ItemDrop");
         var newPotato = Instantiate(potatoes[3 - potatoesLeft], GetSpawnPosition(), spawnTransform.rotation);
         newPotato.velocity        = new Vector2(ConveyorSpeed.GetSpeed(), 0);
         newPotato.angularVelocity = UnityEngine.Random.Range(40, 180);
         potatoesLeft--;
         nextPotato = TimeKeeper.GetTime() + timeBetweenPotatoes;
     }
 }
Exemple #15
0
    private void PromotePiece(BasePiece pawn, Cell cell, Color teamColor, Color spriteColor)
    {
        SoundEvents.PlayPromotionSound();
        pawn.Kill();

        var promotedPiece = CreatePiece(typeof(Queen));

        promotedPiece.Setup(teamColor, spriteColor, this);

        promotedPiece.Place(cell);

        promotedPieces.Add(promotedPiece);
    }
    private void Start()
    {
        _soundEvents = FindObjectOfType <SoundEvents>();
        _caps        = FindObjectOfType <Caps>();

        if (PlayerPrefs.HasKey(_name))
        {
            _level = PlayerPrefs.GetInt(_name);
            _price = _level * (int)(5.5f * _price);
        }

        Draw();
    }
 void Awake()
 {
     audioSource = GetComponent <AudioSource>();
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
    private void OnTriggerEnter2D(Collider2D collider)
    {
        var collectible = collider.gameObject.GetComponent<Collectible>();
        if (collectible != null)
        {
            stageManager.AddScore(Mathf.RoundToInt(collectible.Collect() * scoreMultiplier));
            scoreMultiplier += .2f;
            multiplier.text = $"x{scoreMultiplier:f1}";
        }

        if (collider.gameObject.CompareTag("Hazard"))
        {
            SoundEvents.Play("Death");
            stageManager.Death();
        }
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Bumper"))
        {
            SoundEvents.Play("Bumper");
            var vector = (transform.position - collision.transform.position).normalized;
            var launchVector = NearestVector(vector) * 20.0f;
            SpringLaunch(launchVector.x, launchVector.y);
        }

        if (collision.gameObject.CompareTag("Hazard"))
        {
            SoundEvents.Play("Death");
            stageManager.Death();
        }
    }
 void SwitchStates(SoundEvents events)
 {
     if (events == SoundEvents.Play_Stalk_BG)
     {
         if (m_currentState != MusicState.Health)
         {
             SetState(MusicState.Danger);
         }
     }
     else if (events == SoundEvents.Stop_Stalk_BG)
     {
         if (m_currentState != MusicState.Health)
         {
             SetState(MusicState.Idle);
         }
     }
 }
 void ControlStalkBG(GameObject owner, SoundEvents sound)
 {
     if (sound == SoundEvents.Play_Stalk_BG || sound == SoundEvents.Play_Wolf_Howling)
     {
         if (m_currentState != MusicState.Health)
         {
             SetState(MusicState.Danger);
         }
     }
     if (sound == SoundEvents.Play_Stalk_BG)
     {
         if (_stalkBGOwner != null)
         {
             PlayEvent(SoundEvents.Stop_Stalk_BG, _stalkBGOwner);
         }
         _stalkBGOwner = owner;
     }
 }
    public void PlayEvent(SoundEvents name, GameObject from)
    {
        if (name == SoundEvents.Play_Music && !musicObject)
        {
            musicObject = from;
        }

        ControlStalkBG(from, name);
        string eventName = System.Enum.GetName(typeof(SoundEvents), name);

        if (string.IsNullOrEmpty(eventName))
        {
            throw new System.ArgumentException("Name cannot be empty or null", "name");
        }
        else
        {
            uint akCode = AkSoundEngine.PostEvent(eventName, from, 1);
        }
    }
Exemple #23
0
        public static bool PlaySound(SoundEvents soundEvent)
        {
            string soundName = string.Empty;

            switch (soundEvent)
            {
            case SoundEvents.NewOrderFromMm:
                soundName = ChefmateController.Instance.CurrentSettings.NewOrderMmSound;
                break;

            case SoundEvents.CancelOrderFromMm:
                soundName = ChefmateController.Instance.CurrentSettings.CancelNoticeMmSound;
                break;

            case SoundEvents.RefundOrderFromMm:
                soundName = ChefmateController.Instance.CurrentSettings.RefundNoticeMmSound;
                break;

            case SoundEvents.TransferOrderFromMm:
                soundName = ChefmateController.Instance.CurrentSettings.TransferNoticeMmSound;
                break;

            case SoundEvents.BumpedOrderArrivedFromCm:
                soundName = ChefmateController.Instance.CurrentSettings.OrderArrivedCmSound;
                break;

            case SoundEvents.TransferOrderArrivedFromCm:
                soundName = ChefmateController.Instance.CurrentSettings.TransferOrderCmSound;
                break;

            default:
                break;
            }

            SoundPlayerUtilities.Instance.PlaySound(soundName);
            return(true);
        }
    public void SoundsEventTrigger(SoundEvents soundEvents)
    {
        switch (soundEvents)
        {
        case SoundEvents.StartingGame:
            StartingGame();
            break;

        case SoundEvents.NPCTalking:
            break;

        case SoundEvents.NPCTalkingToEmily:
            NPCTalkingToEmily();
            break;

        case SoundEvents.PickingUpItem:
            PickingUpItem();
            break;

        case SoundEvents.HidesInBathroom:
            HidesInBathroom();
            break;

        case SoundEvents.PathBlocked:
            PathBlocked();
            break;

        case SoundEvents.AnxietyLax:
            AnxietyLax();
            break;

        case SoundEvents.NPCStandingBetween:
            NPCStandingBetween();
            break;

        case SoundEvents.FireAlarm:
            FireAlarm();
            break;

        case SoundEvents.Success:
            Success();
            break;

        case SoundEvents.PassesOut:
            PassesOut();
            break;

        case SoundEvents.ArgumentBreaksOut:
            ArgumentBreaksOut();
            break;

        case SoundEvents.CardDeclined:
            CardDeclined();
            break;

        case SoundEvents.HighAnxiety:
            HighAnxiety();
            break;

        case SoundEvents.CheckingOut:
            CheckingOut();
            break;

        case SoundEvents.SeeingEx:
            SeeingEx();
            break;

        case SoundEvents.ShelfFalls:
            ShelfFalls();
            break;

        case SoundEvents.PhoneMusic:
            PhoneMusic();
            break;

        case SoundEvents.BackGroundMusic:
            break;
        }
    }
Exemple #25
0
 public void PlaySound(SoundEvents sound)
 {
     this.PlaySound(sound.ToString());
 }
 private void Start()
 {
     _soundEvents = FindObjectOfType <SoundEvents>();
     StartCoroutine(DropCap());
 }
Exemple #27
0
 public int Collect()
 {
     SoundEvents.Play("ChipCrunch");
     Destroy(gameObject);
     return(value);
 }
 // Use this for initialization
 void Start()
 {
     SoundEvents.AddSources(GetComponentsInChildren <AudioSource>());
 }
Exemple #29
0
    private static void CheckMove(Engine engine)
    {
        string msg;

        if (engine.GetWhiteCheck())
        {
            msg = "Шах белым";
            Debug.Log(msg);
            StaticEvents.LogMsgEvent(msg, LogType.Warning);
            SoundEvents.PlayCheckSound();
        }

        if (engine.GetBlackCheck())
        {
            msg = "Шах черным";
            Debug.Log(msg);
            StaticEvents.LogMsgEvent(msg, LogType.Warning);
            SoundEvents.PlayCheckSound();
        }

        if (!engine.IsGameOver())
        {
            return;
        }

        var result    = "";
        var resultPgn = PGN.Result.Ongoing;
        var state     = EndGamesStates.None;

        if (engine.StaleMate)
        {
            resultPgn = PGN.Result.Tie;
            if (engine.InsufficientMaterial)
            {
                state  = EndGamesStates.StaleMateByInsufficientMaterial;
                result = "Ничья, недостаточно материала для мата";
            }
            else if (engine.RepeatedMove)
            {
                state  = EndGamesStates.StaleMateByRepeatedMove;
                result = "Ничья после троекратного повторения";
            }
            else if (engine.FiftyMove)
            {
                state  = EndGamesStates.StaleMateByFiftyMove;
                result = "Ничья по правилу 50 ходов";
            }
            else
            {
                state  = EndGamesStates.StaleMate;
                result = "Пат";
            }

            Debug.Log(result);
            StaticEvents.LogMsgEvent(result, LogType.Warning);
            SoundEvents.PlayCheckSound();
        }

        if (engine.GetWhiteMate())
        {
            resultPgn = PGN.Result.Black;
            result    = "Шах и мат белым";
            Debug.Log(result);
            StaticEvents.LogMsgEvent(result, LogType.Warning);
            SoundEvents.PlayCheckSound();
            state = EndGamesStates.WhiteMate;
        }

        if (engine.GetBlackMate())
        {
            resultPgn = PGN.Result.White;
            result    = "Шах и мат черным";
            Debug.Log(result);
            StaticEvents.LogMsgEvent(result, LogType.Warning);
            SoundEvents.PlayCheckSound();
            state = EndGamesStates.BlackMate;
        }

        GameStatData.PGN = GeneratePNG(engine, resultPgn);

        SoundEvents.PlayVictorySound();
        msg = "Конец игры";

        StaticEvents.LogMsgEvent(msg, LogType.Exception);
        SoundEvents.PlayCheckSound();
        EndGameEvents.EndGameEvent(state, result, engine.GetScore());
    }
Exemple #30
0
    private void ProceedMove(MoveContent lastMove, string message)
    {
        if (lastMove.TakenPiece.PieceType.ToString() != "None")
        {
            var takenSrcCell = Extensions.FromPosition(lastMove.TakenPiece.Position);
            var takenPiece   = board.AllCells[takenSrcCell.x, takenSrcCell.y].currentPiece;

            if (takenPiece != null)
            {
                message += Extensions.PieceToStr(takenPiece) + " взятие ";
                takenPiece.Kill();
            }
        }

        if (lastMove.MovingPiecePrimary.PieceType.ToString() != "None")
        {
            var primarySrcCell = Extensions.FromPosition(lastMove.MovingPiecePrimary.SrcPosition);
            var primaryDstCell = Extensions.FromPosition(lastMove.MovingPiecePrimary.DstPosition);

            var piecePrimary = board.AllCells[primarySrcCell.x, primarySrcCell.y].currentPiece;
            if (piecePrimary != null)
            {
                if (lastMove.PawnPromotedTo == ChessPieceType.Queen)
                {
                    message += " Pawn повышение Queen ";
                    PromotePiece(piecePrimary as Pawn, board.AllCells[primaryDstCell.x, primaryDstCell.y],
                                 piecePrimary.mainColor,
                                 piecePrimary.mainColor == Color.black ? Colors.BlackPieces : Colors.WhitePieces);
                }
                else
                {
                    piecePrimary.MovePieceToCell(board.AllCells[primaryDstCell.x, primaryDstCell.y]);
                    SoundEvents.PlayMoveSound();
                    message += Extensions.PieceToStr(piecePrimary);
                }
            }
            else
            {
                Debug.Log("Piece not found and not created!");
            }
        }

        if (lastMove.MovingPieceSecondary.PieceType.ToString() != "None")
        {
            var secondarySrcCell = Extensions.FromPosition(lastMove.MovingPieceSecondary.SrcPosition);
            var secondaryDstCell = Extensions.FromPosition(lastMove.MovingPieceSecondary.DstPosition);
            var pieceSecondary   = board.AllCells[secondarySrcCell.x, secondarySrcCell.y].currentPiece;

            if (pieceSecondary != null)
            {
                message += " рокировка ";
                pieceSecondary.Place(board.AllCells[secondaryDstCell.x, secondaryDstCell.y]);
                SoundEvents.PlayMoveSound();
                message += Extensions.PieceToStr(pieceSecondary);
            }
            else
            {
                var msg = "pieceSecondary not found!";

                msg += " Src X " + secondarySrcCell.x + " Y " + secondarySrcCell.y;
                msg += " Dst X " + secondaryDstCell.x + " Y " + secondaryDstCell.y;
                Debug.LogError(msg);
                //StaticEvents.LogMsgEvent(msg, LogType.Exception);
            }
        }

        if (lastMove.EnPassantOccured)
        {
            message += " взятие на проходе ";
        }

        message += "\n" + lastMove.ToString();
        StaticEvents.LogMsgEvent(message, LogType.Log);
        CheckMove(engine);
        SwitchSides();
    }
 public virtual void Kill()
 {
     CurrentCell.currentPiece = null;
     SoundEvents.PlayCaptureSound();
     gameObject.SetActive(false);
 }