コード例 #1
0
 // Bow.wav by Hanbaal at freesound.org
 // https://freesound.org/people/Hanbaal/sounds/178872/
 private void PlayBowShootSound(Ability ability, int index)
 {
     if (ability is ArrowAbility)
     {
         soundEffectsManager.PlaySound(bowShootSound);
     }
 }
コード例 #2
0
    private IEnumerator PerformTransitionLoad(int index)
    {
        sfxManager.PlaySound(transitionSound);

        transitionAnimator.SetTrigger("Out");

        float waitTime = Mathf.Max(outClip.length, transitionSound.length);

        yield return(new WaitForSecondsRealtime(waitTime + clipDurationOffset));

        SceneManager.LoadScene(index);
    }
コード例 #3
0
 private void CheckCollision()
 {
     Collider[] colliders = Physics.OverlapBox(transform.position, transform.localScale / 5);
     if (colliders.Length > 1)
     {
         for (int i = 0; i < colliders.Length; i++)
         {
             if (colliders[i].transform.name.Split(' ')[0] == "Contact" && panelIsActive && canPush)
             {
                 canPush = false;
                 SoundEffectsManager.PlaySound("buttonAnswer");
                 GM.SetPressedAnswer(Button);
                 GM.UpdateLevel();
                 animator.SetBool("pushed", true);
                 if (canPlay)
                 {
                     SoundEffectsManager.PlaySound("button");
                     canPlay = false;
                 }
                 Invoke("Reset", 1f);
                 break;
             }
         }
     }
 }
コード例 #4
0
ファイル: MovimentoBola.cs プロジェクト: slimkaki/Breakout
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.CompareTag("Player"))
        {
            // SoundEffectsManager.PlaySound("hit");
            // float dirX = Random.Range(-5.0f, 5.0f);
            float dirY = Random.Range(1.0f, 5.0f);

            float dirX = transform.position.x - col.transform.position.x;

            direcao = new Vector3(dirX * 1.5f, dirY).normalized;

            // } else if (col.gameObject.CompareTag("Parede")) {
            //     if (direcao.x > 0){
            //         direcao = new Vector3(-direcao.x, direcao.y);
            //     }
            //     if (direcao.y > 0) {
            //         direcao = new Vector3(direcao.x, -direcao.y);
            //     }
            //     if (direcao.x < 0) {
            //         direcao = new Vector3(direcao.x, -direcao.y);
            //     }
        }
        else if (col.gameObject.CompareTag("Tijolo"))
        {
            Transform newExplosion = Instantiate(explosion, transform.position, transform.rotation);
            Destroy(newExplosion.gameObject, 2.5f);
            SoundEffectsManager.PlaySound("hit2");
            direcao = new Vector3(direcao.x, -direcao.y);
            gm.pontos++;
        }
    }
コード例 #5
0
 private void CreateBondTaps(int taps)
 {
     DefineBondTypeTaps(atom1, atom2, taps);
     if (bondType != -1)
     {
         GameObject newBond = Instantiate(bond, transform.position, transform.rotation);
         AddBond(newBond);
         newBond.GetComponent <BondController> ().SetAtoms(atom1, atom2, bondType);
         newBond.transform.localScale += new Vector3(bondScale, bondScale, 0);
         newBond.transform.parent      = transform;
         atom1.transform.parent        = transform;
         atom2.transform.parent        = transform;
         bondingAtoms = false;
         lastInviBond.GetComponent <FeedbackBondController> ().DestroyBond(atom1, atom2);
         SoundEffectsManager.PlaySound("atomsBonded");
     }
     else
     {
         lastInviBond.GetComponent <FeedbackBondController> ().DestroyBond(atom1, atom2);
         SoundEffectsManager.PlaySound("bondBreak");
         bondingAtoms = false;
     }
     RemoveAllBondsNotAttached();
     bondType         = 0;
     numberOfTaps     = 0;
     lastInviBondType = 0;
 }
