Ejemplo n.º 1
0
    public void ShiledBulletReduce(EnemyBulletType type, float energyValue = 10.0f)
    {
        //1 block
        //if(m_bReadyBomb == true)
        //{
        //	m_bReadyBomb = false;
        //
        //	m_CoreAnim.SetBool("boost",false);
        //
        //	if(PlayerManager.getInstance().GetEnergyBar() != null)
        //	{
        //		PlayerManager.getInstance().GetEnergyBar().EnergyNotFull();
        //	}
        //}

        ReduceEnergy(energyValue);

        if (m_bReadyBomb == true && m_CurShipEnergy < OneSecShipEnergy)
        {
            m_bReadyBomb = false;

            m_CoreAnim.SetBool("boost", false);

            if (PlayerManager.getInstance().GetEnergyBar() != null)
            {
                PlayerManager.getInstance().GetEnergyBar().EnergyNotFull();
            }
        }

        //2 Back step
        ShipBackStep(type);
    }
Ejemplo n.º 2
0
    //-----------------------------------------------------------------
    public void RandomNeedsEnergyType()
    {
        int randType = Random.Range(0, 3);

        m_CurNeedsEnergyType = (EnemyBulletType)randType;

        if (PlayerManager.getInstance().GetEnergyBar() != null)
        {
            PlayerManager.getInstance().GetEnergyBar().ChangeBulletType(m_CurNeedsEnergyType);
        }
    }
Ejemplo n.º 3
0
    public void ShiledBulletAbsorb(EnemyBulletType type, float energyValue = 10.0f)
    {
        energyValue = energyValue * 0.5f;
        //1 block
        //if(m_bReadyBomb == false)
        if (m_CurShipEnergy < MaxShipEnergy)
        {
            AbsorbEnergy(energyValue);
        }

        //2 Back step
        //ShipBackStep (type);
    }
