public IPacMan CloneMe(Transform parent, Vector2 position) { GameObject newObj = Instantiate(gameObject, parent); PacMan pacMan = newObj.GetComponent <PacMan>(); pacMan.transform.localPosition = position; return(pacMan); }
public IPacMan CloneMe(Transform parent, Vector2 position, UnityEvent unityEvent) { GameObject newObj = Instantiate(gameObject, parent); BoxCollider2D boxCollider = newObj.AddComponent <BoxCollider2D>(); boxCollider.isTrigger = true; Rigidbody2D rigid = newObj.AddComponent <Rigidbody2D>(); rigid.bodyType = RigidbodyType2D.Kinematic; PacMan pacMan = newObj.GetComponent <PacMan>(); pacMan.transform.localPosition = position; pacMan._unityEvent = unityEvent; return(pacMan); }