Example #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        switch (col.gameObject.tag)
        {
        case "Grass":
            #region Grass
            Destroy(col.gameObject);
            #endregion
            break;

        case "bullet":
            #region Bullet
            GameParam.ScoredSMG    += 5;
            PanzerMover.Position.y += (GameParam.BulletSpeed / 2) * -GameParam.ImpulsBulletX;
            PanzerMover.Position.x += (GameParam.BulletSpeed / 2) * GameParam.ImpulsBulletY;
            //
            switch (Random.Range(0, 2))
            {
            case 0:
                PanzerMover.RotateLeftGun(15);
                break;

            case 1:
                PanzerMover.RotateRightGun(15);
                break;
            }
            if (--PanzerMover.health <= 0)
            {
                Instantiate(PanzerDestroy_obj, Panzer_obj.transform.position, PanzerDestroy_obj.transform.rotation);
                if (Random.Range(0, verFastBullet) == verFastBullet / 2)
                {
                    Instantiate(FastBullet, transform.position, transform.rotation);
                }

                if (Random.Range(0, verIceGun) == verIceGun / 2)
                {
                    Instantiate(IceGun, transform.position, transform.rotation);
                }
                Destroy(Panzer_obj);

                // Handheld.Vibrate();
                GameParam.ScoredSMG += 35;
            }
            if (PanzerMover.health == 1)
            {
                PanzerMover.PanzerBurn();
            }
            #endregion
            break;

        case "ezh":
            #region Ezh
            Instantiate(PanzerDestroy_obj, Panzer_obj.transform.position, PanzerDestroy_obj.transform.rotation);
            Destroy(Panzer_obj);
            #endregion
            break;

        case "palm":
        case "panzer":
            #region Palm
            if (col.gameObject.tag == "palm" || col.gameObject.tag == gameObject.tag)
            {
                //  timePanzerStay = 0;
                if (PanzerMover.StabilityAngles(10))
                {
                    if (PanzerMover.Angles.z == 90 || PanzerMover.Angles.z == 270)
                    {
                        #region Random_Move_Palm
                        switch (Random.Range(0, 2))
                        {
                        case 0:
                            PanzerMover.Select = GameClasses.PanzerMove.SelectMove.Left;
                            break;

                        case 1:
                            PanzerMover.Select = GameClasses.PanzerMove.SelectMove.Right;
                            //   chechRight=true;
                            // CountRotation = 16;
                            break;

                        default:
                            PanzerMover.Select = GameClasses.PanzerMove.SelectMove.Left;
                            break;
                        }

                        #endregion
                    }
                    else
                    if (PanzerMover.Angles.z == 0)
                    {
                        PanzerMover.Select = GameClasses.PanzerMove.SelectMove.Right;
                    }
                    else
                    if (PanzerMover.Angles.z == 180)
                    {
                        PanzerMover.Select = GameClasses.PanzerMove.SelectMove.Left;
                    }
                }
            }
            #endregion
            break;
        }
    }
Example #2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        switch (col.gameObject.tag)
        {
        case "bullet":
            #region Bullet
            GameParam.ScoredSMG         += 5;
            AlienPanzerMover.Position.y += (GameParam.BulletSpeed / 2) * -GameParam.ImpulsBulletX;
            AlienPanzerMover.Position.x += (GameParam.BulletSpeed / 2) * GameParam.ImpulsBulletY;
            //
            switch (Random.Range(0, 2))
            {
            case 0:
                AlienPanzerMover.RotateLeftGun(15);
                break;

            case 1:
                AlienPanzerMover.RotateRightGun(15);
                break;
            }
            if (--AlienPanzerMover.health <= 0)
            {
                Instantiate(AlienPanzerDestroy_obj, AlienPanz.transform.position, AlienPanzerDestroy_obj.transform.rotation);
                #region RandomRenderBonuse
                if (Random.Range(0, verFastBullet) == verFastBullet / 2)
                {
                    Instantiate(FastBullet, transform.position, transform.rotation);
                }

                if (Random.Range(0, verIceGun) == verIceGun / 2)
                {
                    Instantiate(IceGun, transform.position, transform.rotation);
                }
                #endregion
                Destroy(AlienPanz);
                GameParam.ScoredSMG += 35;
            }
            if (AlienPanzerMover.health == 1)
            {
                AlienPanzerMover.PanzerBurn();
            }
            #endregion
            break;

        case "ezh":
            #region Ezh
            Instantiate(AlienPanzerDestroy_obj, AlienPanz.transform.position, AlienPanzerDestroy_obj.transform.rotation);
            Destroy(AlienPanz);
            #endregion
            break;

        case "Chip":
        case "panzer":
            #region Elka
            if (AlienPanzerMover.StabilityAngles(10))
            {
                if (AlienPanzerMover.Angles.z == 90 || AlienPanzerMover.Angles.z == 270)
                {
                    #region Random_Move_Palm
                    switch (Random.Range(0, 2))
                    {
                    case 0:
                        AlienPanzerMover.Select = GameClasses.PanzerMove.SelectMove.Left;
                        break;

                    case 1:
                        AlienPanzerMover.Select = GameClasses.PanzerMove.SelectMove.Right;
                        //   chechRight=true;
                        // CountRotation = 16;
                        break;

                    default:
                        AlienPanzerMover.Select = GameClasses.PanzerMove.SelectMove.Left;
                        break;
                    }

                    #endregion
                }
                else
                if (AlienPanzerMover.Angles.z == 0)
                {
                    AlienPanzerMover.Select = GameClasses.PanzerMove.SelectMove.Right;
                }
                else
                if (AlienPanzerMover.Angles.z == 180)
                {
                    AlienPanzerMover.Select = GameClasses.PanzerMove.SelectMove.Left;
                }
            }
            #endregion
            break;
        }
    }