コード例 #6
0
    /// <summary>
    /// Try to activate an ability at a given index, or toggle aim mode if that ability is aimable.
    /// </summary>
    /// <param name="indexToActivate">The index of the ability to activate. (Z = 1, X = 2, C = 3...)</param>
    private void TryActivateAbility(int indexToActivate)
    {
        //If the player can't act or the given index is out of range, bail out.
        if (!canAct || indexToActivate < 0 || indexToActivate >= abilities.Count)
        {
            return;
        }

        //Get the ability to activate from the given index, and bail out if it has no uses left.
        Ability abilityToActivate = abilities[indexToActivate];

        if (abilityToActivate.usagesLeft <= 0)
        {
            return;
        }

        //If we're not aiming an ability already...
        if (aimingAbilityIndex < 0)
        {
            //...and this ability is aimable, start aiming this ability.
            if (abilityToActivate.isAimable)
            {
                soundEffectsManager.PlaySound(playerSoundManager.aimOnSound);
                if (aimingArrows)
                {
                    aimingArrows.SetActive(true);
                }
                aimingAbilityIndex = indexToActivate;
            }
            //Otherwise, just activate it.
            else
            {
                abilityToActivate.Activate(this);
                OnAbility?.Invoke(abilityToActivate, indexToActivate);
            }
        }
        //If we are aiming an ability, cancel aiming.
        else
        {
            soundEffectsManager.PlaySound(playerSoundManager.aimOffSound);
            if (aimingArrows)
            {
                aimingArrows.SetActive(false);
            }
            aimingAbilityIndex = -1;
        }
    }
コード例 #7
0
ファイル: LoadCapsule.cs プロジェクト: iris-rod/Tese-project
 public void OpenCapsule(GameObject mol)
 {
     animator.SetBool("open", true);
     hasMolecule = true;
     molecule    = mol;
     SoundEffectsManager.PlaySound("shelfSlidderOpen");
     Invoke("Reset", 0.5f);
 }
コード例 #8
0
ファイル: LoadCapsule.cs プロジェクト: iris-rod/Tese-project
 public void CloseCapsule()
 {
     animator.SetBool("close", true);
     hasMolecule = false;
     molecule    = null;
     SoundEffectsManager.PlaySound("shelfSlidderClose");
     Invoke("Reset", .5f);
 }
コード例 #9
0
 public void UpdateBondType(int value)
 {
     if (canUpdateTap)
     {
         numberOfTaps += value;
         SoundEffectsManager.PlaySound("atomsTouch");
         if (numberOfTaps > 3)
         {
             numberOfTaps = 1;
         }
         canUpdateTap = false;
         Invoke("ResetTap", .3f);
     }
 }
コード例 #10
0
    private IEnumerator BumpIntoCollider(Vector2 direction, float amount, float duration)
    {
        if (bumpSound)
        {
            soundEffectsManager.PlaySound(bumpSound);
        }
        Vector2 displacementVect = direction * amount;
        Vector2 originalPos      = transform.position;

        transform.position = originalPos + displacementVect;
        yield return(new WaitForSeconds(duration));

        transform.position = originalPos;
    }
コード例 #11
0
 void CheckRotate()
 {
     for (int i = 0; i < transform.childCount; i++)
     {
         Transform child = transform.GetChild(i);
         if (child.CompareTag("Interactable") && rotate)
         {
             if (rotationType == 1)
             {
                 float a = 80 * Time.deltaTime;
                 child.RotateAround(center, axis, a);
             }
             else if (rotationType == 2)
             {
                 float rotation = (handController.GetComponent <HandController>().GetHandRotation()) * rotationOffset;
                 if ((rotation > 0 && rotation < 1.3f) || (rotation < 0 && rotation > -1.3f))
                 {
                     rotation = 0;
                 }
                 child.RotateAround(center, axis, rotation);//forward
             }
             else if (rotationType == 3)
             {
                 if (!isRotating)
                 {
                     SoundEffectsManager.PlaySound("rotation");
                     SoundEffectsManager.SetLoop(true);
                 }
                 isRotating = true;
                 //UpdateValueRotation();
                 child.GetComponent <Atom>().SetRotating(true);
             }
         }
         else if (child.CompareTag("Interactable") && !rotate)
         {
             if (rotationType == 1 || rotationType == 2)
             {
                 child.RotateAround(center, axis, 0);
             }
             else
             {
                 child.GetComponent <Atom> ().SetRotating(false);
                 child.RotateAround(center, axis, 0);
                 isRotating = false;
                 SoundEffectsManager.SetLoop(false);
             }
         }
     }
 }
