// Use this for initialization void Start() { game = FindObjectOfType(typeof(AnimalSlingshot)) as AnimalSlingshot; OriginalX = transform.position.x; OriginalY = transform.position.y; SetSprite(); }
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); } }
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); } }
// 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(); }
// Use this for initialization void Start() { speed = PlayerPrefs.GetFloat("Speed"); //Testing purposes speed = .03f; rend = gameObject.GetComponent <SpriteRenderer> (); gameObject.AddComponent <PolygonCollider2D> (); gameObject.GetComponent <PolygonCollider2D> ().isTrigger = true; game = FindObjectOfType(typeof(AnimalSlingshot)) as AnimalSlingshot; }
// Use this for initialization void Start() { can = FindObjectOfType(typeof(Canvas)) as Canvas; game = GameObject.FindObjectOfType(typeof(AnimalSlingshot)) as AnimalSlingshot; ShowText(); }
void Start() { game = FindObjectOfType(typeof(AnimalSlingshot)) as AnimalSlingshot; }