예제 #1
0
 private void onFired(Vector2 targetPos, bool killed)
 {
     if (m_effectPrefab)
     {
         Instantiate(m_effectPrefab, new Vector3(targetPos.x, targetPos.y, -0.02f), Quaternion.Euler(0f, 0f, Random.Range(0, 360.0f)));    //value by z is -0.02f to make the prefab seen before the ground. - Ivan K.
     }
     SoundEffectsManager.playSoundEffect(m_shootSound, Board);
 }
예제 #2
0
    private void onFired(Vector3 position)
    {
        SoundEffectsManager.playSoundEffect(m_shootSound, m_monster.Board);

        if (m_effectPrefab)
        {
            Instantiate(m_effectPrefab, position, Quaternion.identity);
        }
    }
예제 #3
0
    private void setShieldEnabled(bool bEnable)
    {
        if (bEnable != m_shieldActive)
        {
            // Can't active shield while on cooldown
            if (bEnable && m_cooldownActive)
            {
                return;
            }

            m_shieldActive = bEnable;

            if (m_shieldObject)
            {
                m_shieldObject.SetActive(m_shieldActive);
            }

            if (m_monster)
            {
                m_monster.setCanBeDamaged(!m_shieldActive);
            }

            if (m_shieldActive)
            {
                if (m_collisionRoutine == null)
                {
                    m_collisionRoutine = StartCoroutine(checkCollisionRoutine());
                }

                Invoke("onShieldExpired", m_shieldDuration);
            }

            // Play sounds
            {
                // TODO: Make a base class for monster scripts (Like TowerScripts). This would handle getting monster on awake
                // for now
                MonsterBase monster = GetComponent <MonsterBase>();
                if (monster)
                {
                    if (m_shieldActive)
                    {
                        if (m_activeSound)
                        {
                            SoundEffectsManager.playSoundEffect(m_activeSound, monster.Board);
                        }
                    }
                    else
                    {
                        if (m_deactiveSound)
                        {
                            SoundEffectsManager.playSoundEffect(m_deactiveSound, monster.Board);
                        }
                    }
                }
            }
        }
    }
예제 #4
0
    void IPunInstantiateMagicCallback.OnPhotonInstantiate(PhotonMessageInfo info)
    {
        int boardId = (int)info.photonView.InstantiationData[0];

        m_board = GameManager.manager.getBoardManager(boardId);

        m_pathIndex = (int)info.photonView.InstantiationData[1];
        updatePositionAlongPath(0f);

        // Play sound here as this gets called after Start()
        SoundEffectsManager.playSoundEffect(m_spawnSound, m_board);
    }
예제 #5
0
    public virtual void initMoster(BoardManager boardManager, int pathToFollow)
    {
        m_board = boardManager;

        m_progress  = 0f;
        m_pathIndex = pathToFollow;

        updatePositionAlongPath(0f);

        // Spawn cosmetics here as this gets called after Start()
        SoundEffectsManager.playSoundEffect(m_spawnSound, m_board);
    }
예제 #6
0
    void IPunInstantiateMagicCallback.OnPhotonInstantiate(PhotonMessageInfo info)
    {
        int playerId = (int)info.photonView.InstantiationData[0];

        m_board = GameManager.manager.getBoardManager(playerId);

        float eulerZ = (float)info.photonView.InstantiationData[1];

        setMovementDirection(new Vector3(0f, 0f, eulerZ));

        // Play here since this gets called after Start
        SoundEffectsManager.playSoundEffect(m_spawnSound, m_board);
    }
예제 #7
0
    void IPunInstantiateMagicCallback.OnPhotonInstantiate(PhotonMessageInfo info)
    {
        object[] instantiationData = info.photonView.InstantiationData;
        setOwnerId((int)instantiationData[0]);

        Vector3Int tile = (Vector3Int)instantiationData[1];

        if (m_board)
        {
            m_board.placeTower(this, tile);
            SoundEffectsManager.playSoundEffect(m_spawnSound, m_board);
        }
    }
예제 #8
0
    private void onExpired()
    {
        if (m_effectPrefab)
        {
            Instantiate(m_effectPrefab, transform.position, Quaternion.identity);
        }

        SoundEffectsManager.playSoundEffect(m_expiredSound, m_board);

        // Hide ourselves (we only want expire effect to play)
        gameObject.SetActive(false);

        // This handles case where we might not be owner
        destroySelf();
    }
예제 #9
0
    [SerializeField] private AudioClip m_sound;     // Sound to play

    void IPunInstantiateMagicCallback.OnPhotonInstantiate(PhotonMessageInfo info)
    {
        int boardId = (int)info.photonView.InstantiationData[0];

        SoundEffectsManager.playSoundEffect(m_sound, boardId);

        float lifeSpan = 0.2f;

        if (m_sound)
        {
            lifeSpan = m_sound.length;
        }

        Invoke("destroySelf", lifeSpan);
    }
예제 #10
0
    private void onHealTowers()
    {
        SoundEffectsManager.playSoundEffect(m_healPulseSound, Board);

        if (!m_healPulseSource)
        {
            return;
        }

        if (m_pulseRoutine != null)
        {
            StopCoroutine(m_pulseRoutine);
        }

        m_pulseRoutine = StartCoroutine(pulseRoutine());
    }
    private void onHealMonsterRPC(int photonId, int healthToGive)
    {
        MonsterBase monster = getMonsterFromPhotonId(photonId);

        if (!monster)
        {
            return;
        }

        if (!PhotonNetwork.IsConnected || monster.photonView.IsMine)
        {
            monster.healMonster(healthToGive);
        }

        // Play the heal sound
        SoundEffectsManager.playSoundEffect(m_healSound, m_board);
    }
예제 #12
0
    private void destroyTowerRPC(bool bulldozed)
    {
        if (bulldozed)
        {
            SoundEffectsManager.playSoundEffect(m_bulldozedSound, m_board);
        }
        else
        {
            SoundEffectsManager.playSoundEffect(m_destroyedSound, m_board);

            if (destructionParticle)
            {
                Instantiate(destructionParticle, new Vector3(transform.position.x, transform.position.y, transform.position.z - 1), transform.rotation);
            }
        }

        if (!PhotonNetwork.IsConnected || photonView.IsMine)
        {
            PhotonNetwork.Destroy(gameObject);
        }
    }
예제 #13
0
    private void goalHurtRPC(int boardId)
    {
        PlayerController controller = PlayerController.getController(boardId);

        if (!controller)
        {
            Debug.LogError("Unable to play GoalHurt sound as player who was hurt was unable to be determined");
            return;
        }

        // We play a general sound for when local player is hurt,
        // so no matter which board they are looking at they will hear the sound
        if (controller == PlayerController.localPlayer)
        {
            playGeneralSound(m_friendlyGoalHurtSound);
        }
        else // Must be remote player
        {
            SoundEffectsManager.playSoundEffect(m_enemyGoalHurtSound, boardId);
        }
    }
예제 #14
0
 private void onMonstersHit(Vector2 position)
 {
     SoundEffectsManager.playSoundEffect(m_hitSound, m_board);
 }
예제 #15
0
 protected virtual void postPhotonInstantiate(PhotonMessageInfo info)
 {
     // Play activation sound
     SoundEffectsManager.playSoundEffect(m_activateSound, m_board);
 }