// Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag ("MainCamera");
        ground = GameObject.FindGameObjectWithTag ("ground");
        attack = GameObject.FindGameObjectWithTag ("attack");

        hb = player.GetComponent<HealthBar> ();
        gc = ground.GetComponent<GroundControl> ();
        sc = attack.GetComponent<SpawnScript2> ();

        ball = GameObject.Find("Attack");

        image = GameObject.FindGameObjectWithTag ("image");

        pb = image.GetComponent<progressBar> ();
        anim = GetComponent<Animator> ();
    }
    private void Awake()
    {
        BGMController.Instance.ChangeBGM(SceneType.Game);

        PlayerController plCon = FindObjectOfType <PlayerController>();

        for (int i = 0; i < 5; i++)
        {
            TotalUseableMoldTimes += plCon.limit[PlayerController.stageKey, i];
        }

        /** チョコを抜くたびにプログレスバーを進める **/
        plCon.OnCutChocolate += () =>
        {
            SoundController.Instance.PlayOnShot(kurinukiSE);
            int currentTotalUseableMoldTimes = 0;
            for (int i = 0; i < 5; i++)
            {
                currentTotalUseableMoldTimes += plCon.limit[PlayerController.stageKey, i];
            }

            int alreadyUsedMoldTimes = TotalUseableMoldTimes - currentTotalUseableMoldTimes;

            float       totalUseableMoldTimesRatio = alreadyUsedMoldTimes / (float)TotalUseableMoldTimes;
            progressBar progress_bar = FindObjectOfType <progressBar>();
            progress_bar.num = totalUseableMoldTimesRatio;

            bool isGameClear = totalUseableMoldTimesRatio >= 1.0f;
            if (isGameClear)
            {
                BGMController.Instance.ChangeBGM(SceneType.Clear);
                if (OnGameClear != null)
                {
                    SaveStageClearData(0);
                    OnGameClear();
                }
            }
        };
    }
Example #3
0
 private void Start()
 {
     progress = new progressBar(StartProgressBar);
     img      = bar.GetComponent <Image>();
 }