private void SetUpPlayer() { //Inject a new object between the "smooth follow" object and the camera. GameObject shakeObject = new GameObject(); shakeObject.name = "Shaker"; shakeObject.transform.parent = GameManager.Instance.MainCamera.transform.parent; shakeObject.transform.localPosition = Vector3.zero; shakeObject.transform.localRotation = Quaternion.identity; //Set as first sibling, since some mods (IE Improved interior lighting) require nothing to change in hiearchy shakeObject.transform.SetAsFirstSibling(); cameraShaker = shakeObject.AddComponent <CameraShaker>(); GameManager.Instance.MainCamera.transform.parent = shakeObject.transform; damageShaker = GameManager.Instance.PlayerObject.gameObject.AddComponent <DamageShaker>(); damageShaker.SetPlayer(GameManager.Instance.PlayerEntity, cameraShaker); }
void Awake() { Instance = this; instanceList[gameObject.name] = this; initialPosition = transform.localPosition; }
public void SetPlayer(PlayerEntity player, CameraShaker shaker) { this.player = player; this.shaker = shaker; }