コード例 #12
0
ファイル: TrashBox.cs プロジェクト: iris-rod/Tese-project
 void OnTriggerEnter(Collider col)
 {
     if ((col.CompareTag("Interactable") || col.CompareTag("Pivot")) && col.transform.GetComponent <InteractionBehaviour>().isGrasped)
     {
         if (col.transform.parent == null)
         {
             Destroy(col.transform.gameObject);
         }
         else
         {
             MM.RemoveMolecule(col.transform.parent.gameObject);
             Destroy(col.transform.parent.gameObject);
         }
         SoundEffectsManager.PlaySound("throwTrash");
     }
 }
コード例 #13
0
ファイル: SaveButton.cs プロジェクト: iris-rod/Tese-project
 private void CheckCollision()
 {
     Collider[] colliders = Physics.OverlapBox(transform.position, transform.localScale / 10);
     if (colliders.Length > 1)
     {
         for (int i = 0; i < colliders.Length; i++)
         {
             if (colliders[i].transform.name.Split(' ')[0] == "Contact" && atom != null)
             {
                 transform.parent.parent.parent.GetComponent <ShelfManager>().SaveMolecule(atom);
                 Destroy(atom.transform.parent.gameObject);
                 SoundEffectsManager.PlaySound("button");
                 animator.SetBool("pushed", true);
                 Invoke("Reset", .5f);
                 break;
             }
         }
     }
 }
コード例 #14
0
    private void CheckCollision()
    {
        Collider[] colliders = Physics.OverlapBox(transform.position, transform.localScale / 10);
        if (colliders.Length > 1)
        {
            for (int i = 0; i < colliders.Length; i++)
            {
                if (colliders[i].transform.name.Split(' ')[0] == "Contact" && canPush)
                {
                    if (Scene.ToLower() == "tutorial")
                    {
                        MM.ChangeToMainMenu();
                    }
                    canPush = false;
                    animator.SetBool("pushed", true);
                    Invoke("Reset", .5f);
                    if (canPlay)
                    {
                        SoundEffectsManager.PlaySound("button");
                        canPlay = false;
                    }


                    GM.UpdateLevel();

                    /*GameObject invi = GameObject.FindGameObjectWithTag("Invisible");
                     * if (invi != null && invi.GetComponent<InvisibleMoleculeBehaviour>().HasOverlap())
                     * {
                     * canPush = false;
                     * animator.SetBool("pushed", true);
                     * invi.GetComponent<InvisibleMoleculeBehaviour>().DestroyOverlap();
                     * Destroy(invi);
                     * Invoke("Reset", .5f);
                     * }
                     */
                }
            }
        }
    }
コード例 #15
0
ファイル: Atom.cs プロジェクト: iris-rod/Tese-project
    // Update is called once per frame
    void Update()
    {
        if (numberOfBonds >= 1 || toBond)
        {
            Attach();
        }
        else
        {
            Dettach();
        }

        if (transform.parent == null || !(transform.parent.name.Split('_')[0] == "Mini"))
        {
            if (GetComponent <InteractionBehaviour>().isGrasped&& !grabbed)
            {
                highlightGrasp.SetFloat("_Outline", 0.015f);
                grabbed = true;
                SoundEffectsManager.PlaySound("atomGrabbed");
            }
            else if (!GetComponent <InteractionBehaviour>().isGrasped)
            {
                highlightGrasp.SetFloat("_Outline", 0.00f);
                grabbed = false;
                if (toBond)
                {
                    toBond = false;
                }
            }

            if (isRotating)
            {
                Rotate();
            }

            //keep away from other objects
            CheckCollisions();
        }
    }
コード例 #16
0
 private void CheckCollision()
 {
     Collider[] colliders = Physics.OverlapBox(transform.position, transform.localScale / 5);
     if (colliders.Length > 1)
     {
         for (int i = 0; i < colliders.Length; i++)
         {
             if (colliders[i].transform.name.Split(' ')[0] == "Contact" && canCheckCollision)
             {
                 BAM.ChangeRow();
                 if (canPlay)
                 {
                     SoundEffectsManager.PlaySound("button");
                     canPlay = false;
                 }
                 animator.SetBool("pushed", true);
                 Invoke("Reset", .5f);
                 canCheckCollision = false;
                 break;
             }
         }
     }
 }
