IEnumerator WaitForZoomIn() { TrashCamera camera = GameObject.FindObjectOfType <TrashCamera> (); camera.LockZoom(this); WaitForSeconds wait = new WaitForSeconds(0); while (CachedRigidbody2D.velocity.magnitude > TrashPlayer.ZOOM_IN_VELOCITY) { yield return(wait); } yield return(new WaitForSeconds(TrashPlayer.WAIT_TO_ZOOM_TIME)); camera.UnlockZoom(this); camera.SetCameraTargetZoom(0f, this); }
protected override void OnInitialize() { playerState = new StateMachine <TrashPlayerState> (BeginPlayerState, EndPlayerState); currentMovementDirection = initialDirection; ChangeDirection(startDirection); CachedTransform.position = startPosition; if (trashCamera == null) { trashCamera = GameObject.FindObjectOfType <TrashCamera> (); } trashCamera.SnapToPlayerPosition(); initial_tyreIronRotation = bind_TyreIronLookAt.localRotation.eulerAngles; initial_tyreIronArmRotation = bind_TyreIronArmLookAt.localRotation.eulerAngles; this.tyreIron.SubscribeToTyreIronCollision(HandleTyreIronHitItem, HandleTyreIronHitEnemy); }
void DestroyTrashItem() { TrashCamera cam = GameObject.FindObjectOfType <TrashCamera> (); cam.UnlockZoom(this); cam.SetCameraTargetZoom(0f, this); if (destroyed) { return; } destroyed = true; //TrashUIManager.Instance.MakeAnnouncement (CachedTransform, AnnouncementType.Item_Destroyed, 0f); CreateDestroyEffect(); TrashWorld.Instance.DestroyTrashItem(); GameObject.Destroy(this.gameObject); }
public void SetTrashCamera(TrashCamera trashCamera) { this.trashCamera = trashCamera; }