Skip to content
Permalink
ee3ac1d8d3
Go to file
 
 
Cannot retrieve contributors at this time
51 lines (43 sloc) 2.52 KB
using UnityEngine;
using System.Collections;
public class Legosteroid : MonoBehaviour {
public GameObject legosteroid;
public GameObject piece1;
public GameObject piece2;
public GameObject piece3;
public GameObject piece4;
public GameObject brick1;
public GameObject brick2;
public GameObject brick3;
public GameObject brick4;
void Awake()
{
}
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Bullet")
{
brick1 = (GameObject)Instantiate(piece1, new Vector3(gameObject.transform.position.x + 1, gameObject.transform.position.y - 2, 5), Quaternion.identity);
brick2 = (GameObject)Instantiate(piece2, new Vector3(gameObject.transform.position.x - 2, gameObject.transform.position.y + 1, 5), Quaternion.identity);
brick3 = (GameObject)Instantiate(piece3, new Vector3(gameObject.transform.position.x - 1.4f, gameObject.transform.position.y + 2, 5), Quaternion.identity);
brick4 = (GameObject)Instantiate(piece4, new Vector3(gameObject.transform.position.x + 3, gameObject.transform.position.y + 1, 5), Quaternion.identity);
iTween.MoveTo(brick1, new Vector3(brick1.transform.position.x + 20, brick1.transform.position.y - 17, 5), 15);
iTween.MoveTo(brick2, new Vector3(brick1.transform.position.x - 22, brick1.transform.position.y + 35, 5), 16);
iTween.MoveTo(brick3, new Vector3(brick1.transform.position.x - 35, brick1.transform.position.y - 22, 5), 17);
iTween.MoveTo(brick4, new Vector3(brick1.transform.position.x + 40, brick1.transform.position.y + 20, 5), 16);
Destroy(gameObject);
}
//if (brick1.transform.position.z != 5)
// brick1.transform.position = new Vector3(brick1.transform.position.x, brick1.transform.position.y, 5);
//if (brick2.transform.position.z != 5)
// brick2.transform.position = new Vector3(brick2.transform.position.x, brick2.transform.position.y, 5);
//if (brick3.transform.position.z != 5)
// brick3.transform.position = new Vector3(brick3.transform.position.x, brick3.transform.position.y, 5);
//if (brick4.transform.position.z != 5)
// brick4.transform.position = new Vector3(brick4.transform.position.x, brick4.transform.position.y, 5);
}
void Update()
{
// gameObject.transform.eulerAngles = new Vector3(gameObject.transform.eulerAngles.x + 5, gameObject.transform.eulerAngles.y, gameObject.transform.eulerAngles.z);
}
}
You can’t perform that action at this time.