private int bulletId; //workaround until this is changed to extend gun class. // Use this for initialization void Start() { pgo = GameObject.Find("PooledBullets").GetComponent <PooledGameObjects>(); bulletId = pgo.InitializeObjectType(Rocket); Debug.Log(pgo.ToString()); //playerCam = transform.parent.transform.GetChild(0).GetComponent<Camera>(); }
protected GameObject aim; //Used to help aiming protected virtual void Start() { pgo = GameObject.Find("PooledBullets").GetComponent <PooledGameObjects>(); bulletId = pgo.InitializeObjectType(bulletObj); Debug.Log(pgo.ToString()); //First find the parent object, then find the camera object, then get the main camera playerCam = this.transform.parent.gameObject.transform.GetChild(0).gameObject.GetComponent <Camera>(); aim = playerCam.transform.GetChild(0).gameObject; //Get the aiming object, this object will stay in line relate to the camera, help the gun to find the target point }