protected void SetupInteraction(FtueInteractionType interactionType) { // setting interaction currentInteraction = interactionType; switch (currentInteraction) { case FtueInteractionType.ActivationMatrix: // starting timer StartTimer(Interaction1_WaitTime, () => { sequence.Play(FtueType.Intro, AnimationClip_Interaction1_SwitchOnSaber); }); break; case FtueInteractionType.AssaultMode: // turning on droid Droid.SetActive(true); // playing audio with delay DOVirtual.DelayedCall(0.25f, () => { AudioEvent.Play(AudioEventName.Ftue.Droid.Roger, gameObject); AudioEvent.Play(AudioEventName.Ftue.Archivist.FirstOpponent, gameObject, 0.75f); }); // listening for saber swings SaberEvents.OnSaberSwing += OnSaberSwing; // listener for droid reaching target ObjectTracker.OnObjectReachedTargetLocation += OnObjectReachedTargetLocation; ObjectTracker.OnObjectLeftTargetLocation += OnObjectLeftTargetLocation; // listening for enemy death BattleDroidAI.OnEnemyDeath += OnEnemyDeath; // starting tracking DroidTracker.StartTracking(); break; } }
public void OnButtonDown(object sender, ButtonEventArgs eventArgs) { // enabling re-center if (eventArgs.Peripheral is ControllerPeripheral && eventArgs.Button == ButtonType.SaberControl) { (eventArgs.Peripheral as ControllerPeripheral).Recenter(Sdk.StereoCamera); } if (currentInteraction == FtueInteractionType.None) { // getting hits at current camera position RaycastHit[] hits; Transform cameraTransform = Sdk.StereoCamera.transform; Vector3 fwd = cameraTransform.forward; hits = Physics.RaycastAll(cameraTransform.position, fwd, 1000f); // checking for hit on holocron if (hits != null) { for (int i = 0; i < hits.Length; i++) { if (string.Equals(HolocronColliderName, hits[i].transform.name)) { // disable the collider hits[i].transform.GetComponent <SphereCollider>().enabled = false; // performing holocron animation to origin AnimateHolocronDown(); // hiding the tooltip FtueTooltip.SetActive(false); //play holocron drop sfx AudioEvent.Play(AudioEventName.Holocron.FTUEHolocronDrop, HolocronContainer); break; } } } } else if (currentInteraction == FtueInteractionType.ActivationMatrix) { if (eventArgs.Button == ButtonType.SaberActivate) { if (shouldTrackTime) { EndTimer(); } // Make sure the saber blade is centered. if (eventArgs.Peripheral != null && eventArgs.Peripheral is ControllerPeripheral) { (eventArgs.Peripheral as ControllerPeripheral).Recenter(Sdk.StereoCamera); } // turning on the saber Saber.StartSaber(); // hiding the saber position helper SaberPositionHelper.SetActive(false); // continuing FTUE, updating the interaction type sequence.Play(FtueType.Intro, AnimationClip_Interaction1_VeryGood); currentInteraction = FtueInteractionType.AssaultModePrep; } } }