// Update is called once per frame
    void Update()
    {
        if (!PlayerStats.canRideHelicopter)
        {
            return;
        }
        if (!isEnding)
        {
            if (magicNum > 0)
            {
                if (isWithPlayer)
                {
                    if (!ChooseIndicator().activeInHierarchy)
                    {
                        ChooseIndicator().SetActive(true);
                    }
                    if (Input.GetKeyDown(KeyCode.Space) && magicNum >= 1 && RightItem())
                    {
                        SFX.PlayFix();
                        ChooseIndicator().SetActive(false);
                        magicNum--;
                        if (magicNum > 0)
                        {
                            ChooseIndicator().SetActive(true);
                        }
                        else
                        {
                            Ending();
                        }
                    }
                }
                else
                {
                    if (ChooseIndicator().activeInHierarchy)
                    {
                        ChooseIndicator().SetActive(false);
                    }
                }
            }
        }
        else
        {
            spriteIndex++;
            if (!(spriteIndex < sprites.Length))
            {
                spriteIndex = 0;
            }
            spriteRenderer.sprite = sprites[spriteIndex];
            speed += new Vector2(acceleration * Time.deltaTime / -2, acceleration * Time.deltaTime);
            transform.Translate(speed * Time.deltaTime);

            if (transform.position.y > 10)
            {
                SceneManager.LoadScene("GameClear");
            }
        }
    }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (isWithPlayer)
     {
         if (!indicator.activeInHierarchy)
         {
             indicator.SetActive(true);
         }
         if (Input.GetKeyDown(KeyCode.Space) && PlayerStats.CheckAndUseItem(ItemType.Pincer))
         {
             SFX.PlayFix();
             PlayerStats.canRideHelicopter = true;
             Destroy(gameObject);
         }
     }
     else
     {
         if (indicator.activeInHierarchy)
         {
             indicator.SetActive(false);
         }
     }
 }