Ejemplo n.º 4
0
    //-------------------------
    public void ShipBackStep(EnemyBulletType type)
    {
        Vector2 dir_right     = new Vector2(1.0f, 0.0f);
        Vector2 dir_rightUp   = new Vector2(0.577f, 1.0f);
        Vector2 dir_leftUp    = new Vector2(-0.577f, 1.0f);
        Vector2 dir_left      = new Vector2(-1.0f, 0.0f);
        Vector2 dir_leftDown  = new Vector2(-0.577f, -1.0f);
        Vector2 dir_rightDown = new Vector2(0.577f, -1.0f);

        dir_rightUp.Normalize();
        dir_leftUp.Normalize();
        dir_leftDown.Normalize();
        dir_leftDown.Normalize();

        Vector2 step = new Vector2(0.0f, 0.0f);

        switch (m_CurFrontType)
        {
        case ShipFrontType.FrontType_Gun1:
        {
            if (type == EnemyBulletType.EnemyBullet_Blue)
            {
                step = m_BackStepLength * dir_leftDown;
            }
            else if (type == EnemyBulletType.EnemyBullet_Green)
            {
                step = m_BackStepLength * dir_right;
            }
            else if (type == EnemyBulletType.EnemyBullet_Yellow)
            {
                step = m_BackStepLength * dir_leftUp;
            }
        }
        break;

        case ShipFrontType.FrontType_Shild1:
        {
            if (type == EnemyBulletType.EnemyBullet_Blue)
            {
                step = m_BackStepLength * dir_left;
            }
            else if (type == EnemyBulletType.EnemyBullet_Green)
            {
                step = m_BackStepLength * dir_rightDown;
            }
            else if (type == EnemyBulletType.EnemyBullet_Yellow)
            {
                step = m_BackStepLength * dir_rightUp;
            }
        }
        break;

        case ShipFrontType.FrontType_Gun2:
        {
            {
                if (type == EnemyBulletType.EnemyBullet_Blue)
                {
                    step = m_BackStepLength * dir_leftUp;
                }
                else if (type == EnemyBulletType.EnemyBullet_Green)
                {
                    step = m_BackStepLength * dir_leftDown;
                }
                else if (type == EnemyBulletType.EnemyBullet_Yellow)
                {
                    step = m_BackStepLength * dir_right;
                }
            }
        }
        break;

        case ShipFrontType.FrontType_Shild2:
        {
            {
                if (type == EnemyBulletType.EnemyBullet_Blue)
                {
                    step = m_BackStepLength * dir_rightUp;
                }
                else if (type == EnemyBulletType.EnemyBullet_Green)
                {
                    step = m_BackStepLength * dir_left;
                }
                else if (type == EnemyBulletType.EnemyBullet_Yellow)
                {
                    step = m_BackStepLength * dir_rightDown;
                }
            }
        }
        break;

        case ShipFrontType.FrontType_Gun3:
        {
            {
                if (type == EnemyBulletType.EnemyBullet_Blue)
                {
                    step = m_BackStepLength * dir_right;
                }
                else if (type == EnemyBulletType.EnemyBullet_Green)
                {
                    step = m_BackStepLength * dir_leftDown;
                }
                else if (type == EnemyBulletType.EnemyBullet_Yellow)
                {
                    step = m_BackStepLength * dir_leftDown;
                }
            }
        }
        break;

        case ShipFrontType.FrontType_Shild3:
        {
            {
                if (type == EnemyBulletType.EnemyBullet_Blue)
                {
                    step = m_BackStepLength * dir_rightDown;
                }
                else if (type == EnemyBulletType.EnemyBullet_Green)
                {
                    step = m_BackStepLength * dir_rightUp;
                }
                else if (type == EnemyBulletType.EnemyBullet_Yellow)
                {
                    step = m_BackStepLength * dir_left;
                }
            }
        }
        break;
        }

        this.transform.localPosition = new Vector3(this.transform.localPosition.x + step.x,
                                                   this.transform.localPosition.y + step.y,
                                                   this.transform.localPosition.z);
        //this.transform.localPosition = new Vector3 (this.transform.localPosition.x - m_BackStepLength,
        //                                           this.transform.localPosition.y,
        //                                           this.transform.localPosition.z);
    }
Ejemplo n.º 5
0
 public void setBulletType(EnemyBulletType type)
 {
     m_BulletType = type;
 }
Ejemplo n.º 6
0
    //public void EnergyUsed()
    //{}

    public void ChangeBulletType(EnemyBulletType type)
    {
        if (BlueEnergy == null)
        {
            return;
        }
        if (GreenEnergy == null)
        {
            return;
        }
        if (YellowEnergy == null)
        {
            return;
        }

        CurBulletType = type;

        switch (type)
        {
        case EnemyBulletType.EnemyBullet_Blue:
        {
            BlueEnergy.gameObject.SetActive(true);

            GreenEnergy.gameObject.SetActive(false);

            YellowEnergy.gameObject.SetActive(false);

            if (UIAnimator != null)
            {
                UIAnimator.SetBool("blue", true);

                UIAnimator.SetBool("green", false);

                UIAnimator.SetBool("yellow", false);
            }
        }
        break;

        case EnemyBulletType.EnemyBullet_Green:
        {
            GreenEnergy.gameObject.SetActive(true);

            BlueEnergy.gameObject.SetActive(false);

            YellowEnergy.gameObject.SetActive(false);

            if (UIAnimator != null)
            {
                UIAnimator.SetBool("green", true);

                UIAnimator.SetBool("blue", false);

                UIAnimator.SetBool("yellow", false);
            }
        }
        break;

        case EnemyBulletType.EnemyBullet_Yellow:
        {
            YellowEnergy.gameObject.SetActive(true);

            GreenEnergy.gameObject.SetActive(false);

            BlueEnergy.gameObject.SetActive(false);

            if (UIAnimator != null)
            {
                UIAnimator.SetBool("yellow", true);

                UIAnimator.SetBool("green", false);

                UIAnimator.SetBool("blue", false);
            }
        }
        break;
        }
    }