Ejemplo n.º 1
0
    public void LoadShape()
    {
        AnimalSlingshot game = FindObjectOfType(typeof(AnimalSlingshot)) as AnimalSlingshot;

        try {
            Bullet CurrentBullet = game.GetLoaded().GetComponent <Bullet> ();
            if (CurrentBullet != null && CurrentBullet.motion == false)
            {
                Destroy(game.GetLoaded());
                game.SetCurrent(null);
            }
        } catch {
        }
        game.SetCurrent(game.Bullet);
        GameObject CurrentObj = game.GetCurrent();
        GameObject shot       = GameObject.Find("Shot");

        if (shot != null)
        {
            shot.transform.localPosition = new Vector3(0f, -.3f, 0f);
            GameObject current = Instantiate(CurrentObj) as GameObject;
            float      x       = shot.transform.position.x;
            float      y       = shot.transform.position.y;
            float      z       = shot.transform.position.z - 1;
            current.transform.localPosition = new Vector3(x, y, z);
            current.transform.localScale    = new Vector2(.4f, .4f);
            game.CShape = animal;
            current.GetComponent <Bullet> ().animal = animal;
            game.SetLoaded(current);
        }
    }
Ejemplo n.º 2
0
    public void LoadShapeSling()
    {
        AnimalSlingshot game = FindObjectOfType(typeof(AnimalSlingshot)) as AnimalSlingshot;

        animal = GetComponent <ShapeButton> ().animal;
        try {
            Bullet CurrentBullet = game.GetLoaded().GetComponent <Bullet> ();
            if (CurrentBullet != null && CurrentBullet.motion == false)
            {
                Destroy(game.GetLoaded());
                game.SetCurrent(null);
            }
        } catch {
        }
        SetCurrent();
        GameObject CurrentObj = game.GetCurrent();
        GameObject shot       = GameObject.Find("Shot");

        if (shot != null)
        {
            //shot.transform.localScale = new Vector2 (1f, 1f);
            shot.transform.localPosition = new Vector3(0f, -.3f, 0f);
            GameObject current = Instantiate(CurrentObj) as GameObject;
            current.transform.localPosition         = shot.transform.position;
            current.transform.localScale            = new Vector2(.6f, .6f);
            current.GetComponent <Bullet> ().animal = animal;
            game.SetLoaded(current);
        }
    }