Пример #1
0
    /// <summary>
    /// sets up a disc for a new throw
    /// </summary>
    public void SetupNewDisc(Disc newDisc)
    {
        // don't setup anything new if the current disc is still active
        if (!init || (disc != null && (disc.state == Disc.DiscState.InFlight || disc.state == Disc.DiscState.InHand))) { Debug.Log("butts"); return; }

        // variables for resetting
        GameObject newDiscObj = newDisc.gameObject;

        // subscribe disc to throw
        disc = newDisc;
        disc.SubscribeToThrow(this);

        // position new disc
        newDiscObj.transform.SetParent(discParent);
        newDiscObj.transform.localPosition = Vector3.zero;
        newDiscObj.transform.localRotation = Quaternion.Euler(new Vector3(0,180,0));
        newDiscObj.transform.localScale = Vector3.one;

        powerBar.Reset();

        thrown = false;
        this.enabled = true;

        RaiseNewDisc(disc);
    }