コード例 #1
0
 void Awake()
 {
     btn    = GetComponent <Button>();
     hatImg = GetComponent <RawImage>();
     persistentAudioSource = FindObjectOfType <PersistentAudioSource>();
     btn.onClick.AddListener(() => persistentAudioSource.PlayEffect(buttonSound));
 }
コード例 #2
0
    void Awake()
    {
        AudioSource myAudio = GetComponent <AudioSource>();

        if (instance != null && instance != this)
        {
            // If there's a persistent audio source with a different audio clip,
            // destroy the current instance of the persistent audio source
            if (myAudio.clip != instance.GetComponent <AudioSource>().clip)
            {
                Destroy(instance.gameObject);
            }
            // Else, destroy the second instance of a persistent audio source
            // that plays the same audio clip
            else
            {
                Destroy(this.gameObject);
                return;
            }
        }

        // Overwrite the current instance of the persistent audio source
        instance = this;
        DontDestroyOnLoad(this.gameObject);
    }
コード例 #3
0
ファイル: NetworkAudio.cs プロジェクト: PijamaGames/GemFever
 private void Start()
 {
     info         = new Info();
     audioManager = GetComponent <PersistentAudioSource>();
     allObjs.Add(this);
     objsDict.Add(info.key, this);
 }
コード例 #4
0
ファイル: Minecart.cs プロジェクト: PijamaGames/GemFever
    private void Start()
    {
        audioSource    = FindObjectOfType <PersistentAudioSource>();
        comboText.text = "";

        comboString = comboText.text;
    }
コード例 #5
0
ファイル: FaceButton.cs プロジェクト: PijamaGames/GemFever
 void Awake()
 {
     btn   = GetComponent <Button>();
     face  = GetComponent <Image>();
     image = btn.GetComponentInChildren <RawImage>();
     persistentAudioSource = FindObjectOfType <PersistentAudioSource>();
     btn.onClick.AddListener(() => persistentAudioSource.PlayEffect(buttonSound));
 }
コード例 #6
0
    // Start is called before the first frame update
    void Start()
    {
        gemPool     = FindObjectOfType <GemPool>();
        audioSource = FindObjectOfType <PersistentAudioSource>();
        gemsLeft    = availableGems;

        UpdateGemColorInOre();
    }
コード例 #7
0
    // Start is called before the first frame update
    void Start()
    {
        boxColliders = GetComponents <BoxCollider>();
        audioSource  = FindObjectOfType <PersistentAudioSource>();

        androidInputs = FindObjectOfType <AndroidInputs>();

        EnableCollisions(false);
    }
コード例 #8
0
ファイル: Player.cs プロジェクト: PijamaGames/GemFever
    // Start is called before the first frame update
    void Start()
    {
        avatar = GetComponent <PlayerAvatar>();

        //Si es el jugador local
        //if(GameManager.isLocalGame || GameManager.isHost)
        androidInputs = FindObjectOfType <AndroidInputs>();

        networkPlayer = GetComponent <NetworkPlayer>();

        gameUIManager = FindObjectOfType <GameUIManager>();

        gemPool = FindObjectOfType <GemPool>();

        audioSource = FindObjectOfType <PersistentAudioSource>();

        if (!PlayerSpawnerManager.isInHub)
        {
            gameUIManager.ActivatePlayerUI(playerNumber, userInfo.id);
        }

        rb = gameObject.GetComponent <Rigidbody>();

        horizontalSpeed = startingHorizontalSpeed;
        verticalSpeed   = startingVerticalSpeed;

        maxHorizontalSpeed = startingMaxHorizontalSpeed;
        maxVerticalSpeed   = startingMaxVerticalSpeed;

        currentTier = gemPouchTiers[0];
        ChangePouchSize();

        if (!GameManager.isLocalGame)
        {
            if (GameManager.isHost)
            {
                animator.runtimeAnimatorController = hostAnimator;
            }
            else if (GameManager.isClient)
            {
                animator.runtimeAnimatorController = clientAnimator;
            }
        }

        groundMeshOrientation = playerMesh.transform.right;
    }
コード例 #9
0
ファイル: Gem.cs プロジェクト: PijamaGames/GemFever
    private void Start()
    {
        rb = GetComponent <Rigidbody>();
        if (GameManager.isClient)
        {
            rb.isKinematic = true;
            var colliders = GetComponentsInChildren <Collider>();
            foreach (var c in colliders)
            {
                c.enabled = false;
            }
        }
        gemPool     = FindObjectOfType <GemPool>();
        audioSource = FindObjectOfType <PersistentAudioSource>();
        currentTier = tiers[0];

        SpawnnForce();
    }