public static IEnumerator nudgePlayer(LocomotionTracker locomotionTracker, System.Action nudgeCompleted = null) { float finishTime = Time.time + UnityEngine.Random.Range(0.2f, 0.4f); _ = Vector2.down; Vector2 direction; switch (UnityEngine.Random.Range(1, 5)) { case 1: direction = Vector2.up; break; case 2: direction = Vector2.left; break; case 3: direction = Vector2.right; break; default: direction = Vector2.down; break; } while (Time.time < finishTime && !locomotionTracker.gameObject.IsDestroyed()) { locomotionTracker.GetCurrentController().Steer(direction); yield return(null); } nudgeCompleted?.Invoke(); }
public void Awake() { eventChannel = new EventChannel(Service.Get <EventDispatcher>()); tracker = GetComponent <LocomotionTracker>(); locoEventBroadcaster = GetComponent <LocomotionEventBroadcaster>(); Assert.IsNotNull(eventChannel, "EventChannel is null"); Assert.IsNotNull(tracker, "Tracker is null"); }
protected override void awake() { mutableData = Object.Instantiate(MasterData); tracker = GetComponent <LocomotionTracker>(); raycastLayerMask = LayerConstants.GetPlayerLayerCollisionMask(); DefaultAnimatorController = animator.runtimeAnimatorController; dispatcher = Service.Get <EventDispatcher>(); jumpRequest = new ActionRequest(PenguinUserControl.DefaultActionRequestBufferTime, animator, AnimationHashes.Params.Jump); }
public virtual void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); locoEventBroadcaster = GetComponent <LocomotionEventBroadcaster>(); dispatcher = Service.Get <EventDispatcher>(); interactRequest = new ActionRequest(PenguinUserControl.DefaultActionRequestBufferTime); locomotionTracker = GetComponent <LocomotionTracker>(); currentActionGraphGameObject = null; }
public static LocomotionController GetCurrentController(GameObject target) { LocomotionTracker component = target.GetComponent <LocomotionTracker>(); if (component != null) { return(component.GetCurrentController()); } return(null); }
public static bool IsCurrentControllerOfType <T>(GameObject target) where T : LocomotionController { LocomotionTracker component = target.GetComponent <LocomotionTracker>(); if (component != null) { return(component.IsCurrentControllerOfType <T>()); } return(false); }
public void Awake() { agent = GetComponent <NavMeshAgent>(); tracker = GetComponent <LocomotionTracker>(); agent.updatePosition = false; agent.updateRotation = false; tracker.SetCurrentController <RunController>(); runController = GetComponent <RunController>(); runController.Behaviour.SetStyle(LocoStyle); }
protected override void awake() { mutableData = UnityEngine.Object.Instantiate(MasterData); tracker = GetComponent <LocomotionTracker>(); rig = GetComponent <Rig>(); cameraTransform = Camera.main.transform; dispatcher = Service.Get <EventDispatcher>(); ikBones = new List <IKBoneEntry>(); base.enabled = false; }
private void Awake() { if (base.gameObject.CompareTag("Player") && SurfaceSamplingData != null) { anim = GetComponent <Animator>(); tracker = GetComponent <LocomotionTracker>(); locoStatus = LocomotionStatus.Unknown; CoroutineRunner.Start(SampleSurface(), this, "SampleSurface"); } else { base.enabled = false; } }
private bool isInteractingWithZiplineActionGraph(GameObject player) { if (player.IsDestroyed()) { return(false); } LocomotionTracker component = player.GetComponent <LocomotionTracker>(); if (component == null) { return(false); } if (component.IsCurrentControllerOfType <ZiplineController>()) { return(true); } GameObject trigger = SceneRefs.ActionSequencer.GetTrigger(player); if (trigger == null) { return(false); } return(trigger.GetComponent <SetZiplineLocomotionAction>() != null); }
public void MoveToTarget(Transform target, float distanceThreshold = 0.15f, PlayerLocoStyle.Style locomotionStyle = PlayerLocoStyle.Style.Walk, float timeoutTime = 15f, bool autoDestroy = true) { targetDestination = target; actorRadius = 0f; actorHalfHeight = 0.1f; this.timeoutTime = timeoutTime; this.autoDestroy = autoDestroy; CharacterController component = GetComponent <CharacterController>(); if (component != null) { actorRadius = component.radius; actorHalfHeight = component.height / 2f; } LocomotionTracker component2 = GetComponent <LocomotionTracker>(); if (component2.SetCurrentController <RunController>()) { runController = GetComponent <RunController>(); if (!runControllerBehaviourWasSet) { oldRunBehaviour = runController.Behaviour; runController.Behaviour = new RunController.ControllerBehaviour { IgnoreCollisions = false, IgnoreGravity = false, IgnoreRotation = false, IgnoreTranslation = false, IgnoreJumpRequests = true, IgnoreStickInput = true, Style = locomotionStyle }; runControllerBehaviourWasSet = true; } runController.ResetMomentum(); dest = targetDestination.transform.position; Vector3 vector = dest - base.transform.position; if (vector == Vector3.zero) { vector = base.transform.forward; } distThresholdSq = distanceThreshold * distanceThreshold; vector.y = 0f; elapsedTime = 0f; done = false; } if (!CanReachWaypoint()) { if (this.OnComplete != null) { this.OnComplete(); } runController.Steer(Vector3.zero); runController.SnapToPosition(dest); runController.SnapToFacing(targetDestination.transform.forward); if (autoDestroy) { UnityEngine.Object.Destroy(this); } } }
protected override void awake() { tracker = GetComponent <LocomotionTracker>(); base.enabled = false; }