Esempio 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);
        }
    }
Esempio 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);
        }
    }
Esempio n. 3
0
 // Update is called once per frame
 void Update()
 {
     if (game.GetLoaded() != false)
     {
         CurrentOb = game.GetLoaded();
         stretch(CurrentOb.transform.position.x, CurrentOb.transform.position.y);
     }
 }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     game      = FindObjectOfType(typeof(AnimalSlingshot)) as AnimalSlingshot;
     OriginalX = transform.position.x;
     OriginalY = transform.position.y;
     if (game.GetLoaded() != null)
     {
         CurrentOb = game.GetLoaded();
     }
     Reset();
 }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     if (game.GetLoaded() != false)
     {
         GameObject loaded = game.GetLoaded();
         float      x      = loaded.transform.position.x;
         float      y      = loaded.transform.position.y;
         float      z      = loaded.transform.position.z + 1f;
         transform.position = new Vector3(x, y, z);;
         //		rend.sprite = loaded.
         //float y = right.transform.localPosition.y;
         //transform.position = new Vector2 (mid, y);
     }
 }