static void PostfixInitNew(Pathea.Player __instance, Pathea.ActorNs.Actor ___playingActor) { if (___playingActor == null) { return; } // meh if (originalPlayerMotionValues[0] == 0.0F) { originalPlayerMotionValues[0] = ___playingActor.motor.maxSpeed; } if (originalPlayerMotionValues[1] == 0.0F) { originalPlayerMotionValues[1] = ___playingActor.RunSpeed; } if (originalPlayerMotionValues[2] == 0.0F) { originalPlayerMotionValues[2] = ___playingActor.FastRunSpeed; } // add event handlers to match interaction targets __instance.OnInteractiveStart += AnimHelper.OnPlayerInteractiveStart; __instance.OnInteractiveSuccess += AnimHelper.OnPlayerInteractiveSuccess; }
static void PostfixOnStart(ref Pathea.ActorMotor __instance, ref Pathea.ActorNs.Actor ___actor, ref UnityEngine.Vector3 ___jumpSpeed) { if (!__instance.IsPlayer) { return; } ___jumpSpeed *= Main.modSettings.JumpInitialSpeed; }
static void PostfixInitActionRunner(Pathea.ActorNs.Actor __instance, Pathea.ActorNs.ActorTag ___actorTag, Pathea.ACT.ACTMgr ___mActMgr) { if (___actorTag == Pathea.ActorNs.ActorTag.Player && null != ___mActMgr) { //Main.dump("got player action manager"); AnimHelper.playerActionManager = ___mActMgr; } }
public static bool IsPlayer(Pathea.ActorNs.Actor actor) { if (null != actor && actor.IsActorType(Pathea.ActorNs.ActorTag.Player)) { return(true); } return(false); }
static void PostfixUpdate(Pathea.ActorNs.Actor __instance) { if (AnimHelper.IsPlayer(__instance)) { AnimHelper.playerAnimator.speed = AnimHelper.currentPCSpeed; } // set npc speeds else { AnimHelper.setNPCSpeed(__instance); } }
static void PostfixUpdate(Pathea.Player __instance, Pathea.ActorNs.Actor ___playingActor, Pathea.ActorNs.Actor ___itTarget) { if (___playingActor == null) { return; } if (Time.fixedTime - Main.timeTick >= 1.0F) { Main.timeTick = Time.fixedTime; // stuff to do every second } ___playingActor.motor.maxSpeed = originalPlayerMotionValues[0] * Main.modSettings.RunMultiplier; ___playingActor.RunSpeed = originalPlayerMotionValues[1] * Main.modSettings.RunMultiplier; ___playingActor.FastRunSpeed = originalPlayerMotionValues[2] * Main.modSettings.RunMultiplier; if (null != ___playingActor.animCtrl && null == AnimHelper.playerAnimator) { //Main.dump("has player animator 2"); AnimHelper.playerAnimator = ___playingActor.animCtrl.GetComponentInChildren <UnityEngine.Animator>(); } if (__instance.IsInteractiveRunning()) { //Main.dump(__instance.interactiveID); if (null != ___itTarget) { AnimHelper.currentPlayerInteractionTarget = ___itTarget.GetInstanceID(); //Main.dump("Interacting " + ___itTarget.name); //AnimHelper.setNPCSpeed(___itTarget); } } else { AnimHelper.currentPlayerInteractionTarget = 0; } if ( Main.modSettings.DrillDriftSpeed > 0.0F && __instance.IsAutoMove() && ( __instance.IsActionRunning(Pathea.ACT.ACType.Chainsaw) || __instance.IsActionRunning(Pathea.ACT.ACType.Drilling) ) ) { Vector3 direction = Main.modSettings.DrillDriftSpeed * Pathea.CameraSystemNs.CameraManager.Instance.SourceCamera.transform.forward; ___playingActor.motor.MoveBySpeed(direction); } }
public static void setNPCSpeed(Pathea.ActorNs.Actor actor) { // cache npc animators maybe? Animator npcAnimator = actor.animCtrl.GetComponentInChildren <Animator>(); if (currentPlayerInteractionTarget == actor.GetInstanceID()) { // Main.dump(currentPlayerInteractionTarget); // Main.dump("interacting with "+actor.name); npcAnimator.speed = currentPCSpeed; } else { npcAnimator.speed = currentNPCSpeed; } }
static void PostfixSetBool(Pathea.ActorNs.Actor __instance, string str, bool val) { if (!AnimHelper.IsPlayer(__instance)) { return; } // Main.dump("Pathea.ActorNs.Actor::SetBool "+__instance.name+" " + str); if (!val) { AnimHelper.clearPlayerAnimSpeed(); // release player from lingering anims. Pathea.MessageSystem.MessageManager.Instance.Dispatch("InteractAnimEnd"); return; } AnimHelper.SetPlayerAnimSpeed(AnimHelper.GetSpeedForAnimName(str)); }