コード例 #17
0
    void Update()
    {
        float dist = Vector3.Distance(ballA.position, ballB.position);

        //if it is dettaching, it only detaches after a pre-determined distance and destroys the bond object
        if (detaching)
        {
            if (dist >= distanceToDetach)
            {
                SplitMolecule.Split(transform.parent.gameObject, transform.gameObject);
                ballB.GetComponent <Atom>().RemoveBond(bondType, bondId);
                ballA.GetComponent <Atom>().RemoveBond(bondType, bondId);
                SoundEffectsManager.PlaySound("bondBreak");
                ballA.GetComponent <Atom>().StopSound();
                if (!temp)
                {
                    GM.UpdatePointSystem();
                }
                Destroy(transform.gameObject);
            }
        }
        else
        {
            MaintainDistance(dist);
        }
        Vector3 pA = ballA.position;
        Vector3 pB = ballB.position;

        transform.position = (pA + pB) / 2; // place the cube in the middle of A-B
        transform.LookAt(pB);               // make it look to ballB position
        // adjust cube length so it will have its ends at the sphere centers
        Vector3 scale = scale0;

        scale.z = scale0.z * Vector3.Distance(pA, pB) * factor;
        // stretch it in the direction it's looking
        transform.localScale = scale;
    }
コード例 #18
0
 private void OnTogglePaused()
 {
     soundEffectsManager.PlaySound(togglePauseSound);
     PauseGame?.Invoke(!isPaused);
 }
コード例 #19
0
    private void CheckCollision()
    {
        bool cleared = false;

        Collider[] colliders = Physics.OverlapBox(transform.position, transform.localScale / 5);
        if (colliders.Length > 1)
        {
            for (int i = 0; i < colliders.Length; i++)
            {
                if (colliders[i].transform.name.Split(' ')[0] == "Contact" && canPress)
                {
                    if (obj.ToLower() == "molecule")
                    {
                        GameObject[] molecules = GameObject.FindGameObjectsWithTag("Molecule");
                        for (int j = 0; j < molecules.Length; j++)
                        {
                            if (molecules[j].name.Split('_')[0] != "Mini")
                            {
                                Destroy(molecules[j]);
                            }
                        }
                        cleared = true;
                        MM.Clear();
                        GameObject[] bonds = GameObject.FindGameObjectsWithTag("Bond");
                        for (int k = 0; k < bonds.Length; k++)
                        {
                            if (bonds[k].transform.parent == null)
                            {
                                Destroy(bonds[k]);
                            }
                        }
                    }
                    else if (obj.ToLower() == "atom")
                    {
                        GameObject[] atoms = GameObject.FindGameObjectsWithTag("Interactable");
                        for (int j = 0; j < atoms.Length; j++)
                        {
                            if (atoms[j].transform.parent == null)
                            {
                                Destroy(atoms[j]);
                            }
                        }
                        cleared = true;
                    }
                    if (canPress)
                    {
                        SoundEffectsManager.PlaySound("button");
                        canPress = false;
                        if (cleared)
                        {
                            GM.RestorePartial();
                            GM.UpdatePointSystem();
                        }
                    }
                    animator.SetBool("pushed", true);
                    Invoke("Reset", .5f);
                    break;
                }
            }
        }
    }
コード例 #20
0
 // calculatorClick.wav by MAbdurrahman at freesound.org
 // https://freesound.org/people/MAbdurrahman/sounds/425187/
 public void PlayClickSound()
 {
     soundEffectsManager.PlaySound(buttonClickSound);
 }
コード例 #21
0
 public void OnSelect(BaseEventData eventData)
 {
     soundManager.PlaySound(0);
 }
コード例 #22
0
 // Button by 13F_Panska_Koprivikova_Klara at freesound.org
 // https://freesound.org/people/13F_Panska_Koprivikova_Klara/sounds/378301/
 private void PlayActivateSound()
 {
     soundEffectsManager.PlaySound(activateSound);
 }