public static void SetPull(this ThrowingActionData throwingActionData, EntityKey entityKey) { throwingActionData.IsPull = true; throwingActionData.ShowCountdownUI = true; throwingActionData.IsInterrupt = false; throwingActionData.ThrowingEntityKey = entityKey; }
public static void SetThrow(this ThrowingActionData throwingActionData, Vector3 handPos) { throwingActionData.IsThrow = true; throwingActionData.IsThrowing = true; throwingActionData.ShowCountdownUI = false; throwingActionData.throwBackupPos = handPos; }
public static void CleanThrowingState(this ThrowingActionData actionData, bool interrupt = false) { if (actionData.IsPull) { //若已拉栓,销毁ThrowingEntity ThrowingEntityFactory.DestroyThrowing(actionData.ThrowingEntityKey); } actionData.IsReady = false; actionData.InternalCleanUp(interrupt); }
public static bool TrySetSwitch(this ThrowingActionData throwingActionData, int currentTime) { if (throwingActionData.IsReady && !throwingActionData.IsThrow && (currentTime - throwingActionData.LastSwitchTime) >= GlobalConst.SwitchCdTime) { throwingActionData.LastSwitchTime = currentTime; throwingActionData.IsNearThrow = !throwingActionData.IsNearThrow; return(true); } return(false); }
public void ThrowActionExecute() { if (!entity.hasThrowingAction) { return; } ThrowingActionData actionData = RelatedThrowAction; if (actionData.IsReady && actionData.IsPull) { //若已拉栓,销毁ThrowingEntity actionData.IsInterrupt = true; } //打断投掷动作 RelatedCharState.ForceFinishGrenadeThrow(); //清理手雷状态 actionData.InternalCleanUp(); }
private void RefreshThrowingData(PlayerEntity player) { ThrowingActionData actionData = player.throwingAction.ActionData; var throwAmmunitionCalculator = SingletonManager.Get <ThrowAmmunitionCalculator>(); var dir = throwAmmunitionCalculator.GetFireDir(0, player.WeaponController(), 0); if (actionData.IsNearThrow) { actionData.Vel = dir * actionData.Config.NearInitSpeed; } else { actionData.Vel = dir * actionData.Config.FarInitSpeed; } actionData.Pos = throwAmmunitionCalculator.GetFireViewPosition(player.WeaponController()); actionData.Gravity = actionData.Config.Gravity; actionData.Decay = actionData.Config.VelocityDecay; actionData.CountdownTime = actionData.Config.CountdownTime; }
public static bool CanPull(this ThrowingActionData throwingActionData) { return(throwingActionData.IsReady && !throwingActionData.IsPull); }
public static void SetReady(this ThrowingActionData throwingActionData, int currKey, ThrowingConfig config) { throwingActionData.IsReady = true; throwingActionData.Config = config; throwingActionData.LastFireWeaponKey = currKey; }
public static bool CanReady(this ThrowingActionData throwingActionData) { return(!throwingActionData.IsReady && throwingActionData.ThrowingEntityKey == EntityKey.Default && throwingActionData.LastFireWeaponKey == 0); }
public static bool CanThrow(this ThrowingActionData throwingActionData) { return(throwingActionData.IsReady && !throwingActionData.IsThrow); }
protected virtual void SyncData(PlayerWeaponController weaponController) { holdAgent = weaponController.HeldWeaponAgent; throwingActionData = weaponController.RelatedThrowAction; }