コード例 #1
0
    IEnumerator throwThrowable(int index)
    {
        throwable_letter = "";

        if (Mathf.Abs(horizontal) + Mathf.Abs(vertical) > 0.5f)
        {
            //set player to throw sprite
            //

            //throw
            if (throwable != null)
            {
                DestroyImmediate(throwable.gameObject);
            }

            GameObject[] throwables = GameObject.FindGameObjectsWithTag("Throwable");
            foreach (GameObject g in throwables)
            {
                Throwable t = g.GetComponent <Throwable> ();
                if (t != null && t.getKinematic())
                {
                    t.launch(throwable_angle);
                }
            }

            //start throw animation
            //

            DecreasePOTD(index);

            yield return(new WaitForSeconds(0.5f));
        }
        else
        {
            GameObject[] throwables = GameObject.FindGameObjectsWithTag("Throwable");
            foreach (GameObject g in throwables)
            {
                DestroyImmediate(g);
            }
        }
        //set player back to idle
        //

        playerHasControl = true;

        yield return(null);
    }