VFlip() public method

public VFlip ( ) : void
return void
Example #1
0
    void Start()
    {
        myTransform = transform;
        spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnObstacles>();
        myCollider = gameObject.GetComponent<SphereCollider>();
        topBorder = GameObject.FindGameObjectWithTag("Top");
        bottomBorder = GameObject.FindGameObjectWithTag("Bottom");
        doOnce = false;

        //Add to volume control
        if(PlayerPrefs.HasKey("volumeFX"))
        {
            if(GetComponent<AudioSource>() != null)
            {
                AudioSource audio = GetComponent<AudioSource>();
                audio.volume = (float)PlayerPrefs.GetInt("volumeFX")/10;
            }
        }

        flip = GetComponent<exSprite>();

        //Offsets will use opposite border max/min because this object has a spehere colider, not a box collider
        if(Random.Range(0, 100) > 50)
        {
            offsetY = (topBorder.collider.bounds.max.y - gameObject.collider.bounds.size.y/1.5f);
            flip.VFlip();
            myCollider.center = -myCollider.center;
            Destroy(myTransform.FindChild("Buzzparticlebot").gameObject);

        }

        else
        {
            offsetY = (bottomBorder.collider.bounds.min.y + gameObject.collider.bounds.size.y/1.5f);
            Destroy(myTransform.FindChild("Buzzparticletop").gameObject);
        }

        myTransform.position = new Vector3(myTransform.position.x, offsetY, 0.0f);
    }