コード例 #1
0
 /// <summary>
 /// scale ball if it is inflatable ball
 /// </summary>
 protected override void scaleBall()
 {
     if (!m_CurrentProj)
     {
         m_ScaleBallMode = ScaleBallModes.None; return;
     }
     base.scaleBall();
 }
コード例 #2
0
 /// <summary>
 /// create ball method
 /// </summary>
 protected override void createBall()
 {
     m_ScaleBallMode = ScaleBallModes.Scale;
     base.createBall();
 }
コード例 #3
0
        /// <summary>
        /// shoot method
        /// </summary>
        protected void _shoot()
        {
#if DEBUG_INFO
            if (!ProjectilePrefab)
            {
                Debug.LogError("ProjectilePrefab cannot be null." + " < " + this.ToString() + ">");
                return;
            }
#endif

            if (m_DisableShooting)
            {
#if DEBUG_INFO
                Debug.LogWarning("WallShooter disabled: " + this.name);
#endif
                return;
            }

            // shooting procedure
            m_CurrentShootTime += Time.deltaTime;
            if (m_CurrentShootTime >= shootInterval)
            {
                m_CurrentShootScaleTarget = Random.Range(InflatableBall.MinScale, InflatableBall.MaxScale);
                m_ScaleBallMode           = ScaleBallModes.CreateBallProjectile;
                m_CurrentShootTime        = 0.0f;
            }

            if (ProjectilePrefab is InflatableBall)
            {
                if (m_ScaleBallMode == ScaleBallModes.CreateBallProjectile)
                {
                    createBall();
                }
                else if (m_ScaleBallMode == ScaleBallModes.Scale)
                {
                    float currentBallScale = (m_CurrentProj as InflatableBall).currentBallScale;

                    scaleBall();

                    if (currentBallScale >= m_CurrentShootScaleTarget)
                    {
                        m_ScaleBallMode = ScaleBallModes.Release;
                    }
                }
                else if (m_ScaleBallMode == ScaleBallModes.Release)
                {
                    fireBall();
                }
            }
            else
            {
                if (m_ScaleBallMode == ScaleBallModes.CreateBallProjectile)
                {
                    createBall();
                    fireBall();
                }
            }
            if (m_CurrentProj)
            {
                if (m_CurrentProj.State == Projectile.ProjectileStates.Ready)
                {
                    m_CurrentProj.transform.position = FireTransform.position;
                }
            }
        }