Пример #1
0
 protected override void Update()
 {
     if (CurrentShotDelay > 0)
     {
         CurrentShotDelay -= Time.deltaTime;
         if (CurrentShotDelay <= 0)
         {
             JointObject(null);
             Cannon.SetState(true);
             SoundB.SetActive(false);
             SoundB.SetActive(true);
         }
     }
     else if (ShotCooldown <= 0)
     {
         base.Update();
     }
     else
     {
         ShotCooldown -= Time.deltaTime;
         if (ShotCooldown <= 0)
         {
             if (CurrentState)
             {
                 Observer.ChangeState(true);
             }
         }
     }
 }
Пример #2
0
    private void ThrowHead()
    {
        //        m_Joint.connectedBody = null;
        //        m_Joint.enabled = false;
        //cannon
        // CurrentAxis
        m_Collider.offset = Vector2.up * 0.6f;
        m_Collider.size   = new Vector2(1, 1.2f);

        if (CurrentAxis.y > 0.2f)
        {
            cannon.direction = ThrowDir_Up;
        }
        else if (CurrentAxis.y < -0.2f)
        {
            cannon.direction = ThrowDir_Down;

            m_CurrentHead.transform.SetParent(null);
            m_CurrentHead.gameObject.tag = TempTagSaver;
            m_CurrentHead.simulated      = true;
            m_CurrentHead = null;
            return;
        }
        else
        {
            if (Mathf.Abs(CurrentAxis.x) > 0.2f)
            {
                cannon.direction = ThrowDir_Forward;
            }
            else
            {
                cannon.direction = ThrowDir_Normal;
            }
        }


        m_CurrentHead.transform.SetParent(null);
        m_CurrentHead.gameObject.tag = TempTagSaver;
        m_CurrentHead.simulated      = true;
        cannon.HeadBulletCharge(m_CurrentHead);
        m_CurrentHead = null;
        cannon.SetState(true);
    }