PlayMusic() public method

public PlayMusic ( int i ) : void
i int
return void
Ejemplo n.º 1
0
 public void Catched(weasel cter)
 {
     isCatched = true;
     catcher   = cter;
     AudioControl.PlayMusic(tweet);
     if (isInList)
     {
         mom.scoreList.Remove(this.gameObject);
         isInList = false;
     }
 }
Ejemplo n.º 2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        GameObject o = collision.gameObject;

        //Debug.Log(233);
        if (this.status == WeaselStatus.prepare || this.status == WeaselStatus.lose)
        {
            if (this.status == WeaselStatus.prepare)
            {
                switch (this.direction)
                {
                case Direction.buttom:
                case Direction.top:
                    this.SetSpeed(new Vector2(this.mySpeed.x, -this.mySpeed.y));
                    break;

                case Direction.right:
                case Direction.left:
                    this.SetSpeed(new Vector2(-this.mySpeed.x, this.mySpeed.y));
                    break;
                }
            }
            if (o.tag == "chick")
            {
                this.status = WeaselStatus.get;
                getChick    = o;

                /*o.transform.parent = this.gameObject.transform;
                 * o.transform.localScale = new Vector3(1, 1, 1);
                 * o.transform.localPosition = new Vector3(
                 *  this.mySpeed.x / Mathf.Abs(this.mySpeed.x) * 1.0f,
                 *  0.4f,
                 *  0
                 * );*/
                o.SendMessage("Catched", this);
            }
        }
        if (o.tag == "mom")
        {
            this.status   = WeaselStatus.lose;
            this.getChick = null;
            AudioControl.PlayMusic(bark);
        }
    }
Ejemplo n.º 3
0
    private void OnEnable()
    {
        AudioControl.PlayMusic(bark);
        int r = Random.Range(0, 2);

        if (r == 0)
        {
            this.transform.position = new Vector3(Random.Range(-width, width), height * Mathf.Pow(-1, Random.Range(0, 2)));
        }
        else
        {
            this.transform.position = new Vector3(width * Mathf.Pow(-1, Random.Range(0, 2)), Random.Range(-height, height));
        }
        mySpeed = Vector2.zero;
        IntroTarget();
        SetSpeed();
        //this.Invoke("SetSpeed", 5);
        Debug.Log(this.status.ToString());
        this.status = WeaselStatus.prepare;
        int temp = mom.chickList.Count;
        int n    = Random.Range(0, temp);
        //Debug.Log("55555");
    }
Ejemplo n.º 4
0
    void Update()
    {
        if (Input.GetKeyDown("escape"))
        {
            audioManager.StopMusic();
            PhotonNetwork.LeaveRoom();
            // Application.LoadLevel("MainMenu");
            SceneManager.LoadScene(1);
        }

        if (Input.GetKeyDown("return") && isPlaying == false)
        {
            if (Instructions.activeSelf == true)
            {
                Instructions.SetActive(false);
            }
            else
            {
                isPlaying = true;
                SpawnPlayer();
                audioManager.PlayMusic();
            }
        }
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        switch (gameState)
        {
        case 0:
            if (Input.anyKeyDown)
            {
                gameState++;
                initEgg();
                start.SetBool("GameStart", true);
            }
            break;

        case 1:
            asi = start.GetCurrentAnimatorStateInfo(0);
            if (asi.IsName("Begin_Fade") && asi.normalizedTime >= 0.97f)
            {
                gameState++;
                start.gameObject.SetActive(false);

                this.Invoke("HerbTest", Random.Range(7.0f, 20.0f));
            }
            break;

        case 2:
            if (myMom.chickList.Count != 0 && !startCatch)
            {
                startCatch = true;
                StartCatchTest();
            }
            #region Input

            /*
             * if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.Joystick1Button0))
             * {
             *  sp.Spawn(Random.Range(0, 18) - 9, Random.Range(0, 18) - 9);
             * }
             * if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.Joystick1Button1))
             * {
             *  sp.DestroyOne();
             * }*/
            //Debug.Log(Input.GetAxis("Horizontal").ToString()+" "+ Input.GetAxis("Vertical").ToString());//移动

            float haxis = Input.GetAxis("Horizontal");
            float vaxis = Input.GetAxis("Vertical");
            if (myMom.isDashing == false)
            {
                myMom.SetSpeed(myMom.myMax * new Vector2(haxis, vaxis));
            }


            if (Input.GetKeyDown(KeyCode.Joystick1Button0) || Input.GetKeyDown(KeyCode.J))
            {
                //SpawnChick(Random.Range(-1 * gameBound.x, gameBound.x), Random.Range(-1 * gameBound.y, gameBound.y));
            }
            if (Input.GetKeyDown(KeyCode.Joystick1Button1) || Input.GetKeyDown(KeyCode.K))
            {
                if (myMom.isDashing == false)
                {
                    ac.PlayMusic(8);
                    myMom.DashSpeed();
                    myMom.isDashing = true;
                    myMom.ani.SetBool("MomRun", true);
                }
            }
            if (Input.GetKeyDown(KeyCode.Joystick1Button2) || Input.GetKeyDown(KeyCode.L))
            {
                if (herbNum > 0)
                {
                    Collider2D[] c2d = Physics2D.OverlapCircleAll(myMom.transform.position, 5);
                    foreach (Collider2D x in c2d)
                    {
                        if (x.gameObject.tag == "chick")
                        {
                            x.SendMessage("Heal");
                        }
                    }
                    herbNum--;
                }
            }
            #endregion
            break;

        case 3:
            break;
        }
    }