void Awake() { //Initiate Singleton and overwrite if one exists already Instance = this; SetEdges(); }
void Awake() { if (body == null) { body = this.gameObject.GetComponent <Rigidbody2D>(); } body.velocity = new Vector2(0, 0); edge = ScreenEdgeReference.Instance; //ThrustForward(); }
void SpawnEnemy(ObjectPooler pool) { ScreenEdgeReference reference = ScreenEdgeReference.Instance; float randomX = 0; if (Random.Range(0, 2) == 0) { randomX = reference.GetLeft().x; } else { randomX = reference.GetRight().x; } float randomY = Random.Range(reference.GetBotton().y, reference.GetTop().y); GameObject enemy = PoolManager.Instance.GrabFromPool(pool); enemy.SetActive(true); enemy.transform.SetPositionAndRotation(new Vector3(randomX, randomY, 0), Quaternion.identity); }
void Start() { edge = ScreenEdgeReference.Instance; t = this.gameObject.GetComponent <Transform>(); }