protected override void Awake() { base.Awake(); animator = GetComponentInChildren <Animator>(); controllerEventArgs = new LogicEventArgs <CameraTarget>().SetData(GetComponentInChildren <CameraTarget>()); Facade.SetInputDevice(new StandardInputDevice()); Facade.RegisterController(this); }
/// <summary> /// 开始时候执行一次 /// 属于Start函数 /// </summary> void CameraHandler(object sender, GameEventArgs args) { controllerEventArgs = args as LogicEventArgs <CameraTarget>; CameraTarget = controllerEventArgs.Data; cam = GetComponentInChildren <Camera>(); cam.transform.ResetLocalTransform(); transform.rotation = CameraTarget.transform.rotation; currentDistance = distanceFromTarget; cameraOffset.z = -currentDistance; cam.transform.localPosition = cameraOffset; }