コード例 #1
0
ファイル: Boss13.cs プロジェクト: WHKnightZ/Unity_Hi_no_Tori
 void Update()
 {
     delayShoot -= Time.deltaTime;
     if (delayShoot < 0f)
     {
         isShooting     = true;
         delayShoot     = 1.8f;
         delayAnimation = 0.12f;
     }
     else if (isShooting)
     {
         delayAnimation -= Time.deltaTime;
         if (delayAnimation < 0f)
         {
             delayAnimation = 0.12f;
             state++;
             if (state == 2)
             {
                 Instantiate(bullet, spawnBulletPoint, Quaternion.identity);
                 SoundEffect.PlayBossShoot();
             }
             else if (state == 4)
             {
                 state      = 0;
                 isShooting = false;
             }
             spriteRenderer.sprite = sprites[state];
         }
     }
 }
コード例 #2
0
ファイル: Boss01.cs プロジェクト: WHKnightZ/Unity_Hi_no_Tori
    void Update()
    {
        delayShoot -= Time.deltaTime;
        if (delayShoot < 0f)
        {
            delayShoot = 1.8f;
            GameObject obj = Instantiate(bullet, transform.position + offsetSpawnBullet, Quaternion.identity);
            obj.GetComponent <BulletBoss01>().Init(0);
            obj = Instantiate(bullet, transform.position + offsetSpawnBullet, Quaternion.identity);
            obj.GetComponent <BulletBoss01>().Init(1);
            SoundEffect.PlayBossShoot();
        }

        if (CantMoveHon[drtHon]())
        {
            drtHon = 1 - drtHon;
            transform.localScale = vectorScale[drtHon];
        }

        velocityVer += acceleration * Time.deltaTime;
        if (CantMoveVer[drtVer]())
        {
            drtVer       = 1 - drtVer;
            acceleration = -acceleration;
        }

        rb.velocity = new Vector2(velocityHon[drtHon], velocityVer);
    }