コード例 #1
0
    IEnumerator BattleChange()
    {
        m_ChangeCounter = m_BattleChangeSpeed;
        while (m_ChangeCounter > 0)
        {
            yield return(new WaitForSeconds(1.0f));

            m_ChangeCounter--;
        }
        s_State = SecondBossState.Battle;
    }
コード例 #2
0
 //ダメージコンポーネントのダメージ
 private void Damage(float damage, MonoBehaviour src)
 {
     HitPoint -= damage;
     if (HitPoint <= 0)
     {
         s_State = SecondBossState.Paralysis;
         //Instantiate(m_LastExplosion, transform.position, transform.rotation);
         //Pauser.Pause(PauseTag.Enemy);
         //GameManager.Instance.m_PlayMode = PlayMode.NoPlay;
         StartCoroutine(this.Delay(new WaitForSeconds(4.0f), Dead));
     }
 }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     m_Target    = GameManager.Instance.m_LRobot;
     m_Sound     = GetComponent <AudioSource>();
     m_Anim      = GetComponentInChildren <Animator>();
     s_State     = SecondBossState.Ready;
     m_Collision = GetComponent <Collider>();
     foreach (GameObject p in m_Particle)
     {
         p.SetActive(false);
     }
 }
コード例 #4
0
    IEnumerator Recover()
    {
        m_RecoverCounter = m_RecoverSpeed;
        while (m_RecoverCounter > 0)
        {
            yield return(new WaitForSeconds(1.0f));

            m_RecoverCounter--;
        }
        if (s_State != SecondBossState.Invincible)
        {
            s_State = SecondBossState.Invincible;
        }
    }
コード例 #5
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.tag == "Wall" && s_State == SecondBossState.Battle)
     {
         if (m_Sound.clip != m_CollideSound)
         {
             m_Sound.clip = m_CollideSound;
             m_Sound.loop = false;
             m_Sound.Play();
         }
         Instantiate(m_Explosion, transform.position, transform.rotation);
         if (m_RecoverCounter <= 0)
         {
             StartCoroutine(Recover());
         }
         s_State = SecondBossState.Paralysis;
     }
     if (other.gameObject.tag == "Enemy" && m_Reload)
     {
         m_AmmoCount++;
         other.gameObject.GetComponent <EnemyBase>().SetBreak();
     }
 }
コード例 #6
0
    // Update is called once per frame
    void Update()
    {
        //if (Input.GetKeyDown(KeyCode.S))
        //{
        //    m_Sound.clip = m_MoveSound;
        //    m_Sound.Play();
        //}
        if (HitPoint <= 0)
        {
            s_State = SecondBossState.Paralysis;
            //m_Sound.Stop();
            StartCoroutine(Death());
        }
        if (m_Velocity.magnitude < m_MoveSpeed)
        {
            m_Velocity += transform.forward * m_Accel * Time.deltaTime;
        }
        m_Velocity *= 0.95f;

        //m_HitPointBar.fillAmount = s_HitPoint;
        switch (GameManager.Instance.m_PlayMode)
        {
        // プレイヤー分離時
        case PlayMode.TwinRobot:
        // プレイヤー合体時
        case PlayMode.HumanoidRobot:
            // プレイヤーに追従
            m_Target = PlayerManager.Instance.NearPlayer(transform.position).gameObject;
            break;

        // デフォルト状態(何もしない)
        default:
            return;
        }

        m_TargetPosition   = m_Target.transform.position;
        m_TargetPosition.y = transform.position.y;
        float angle = Vector3.Angle(transform.forward, m_TargetPosition - transform.position);

        switch (s_State)
        {
        case SecondBossState.Ready:
            m_Anim.speed          = 1.0f;
            m_Collision.isTrigger = false;
            foreach (GameObject p in m_Particle)
            {
                p.SetActive(false);
            }
            if (m_ChangeCounter <= 0)
            {
                StartCoroutine(BattleChange());
            }
            if (angle > m_SearchAngle && GameManager.Instance.m_PlayMode != PlayMode.Combine)
            {
                if (m_Sound.clip != m_MoveSound)
                {
                    m_Sound.clip = m_MoveSound;
                    m_Sound.loop = true;
                    m_Sound.Play();
                }
                transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(m_TargetPosition - transform.position), m_RotateSpeed * Time.deltaTime);
                transform.Translate(Vector3.forward * m_MoveSpeed / 4 * Time.deltaTime);
            }
            else
            {
                if (m_Sound.clip != m_MoveSound)
                {
                    m_Sound.clip = m_MoveSound;
                    m_Sound.loop = true;
                    m_Sound.Play();
                }
                transform.Translate(Vector3.forward * m_MoveSpeed / 3 * Time.deltaTime);
            }
            break;

        case SecondBossState.Battle:
            m_Anim.speed          = 1.0f;
            m_Collision.isTrigger = false;
            if (m_Fire == false && m_AttackCounter <= 0)
            {
                StartCoroutine(Fire());
            }

            if (angle > m_SearchAngle)
            {
                foreach (GameObject p in m_Particle)
                {
                    p.SetActive(true);
                }
                if (m_Sound.clip != m_DriftSound)
                {
                    m_Sound.clip = m_DriftSound;
                    m_Sound.loop = true;
                    m_Sound.Play();
                }
                transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(m_TargetPosition - transform.position), m_RotateSpeed * Time.deltaTime);
                //transform.Translate(m_Velocity * Time.deltaTime);
                transform.position += m_Velocity * 0.8f * Time.deltaTime;
            }
            else
            {
                foreach (GameObject s in m_Smoke)
                {
                    s.GetComponent <ParticleSystem>().Play();
                }
                foreach (GameObject p in m_Particle)
                {
                    p.SetActive(false);
                }
                if (m_Sound.clip != m_MoveSound)
                {
                    m_Sound.clip = m_MoveSound;
                    m_Sound.loop = true;
                    m_Sound.Play();
                }
                transform.position += m_Velocity * Time.deltaTime;
                //transform.Translate(m_Velocity * Time.deltaTime);
            }

            if (m_AmmoCount == 4)
            {
                m_Reload = false;
            }
            else if (m_AmmoCount <= 0)
            {
                m_Reload = true;
            }
            if (m_Reload == false && m_Fire == true && angle < m_ShootAngle)
            {
                Instantiate(m_Bullet, m_GunBarrel.position, Quaternion.Euler(Vector3.zero));
                m_AmmoCount--;
                m_Fire = false;
            }
            break;

        case SecondBossState.Paralysis:
            m_Anim.speed = 0.0f;
            if (m_Sound.clip != m_StanSound)
            {
                m_Sound.clip = m_StanSound;
                m_Sound.loop = true;
                m_Sound.Play();
            }
            foreach (GameObject p in m_Particle)
            {
                p.SetActive(false);
            }
            foreach (GameObject s in m_Smoke)
            {
                s.GetComponent <ParticleSystem>().Stop();
            }
            break;

        case SecondBossState.Invincible:
            m_Anim.speed = 1.0f;
            m_Sound.Stop();
            foreach (GameObject p in m_Particle)
            {
                p.SetActive(false);
            }
            m_Collision.isTrigger = false;
            if (angle > m_SearchAngle)
            {
                transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(m_TargetPosition - transform.position), m_RotateSpeed * Time.deltaTime);
            }
            else
            {
                s_State = SecondBossState.Ready;
            }
            break;
        }
    }