Update
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector
|
||||
{
|
||||
using IK;
|
||||
using vShooter;
|
||||
namespace PlayerController
|
||||
{
|
||||
public interface vILockCamera
|
||||
{
|
||||
bool LockCamera { get; set; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Event used to the IK Update.
|
||||
/// </summary>
|
||||
public delegate void IKUpdateEvent();
|
||||
|
||||
public partial interface vIShooterIKController
|
||||
{
|
||||
GameObject gameObject { get; }
|
||||
/// <summary>
|
||||
/// IK Solver used to the Left Arm
|
||||
/// </summary>
|
||||
vIKSolver LeftIK { get; }
|
||||
/// <summary>
|
||||
/// IK Solver used to the Right Arm
|
||||
/// </summary>
|
||||
vIKSolver RightIK { get; }
|
||||
/// <summary>
|
||||
/// List with all adjusts
|
||||
/// </summary>
|
||||
vWeaponIKAdjustList WeaponIKAdjustList { get; set; }
|
||||
/// <summary>
|
||||
/// Current IK with adjusts for current weapon
|
||||
/// </summary>
|
||||
vWeaponIKAdjust CurrentWeaponIK { get; }
|
||||
/// <summary>
|
||||
/// Current adjust based on <seealso cref="CurrentIKAdjustState"/>
|
||||
/// </summary>
|
||||
IKAdjust CurrentIKAdjust { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Update <seealso cref="CurrentWeaponIK"/> for Weapon Category
|
||||
/// </summary>
|
||||
void UpdateWeaponIK();
|
||||
|
||||
/// <summary>
|
||||
/// Set Lock aiming state
|
||||
/// </summary>
|
||||
bool LockAiming { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set Lock Hipfire aiming state
|
||||
/// </summary>
|
||||
bool LockHipFireAiming { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current active weapon
|
||||
/// </summary>
|
||||
vShooterWeapon CurrentActiveWeapon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to Edit Global IK Offsets in Editor
|
||||
/// </summary>
|
||||
bool EditingIKGlobalOffset { get; set; }
|
||||
/// <summary>
|
||||
/// Check if Controller is Aiming
|
||||
/// </summary>
|
||||
bool IsAiming { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if Controller is Crouching
|
||||
/// </summary>
|
||||
bool IsCrouching { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if <see cref="CurrentActiveWeapon"/> a Left weapon
|
||||
/// </summary>
|
||||
bool IsLeftWeapon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Aim Position
|
||||
/// </summary>
|
||||
Vector3 AimPosition { get; }
|
||||
/// <summary>
|
||||
/// Current IK adjust state
|
||||
/// </summary>
|
||||
string CurrentIKAdjustState { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Current IK adjust state including weapon Category separeted by @ "Category@State"
|
||||
/// </summary>
|
||||
string CurrentIKAdjustStateWithTag { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if Is using a custom ik adjust
|
||||
/// </summary>
|
||||
bool IsUsingCustomIKAdjust { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if can use IK
|
||||
/// </summary>
|
||||
bool IsIgnoreIK { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if Support hand ik is enabled
|
||||
/// </summary>
|
||||
bool IsSupportHandIKEnabled { get; }
|
||||
/// <summary>
|
||||
/// Current custom IK adjust State
|
||||
/// </summary>
|
||||
string CustomIKAdjustState { get; }
|
||||
/// <summary>
|
||||
/// Set a custom IK state
|
||||
/// </summary>
|
||||
/// <param name="value">IK state name</param>
|
||||
void SetCustomIKAdjustState(string value);
|
||||
/// <summary>
|
||||
/// Reset custom IK to use Default ik state
|
||||
/// </summary>
|
||||
void ResetCustomIKAdjustState();
|
||||
/// <summary>
|
||||
/// Event called when IK is Started
|
||||
/// </summary>
|
||||
event IKUpdateEvent onStartUpdateIK;
|
||||
/// <summary>
|
||||
/// Event called when IK Update is Finished
|
||||
/// </summary>
|
||||
event IKUpdateEvent onFinishUpdateIK;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 601ddc50ac29ade4d8afc0bda15525d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace Invector.vShooter
|
||||
{
|
||||
[vClassHeader("Set Weapon IK Settings", openClose = false)]
|
||||
public class vSetWeaponIKSettings : vMonoBehaviour
|
||||
{
|
||||
public List<IKSettings> settings;
|
||||
[System.Serializable]
|
||||
public class IKSettings
|
||||
{
|
||||
public string name;
|
||||
[Tooltip("IK will help the right hand to align where you actually is aiming")]
|
||||
public bool alignRightHandToAim = true;
|
||||
[Tooltip("IK will help the right hand to align where you actually is aiming")]
|
||||
public bool alignRightUpperArmToAim = true;
|
||||
public bool raycastAimTarget = true;
|
||||
public vShooterWeapon.IKLocomotionOptions strafeIKOptions;
|
||||
public vShooterWeapon.IKLocomotionOptions freeIKOptions;
|
||||
[Tooltip("Left IK while attacking")]
|
||||
public bool useIkAttacking = false;
|
||||
[Tooltip("Left IK while Shot")]
|
||||
public bool disableIkOnShot = false;
|
||||
[Tooltip("Left IK while Aming")]
|
||||
public bool useIKOnAiming = true;
|
||||
}
|
||||
|
||||
[vHelpBox("It's recommended to attach this component in a Handler")]
|
||||
|
||||
[Tooltip("Auto get shooter weapon when set settings")]
|
||||
public bool getWeaponOnSet = true;
|
||||
[vHideInInspector("getWeaponOnSet", invertValue = true)]
|
||||
public vShooterWeapon weapon;
|
||||
|
||||
public bool setOnStart;
|
||||
[vHideInInspector("setOnStart")]
|
||||
public int indexOfSetting;
|
||||
public IKSettings defaultIKSettings;
|
||||
bool defaultIsCreated;
|
||||
private void Start()
|
||||
{
|
||||
if (setOnStart)
|
||||
{
|
||||
SetSettings(indexOfSetting);
|
||||
}
|
||||
}
|
||||
private void CopyDefaultIK()
|
||||
{
|
||||
if (!weapon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (defaultIsCreated) return;
|
||||
|
||||
defaultIKSettings.freeIKOptions = weapon.freeIKOptions.Copy();
|
||||
defaultIKSettings.strafeIKOptions = weapon.freeIKOptions.Copy();
|
||||
defaultIKSettings.useIkAttacking = weapon.useIkAttacking;
|
||||
defaultIKSettings.useIKOnAiming = weapon.useIKOnAiming;
|
||||
defaultIKSettings.alignRightHandToAim = weapon.alignRightHandToAim;
|
||||
defaultIKSettings.alignRightUpperArmToAim = weapon.alignRightUpperArmToAim;
|
||||
defaultIKSettings.raycastAimTarget = weapon.raycastAimTarget;
|
||||
defaultIsCreated = true;
|
||||
}
|
||||
|
||||
public void ResetSettings()
|
||||
{
|
||||
if (defaultIsCreated && weapon)
|
||||
{
|
||||
ApplySettings(defaultIKSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSettings(int index)
|
||||
{
|
||||
if (getWeaponOnSet)
|
||||
{
|
||||
var _weapon = GetComponentInChildren<vShooterWeapon>();
|
||||
if (weapon != _weapon) defaultIsCreated = false;
|
||||
}
|
||||
|
||||
if (!weapon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CopyDefaultIK();
|
||||
if (settings.Count > 0 && index >= 0 && index < settings.Count)
|
||||
{
|
||||
IKSettings setting = settings[index];
|
||||
ApplySettings(setting);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSettings(string name)
|
||||
{
|
||||
if (getWeaponOnSet)
|
||||
{
|
||||
var _weapon = GetComponentInChildren<vShooterWeapon>();
|
||||
if (weapon != _weapon) defaultIsCreated = false;
|
||||
}
|
||||
|
||||
if (!weapon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CopyDefaultIK();
|
||||
if (settings.Count > 0)
|
||||
{
|
||||
IKSettings setting = settings.Find(s => s.name.Equals(name));
|
||||
ApplySettings(setting);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplySettings(IKSettings settings)
|
||||
{
|
||||
if (settings == null) return;
|
||||
weapon.alignRightHandToAim = settings.alignRightHandToAim;
|
||||
weapon.alignRightUpperArmToAim = settings.alignRightUpperArmToAim;
|
||||
weapon.raycastAimTarget = settings.raycastAimTarget;
|
||||
weapon.useIkAttacking = settings.useIkAttacking;
|
||||
weapon.useIKOnAiming = settings.useIKOnAiming;
|
||||
weapon.freeIKOptions = settings.freeIKOptions;
|
||||
weapon.strafeIKOptions = settings.strafeIKOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 451b6cb5efabf2943a7b051750b65cbc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,179 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vShooter
|
||||
{
|
||||
|
||||
using IK;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
[CreateAssetMenu(menuName = "Invector/Shooter/New Weapon IK Adjust")]
|
||||
public class vWeaponIKAdjust : ScriptableObject
|
||||
{
|
||||
public const string StandingState = "Standing";
|
||||
public const string StandingAimingState = "StandingAiming";
|
||||
public const string CrouchingState = "Crouching";
|
||||
public const string CrouchingAimingState = "CrouchingAiming";
|
||||
|
||||
public static string[] defaultNames = new string[] { StandingState, StandingAimingState, CrouchingState, CrouchingAimingState };
|
||||
public List<string> weaponCategories = new List<string> { "HandGun", "Pistol" };
|
||||
public List<IKAdjust> ikAdjustsLeft = new List<IKAdjust>();
|
||||
public List<IKAdjust> ikAdjustsRight = new List<IKAdjust>();
|
||||
[vSeparator("<color=yellow><size=15>The fields below will be removed in the future.</size></color>\n<color=green>The old states settings will be automatically added to IKAdjustsLeft and IKAdjustsRight</color>\n<color=white><size=10> If for some reason the default States is not present in the lists, Right Click in this Inspector Header and click in Add Default States</size></color>")]
|
||||
[FormerlySerializedAs("standing")]
|
||||
public IKAdjust standingRight = new IKAdjust("StandingRight");
|
||||
[FormerlySerializedAs("standingAiming")]
|
||||
public IKAdjust standingAimingRight = new IKAdjust("StandingAimingRight");
|
||||
public IKAdjust standingLeft = new IKAdjust("StandingLeft");
|
||||
public IKAdjust standingAimingLeft = new IKAdjust("StandingAimingLeft");
|
||||
[FormerlySerializedAs("crouching")]
|
||||
public IKAdjust crouchingRight = new IKAdjust("CrouchingRight");
|
||||
[FormerlySerializedAs("crouchingAiming")]
|
||||
public IKAdjust crouchingAimingRight = new IKAdjust("CrouchingAimingRight");
|
||||
public IKAdjust crouchingLeft = new IKAdjust("CrouchingLeft");
|
||||
public IKAdjust crouchingAimingLeft = new IKAdjust("CrouchingAimingLeft");
|
||||
public void Awake()
|
||||
{
|
||||
AddDefaultStates();
|
||||
}
|
||||
|
||||
public bool HasAllDefaultStates()
|
||||
{
|
||||
for (int i = 0; i < defaultNames.Length; i++)
|
||||
{
|
||||
if (!ikAdjustsLeft.Exists(a => a.name.Equals(defaultNames[i]))) return false;
|
||||
if (!ikAdjustsRight.Exists(a => a.name.Equals(defaultNames[i]))) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[ContextMenu("Add Default States")]
|
||||
public virtual void AddDefaultStates()
|
||||
{
|
||||
ApplyCorretlyName();
|
||||
AddIKAdjust(standingRight.Copy());
|
||||
AddIKAdjust(standingAimingRight.Copy());
|
||||
AddIKAdjust(crouchingRight.Copy());
|
||||
AddIKAdjust(crouchingAimingRight.Copy());
|
||||
|
||||
AddIKAdjust(standingLeft.Copy(), true);
|
||||
AddIKAdjust(standingAimingLeft.Copy(), true);
|
||||
AddIKAdjust(crouchingLeft.Copy(), true);
|
||||
AddIKAdjust(crouchingAimingLeft.Copy(), true);
|
||||
}
|
||||
|
||||
public virtual void AddIKAdjust(string name, bool isLeftWeapon = false)
|
||||
{
|
||||
var targetList = isLeftWeapon ? ikAdjustsLeft : ikAdjustsRight;
|
||||
if (!targetList.Exists(a => a.name.Equals(name)))
|
||||
{
|
||||
targetList.Add(new IKAdjust(name));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void AddIKAdjust(IKAdjust adjust, bool isLeftWeapon = false)
|
||||
{
|
||||
if (adjust == null) return;
|
||||
var targetList = isLeftWeapon ? ikAdjustsLeft : ikAdjustsRight;
|
||||
|
||||
if (!targetList.Exists(a => a.name.Equals(adjust.name)))
|
||||
{
|
||||
targetList.Add(adjust);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual IKAdjust CreateIKAdjust(string name, bool isLeftWeapon = false)
|
||||
{
|
||||
var targetList = isLeftWeapon ? ikAdjustsLeft : ikAdjustsRight;
|
||||
if (!targetList.Exists(a => a.name.Equals(name)))
|
||||
{
|
||||
var ikAdjust = new IKAdjust(name);
|
||||
targetList.Add(ikAdjust);
|
||||
return ikAdjust;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetIKAdjust(name, isLeftWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string GetDefaultStateName(vIShooterIKController controller)
|
||||
{
|
||||
bool IsAiming = controller.IsAiming;
|
||||
bool IsCrouching = controller.IsCrouching;
|
||||
return /*If*/IsAiming ? IsCrouching ? vWeaponIKAdjust.CrouchingAimingState : vWeaponIKAdjust.StandingAimingState :
|
||||
/*else*/
|
||||
IsCrouching ? vWeaponIKAdjust.CrouchingState : vWeaponIKAdjust.StandingState;
|
||||
}
|
||||
|
||||
public virtual IKAdjust GetIKAdjust(bool isAming, bool isCrouching, bool isLeftWeapon)
|
||||
{
|
||||
if (isAming)
|
||||
{
|
||||
if (isCrouching) return isLeftWeapon ? crouchingAimingLeft : crouchingAimingRight;
|
||||
else return isLeftWeapon ? standingAimingLeft : standingAimingRight;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isCrouching) return isLeftWeapon ? crouchingLeft : crouchingRight;
|
||||
else return isLeftWeapon ? standingLeft : standingRight;
|
||||
}
|
||||
}
|
||||
|
||||
[ContextMenu("Reset Standing")]
|
||||
public virtual void ResetStanding()
|
||||
{
|
||||
standingLeft = new IKAdjust("StandingLeft");
|
||||
standingRight = new IKAdjust("StandingRight");
|
||||
}
|
||||
|
||||
[ContextMenu("Reset Standing Aiming")]
|
||||
public virtual void ResetStandingAiming()
|
||||
{
|
||||
standingAimingLeft = new IKAdjust("StandingAimingLeft");
|
||||
standingAimingRight = new IKAdjust("StandingAimingRight");
|
||||
}
|
||||
|
||||
[ContextMenu("Reset Crouching")]
|
||||
public virtual void ResetCrouching()
|
||||
{
|
||||
crouchingLeft = new IKAdjust("CrouchingLeft");
|
||||
crouchingRight = new IKAdjust("CrouchingRight");
|
||||
}
|
||||
|
||||
[ContextMenu("Reset Crouching Aiming")]
|
||||
public virtual void ResetCrouchingAiming()
|
||||
{
|
||||
crouchingAimingLeft = new IKAdjust("CrouchingAimingLeft");
|
||||
crouchingAimingRight = new IKAdjust("CrouchingAimingRight");
|
||||
}
|
||||
|
||||
[ContextMenu("Reset Default Adjust Names")]
|
||||
public virtual void ApplyCorretlyName()
|
||||
{
|
||||
standingRight.name = StandingState;
|
||||
standingAimingRight.name = StandingAimingState;
|
||||
standingLeft.name = StandingState;
|
||||
standingAimingLeft.name = StandingAimingState;
|
||||
crouchingRight.name = CrouchingState;
|
||||
crouchingAimingRight.name = CrouchingAimingState;
|
||||
crouchingLeft.name = CrouchingState;
|
||||
crouchingAimingLeft.name = CrouchingAimingState;
|
||||
}
|
||||
[ContextMenu("Reset ALL")]
|
||||
public virtual void Reset()
|
||||
{
|
||||
ResetStanding();
|
||||
ResetStandingAiming();
|
||||
ResetCrouching();
|
||||
ResetCrouchingAiming();
|
||||
ApplyCorretlyName();
|
||||
}
|
||||
|
||||
public virtual IKAdjust GetIKAdjust(string name, bool isLeftWeapon)
|
||||
{
|
||||
var list = isLeftWeapon ? ikAdjustsLeft : ikAdjustsRight;
|
||||
return list.Find(ik => ik.name.Equals(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d054d6e948083b0469b2ff301c0adbab
|
||||
timeCreated: 1563655439
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEngine;
|
||||
namespace Invector.IK
|
||||
{
|
||||
public static class vWeaponIKAdjustHelper
|
||||
{
|
||||
public static IKAdjust Copy(this IKAdjust iKAdjust)
|
||||
{
|
||||
IKAdjust newCopy = new IKAdjust();
|
||||
newCopy.name = iKAdjust.name;
|
||||
newCopy.spineOffset = iKAdjust.spineOffset.Copy();
|
||||
newCopy.supportHandOffset = iKAdjust.supportHandOffset.Copy();
|
||||
newCopy.supportHintOffset = iKAdjust.supportHintOffset.Copy();
|
||||
newCopy.weaponHandOffset = iKAdjust.weaponHandOffset.Copy();
|
||||
newCopy.weaponHintOffset = iKAdjust.weaponHintOffset.Copy();
|
||||
|
||||
return newCopy;
|
||||
}
|
||||
|
||||
public static IKAdjust Copy(this IKAdjust iKAdjust, string name)
|
||||
{
|
||||
IKAdjust newCopy = new IKAdjust();
|
||||
newCopy.name = name;
|
||||
newCopy.spineOffset = iKAdjust.spineOffset.Copy();
|
||||
newCopy.supportHandOffset = iKAdjust.supportHandOffset.Copy();
|
||||
newCopy.supportHintOffset = iKAdjust.supportHintOffset.Copy();
|
||||
newCopy.weaponHandOffset = iKAdjust.weaponHandOffset.Copy();
|
||||
newCopy.weaponHintOffset = iKAdjust.weaponHintOffset.Copy();
|
||||
|
||||
return newCopy;
|
||||
}
|
||||
|
||||
public static IKOffsetSpine Copy(this IKOffsetSpine iKOffsetSpine)
|
||||
{
|
||||
IKOffsetSpine newCopy = new IKOffsetSpine();
|
||||
newCopy.head = iKOffsetSpine.head;
|
||||
newCopy.spine = iKOffsetSpine.spine;
|
||||
return newCopy;
|
||||
}
|
||||
|
||||
public static IKOffsetTransform Copy(this IKOffsetTransform iKOffsetTransform)
|
||||
{
|
||||
IKOffsetTransform newCopy = new IKOffsetTransform();
|
||||
newCopy.position = iKOffsetTransform.position;
|
||||
newCopy.eulerAngles = iKOffsetTransform.eulerAngles;
|
||||
return newCopy;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class IKAdjust
|
||||
{
|
||||
public string name;
|
||||
[ContextMenuItem("Copy", "ResetBiography")]
|
||||
public IKOffsetTransform weaponHandOffset = new IKOffsetTransform();
|
||||
public IKOffsetTransform weaponHintOffset = new IKOffsetTransform();
|
||||
public IKOffsetTransform supportHandOffset = new IKOffsetTransform();
|
||||
public IKOffsetTransform supportHintOffset = new IKOffsetTransform();
|
||||
public IKOffsetSpine spineOffset = new IKOffsetSpine();
|
||||
public IKAdjust()
|
||||
{
|
||||
|
||||
}
|
||||
public IKAdjust(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class IKOffsetTransform
|
||||
{
|
||||
public Vector3 position;
|
||||
public Vector3 eulerAngles;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class IKOffsetSpine
|
||||
{
|
||||
public Vector2 spine;
|
||||
public Vector2 head;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 822a6d3f89471dc4ea91a245b3e15708
|
||||
timeCreated: 1563758330
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vShooter
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Invector/Shooter/New Weapon IK Adjust List")]
|
||||
public class vWeaponIKAdjustList : ScriptableObject
|
||||
{
|
||||
[vSeparator("Global Offsets for all Weapons Hand IK target")]
|
||||
public Vector3 ikTargetPositionOffsetR;
|
||||
public Vector3 ikTargetRotationOffsetR;
|
||||
public Vector3 ikTargetPositionOffsetL;
|
||||
public Vector3 ikTargetRotationOffsetL;
|
||||
[vSeparator("Offsets for specific Weapon categories")]
|
||||
public List<vWeaponIKAdjust> weaponIKAdjusts = new List<vWeaponIKAdjust>();
|
||||
|
||||
|
||||
|
||||
|
||||
public vWeaponIKAdjust GetWeaponIK(string category)
|
||||
{
|
||||
return (weaponIKAdjusts!=null? weaponIKAdjusts.Find(ik =>ik!=null && ik.weaponCategories.Contains(category)):null);
|
||||
}
|
||||
|
||||
public void ReplaceWeaponIKAdjust(vWeaponIKAdjust currentIK, vWeaponIKAdjust newIK)
|
||||
{
|
||||
if (weaponIKAdjusts != null && weaponIKAdjusts.Contains(currentIK))
|
||||
{
|
||||
int index = IndexOfIK(currentIK);
|
||||
weaponIKAdjusts[index] = newIK;
|
||||
}
|
||||
}
|
||||
|
||||
public int IndexOfIK(vWeaponIKAdjust currentIK)
|
||||
{
|
||||
if (weaponIKAdjusts != null && weaponIKAdjusts.Contains(currentIK))
|
||||
{
|
||||
int index = weaponIKAdjusts.IndexOf(currentIK);
|
||||
return index;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb2afe458380a5a4aafc1781a445552d
|
||||
timeCreated: 1564434366
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user