Esempio n. 1
0
    public void destroyTiki()
    {
        OneShotSoundManager.PlayClip2D(tikiBreak, 0.5f);
        ParticleSystem deathParticles = Instantiate(tikiDebris, transform.position, Quaternion.identity);

        deathParticles.Play();
        spawnShinyObject();
        Destroy(gameObject);
    }
Esempio n. 2
0
	// Use this for initialization
	void Start () {
        rustleManager = new RepeatingSoundManager(rustlePrefab, rustleCount, minDist, transform);
        longRustleManager = new RepeatingSoundManager(longRustlePrefab, creakCount, minDist, transform);
        shortRustleManager = new RepeatingSoundManager(shortRustlePrefab, shortRustleCount, minDist, transform);
        creakManager = new OneShotSoundManager(creakPrefab, creakCount, minDist, transform);
        whaleManager = new OneShotSoundManager(whalePrefab, whaleCount, 0f, transform);
        birdManager = new OneShotSoundManager(birdPrefab, birdCount, 0f, transform);
        birdSqueakManager = new OneShotSoundManager(birdSqueakPrefab, birdSqueakCount, 0f, transform);
    }
    private void OnTriggerEnter(Collider other)
    {
        PlayerCombat playerCombat = other.gameObject.GetComponent <PlayerCombat>();

        if (playerCombat != null)
        {
            OneShotSoundManager.PlayClip2D(shinyObjectPickup, 1);
            ShinyObjectIncrease.ShinyObjectScore(sCount);
            Destroy(gameObject);
        }
    }
Esempio n. 4
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        CharactorControl ch_control = collision.GetComponent <CharactorControl>();

        if (ch_control != null)
        {
            //ch_control.Jump();
            Debug.Log("collision upper");
            Rigidbody2D body = collision.GetComponent <Rigidbody2D>();
            OneShotSoundManager.getInstance().PlayJumpPlayer(this.gameObject);
            body.velocity = new Vector2(body.velocity.x, 20.0f);
        }
    }
Esempio n. 5
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     Debug.Log("OnTrigger Enter 2D on Coin" + Time.realtimeSinceStartup);
     if (collider.gameObject.tag == "Player")
     {
         this.gameObject.SetActive(false);
         //二重に取得するのを防ぐ
         if (!is_scored)
         {
             is_scored = true;
             ScoreModel.getInstance().setAddCoinScore();
         }
         OneShotSoundManager.getInstance().PlayCoinGet(this.gameObject);
     }
 }
Esempio n. 6
0
        private void Update()
        {
            if (controller.isGrounded)
            {
                //code for side to side movement
                movementVector  = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
                movementVector  = transform.TransformDirection(movementVector);
                movementVector *= movementSpeed;

                if (Input.GetKeyDown(KeyCode.Space))
                {
                    movementVector.y = jumpSpeed * Time.deltaTime;
                    OneShotSoundManager.PlayClip2D(_jump1, 1);
                    _bubbleBurst.Play();
                }
                jumps = 0;


                if (movementVector.magnitude > 0)
                {
                    RotateAgent();
                }
            }
            else
            {
                //code for side to side movement
                movementVector    = new Vector3(Input.GetAxis("Horizontal"), movementVector.y, Input.GetAxis("Vertical"));
                movementVector    = transform.TransformDirection(movementVector);
                movementVector.x *= movementSpeed;
                movementVector.z *= movementSpeed;

                if (Input.GetKeyDown(KeyCode.Space) && jumps < 1)
                {
                    movementVector.y = jumpSpeed * Time.deltaTime;
                    OneShotSoundManager.PlayClip2D(_jump2, 1);
                    _bubbleBurst.Play();
                    jumps++;
                }

                if (movementVector.magnitude > 0)
                {
                    RotateAgent();
                }
            }
            movementVector.y -= gravity * Time.deltaTime;
            controller.Move(movementVector * Time.deltaTime);
        }
Esempio n. 7
0
    private void FixedUpdate()
    {
        // Read the inputs.
        bool crouch = Input.GetKey(KeyCode.LeftControl);

        m_Clouch = crouch;
        // float h = CrossPlatformInputManager.GetAxis("Horizontal");
        // Pass all parameters to the character control script.
        float h = m_MoveDirectionLeft ? -1.0f : 1.0f;

        if (m_Jump)
        {
            OneShotSoundManager.getInstance().PlayJumpPlayer(this.gameObject);
        }
        m_Character.Move(h, crouch, m_Jump);
        m_Jump = false;
    }
Esempio n. 8
0
    void SpinAttack()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            //to ensure we don't spin again in the middle of an attack
            if (canSpin)
            {
                isAttacking = true;
                //graphic visuals that play when SpinAttack() activates
                playerAnims.Play("SpinAttack");
                OneShotSoundManager.PlayClip2D(wandSound, 1);
                enableWandVisuals();
                StartCoroutine(disableWandVisuals());
                canSpin = false;
                StartCoroutine(resetSpin());
                StartCoroutine(stopSpinAttack());
            }
        }

        if (isAttacking == true)
        {
            Collider[] hitEnemies = Physics.OverlapSphere(_spinAttackPoint.position, _spinAttackRange, _enemyLayers);
            //_spinAttackPoint.transform.RotateAround(_spinAxis.transform.position, Vector3.up, 510 * Time.deltaTime);

            //damage enemies
            foreach (Collider enemy in hitEnemies)
            {
                Tiki _tiki = enemy.GetComponent <Tiki>();
                if (_tiki != null)
                {
                    _tiki.destroyTiki();
                    StartCoroutine(cameraShake.Shake(.05f, .2f));
                }
            }
        }
    }
Esempio n. 9
0
 public void playSound()
 {
     OneShotSoundManager.playSoundAtLocation(sound, transform.position);
 }
Esempio n. 10
0
 void GameMusic()
 {
     OneShotSoundManager.PlayClip2D(_gameMusic, 1, true);
 }
Esempio n. 11
0
 // Use this for initialization
 void Start()
 {
     m_audioSource = gameObject.GetComponent <AudioSource>();
     __instance    = this;
 }