Пример #1
0
    // Initialize the circular timer (forced shot timeout) and the
    // ShotChargeIndicator -- these are the little circular dials that show
    // up when a player possesses the ball, and when a player charges their
    // shot (respectively).
    private void InitializeCircularIndicators(TeamManager team = null)
    {
        // Need to destroy preexisting objects (e.g. if selecting teams, and
        // then switching team)
        if (shotChargeIndicator != null)
        {
            Destroy(shotChargeIndicator);
        }
        if (circularTimer != null)
        {
            Destroy(circularTimer);
        }

        // Circular timer
        GameObject circularTimerPrefab = GameManager.instance.neutralResources.circularTimerPrefab;

        circularTimer = Instantiate(
            circularTimerPrefab, transform).GetComponent <CircularTimer>();

        // ShotCharge indicator
        GameObject shotChargeIndicatorPrefab = GameManager.instance.neutralResources.shotChargeIndicatorPrefab;

        shotChargeIndicator = Instantiate(
            shotChargeIndicatorPrefab, transform).GetComponent <ShotChargeIndicator>();

        // REMARK: See comment below ("[Krista fri 4/13] I found this little
        // gem...") for an explanation of why we need to set minFillAmount and
        // maxFillAmount like this
        shotChargeIndicator.minFillAmount = baseShotSpeed;
        shotChargeIndicator.maxFillAmount = maxShotSpeed;
    }