// returns true if autoKey successful public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aobj, int frame, int frameRate) { Transform t = GetTarget(itarget) as Transform; if (!t || aobj != t) { return(false); } if (keys.Count <= 0) { if (GetPosition(t) != cachedInitialPosition) { // if updated position, addkey addKey(itarget, addCall, frame, GetPosition(t)); return(true); } return(false); } Vector3 oldPos = getPositionAtFrame(t, frame, frameRate, false); if (GetPosition(t) != oldPos) { // if updated position, addkey addKey(itarget, addCall, frame, GetPosition(t)); return(true); } return(false); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Vector3 _position, int _interp, int _easeType) { foreach (AMTranslationKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { key.position = _position; key.interp = _interp; key.easeType = _easeType; // update cache updateCache(itarget); return; } } AMTranslationKey a = addCall(gameObject, typeof(AMTranslationKey)) as AMTranslationKey; a.frame = _frame; a.position = _position; a.interp = _interp; a.easeType = _easeType; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// returns true if autoKey successful, sets output key public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aObj, int frame, int frameRate) { Transform t = GetTarget(itarget) as Transform; if (!t || t != aObj) { return(false); } Quaternion r = t.localRotation; if (keys.Count <= 0) { if (r != cachedInitialRotation) { // if updated position, addkey addKey(itarget, addCall, frame, r); return(true); } return(false); } Quaternion oldRot = getRotationAtFrame(frame, frameRate); if (r != oldRot) { // if updated position, addkey addKey(itarget, addCall, frame, r); return(true); } return(false); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Camera camera = null,/*int? type = null, Camera camera = null, Color? color = null,*/ AMCameraSwitcherKey keyToClone = null) { foreach(AMCameraSwitcherKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { if(camera != null) { key.setCamera(itarget, camera); key.type = 0; updateCache(itarget); } return; } } AMCameraSwitcherKey a = addCall(gameObject, typeof(AMCameraSwitcherKey)) as AMCameraSwitcherKey; if(keyToClone) { keyToClone.CopyTo(a); } else { a.type = 0; a.still = !AMTakeData.isProLicense; a.easeType = (int)EaseType.EaseOutSine; } a.frame = _frame; if(camera != null) { a.setCamera(itarget, camera); a.type = 0; } // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget target, OnAddKey addCall, int _frame, Quaternion _rotation) { foreach (AMRotationKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { key.rotation = _rotation; // update cache updateCache(target); return; } } AMRotationKey a = addCall(gameObject, typeof(AMRotationKey)) as AMRotationKey; a.frame = _frame; a.rotation = _rotation; // set default ease type to linear a.easeType = (int)Ease.Linear; // add a new key keys.Add(a); // update cache updateCache(target); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame) { foreach(AMEventKey key in keys) { // if key exists on frame, do nothing if(key.frame == _frame) { return; } } AMEventKey a = addCall(gameObject, typeof(AMEventKey)) as AMEventKey; a.frame = _frame; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget target, OnAddKey addCall, int _frame) { foreach(AMGOSetActiveKey key in keys) { // if key exists on frame, update if(key.frame == _frame) { key.setActive = true; updateCache(target); return; } } AMGOSetActiveKey a = addCall(gameObject, typeof(AMGOSetActiveKey)) as AMGOSetActiveKey; a.frame = _frame; a.setActive = true; // add a new key keys.Add(a); // update cache updateCache(target); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame) { foreach (AMTriggerKey key in keys) { // if key exists on frame, do nothing if (key.frame == _frame) { return; } } AMTriggerKey a = addCall(gameObject, typeof(AMTriggerKey)) as AMTriggerKey; a.frame = _frame; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AudioClip _clip, bool _loop) { foreach(AMAudioKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { key.audioClip = _clip; key.loop = _loop; // update cache updateCache(itarget); } } AMAudioKey a = addCall(gameObject, typeof(AMAudioKey)) as AMAudioKey; a.frame = _frame; a.audioClip = _clip; a.loop = _loop; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key, default interpolation and easeType public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Vector3 _position) { foreach(AMTranslationKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { key.position = _position; // update cache updateCache(itarget); return; } } AMTranslationKey a = addCall(gameObject, typeof(AMTranslationKey)) as AMTranslationKey; a.frame = _frame; a.position = _position; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AnimationClip _clip, WrapMode _wrapMode) { foreach(AMAnimationKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { key.amClip = _clip; key.wrapMode = _wrapMode; // update cache updateCache(itarget); return; } } AMAnimationKey a = addCall(gameObject, typeof(AMAnimationKey)) as AMAnimationKey; a.frame = _frame; a.amClip = _clip; a.wrapMode = _wrapMode; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget target, OnAddKey addCall, int _frame) { foreach (AMGOSetActiveKey key in keys) { // if key exists on frame, update if (key.frame == _frame) { key.setActive = true; updateCache(target); return; } } AMGOSetActiveKey a = addCall(gameObject, typeof(AMGOSetActiveKey)) as AMGOSetActiveKey; a.frame = _frame; a.setActive = true; // add a new key keys.Add(a); // update cache updateCache(target); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Transform target) { foreach(AMOrientationKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { key.SetTarget(itarget, target); // update cache updateCache(itarget); return; } } AMOrientationKey a = addCall(gameObject, typeof(AMOrientationKey)) as AMOrientationKey; a.frame = _frame; a.SetTarget(itarget, target); // set default ease type to linear a.easeType = (int)0;// AMTween.EaseType.linear; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget target, OnAddKey addCall, int _frame, Quaternion _rotation) { foreach(AMRotationKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { key.rotation = _rotation; // update cache updateCache(target); return; } } AMRotationKey a = addCall(gameObject, typeof(AMRotationKey)) as AMRotationKey; a.frame = _frame; a.rotation = _rotation; // set default ease type to linear a.easeType = (int)EaseType.Linear; // add a new key keys.Add(a); // update cache updateCache(target); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Camera camera = null, /*int? type = null, Camera camera = null, Color? color = null,*/ AMCameraSwitcherKey keyToClone = null) { foreach (AMCameraSwitcherKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { if (camera != null) { key.setCamera(itarget, camera); key.type = 0; updateCache(itarget); } return; } } AMCameraSwitcherKey a = addCall(gameObject, typeof(AMCameraSwitcherKey)) as AMCameraSwitcherKey; if (keyToClone) { keyToClone.CopyTo(a); } else { a.type = 0; a.still = !AMTakeData.isProLicense; a.easeType = (int)Ease.OutSine; } a.frame = _frame; if (camera != null) { a.setCamera(itarget, camera); a.type = 0; } // add a new key keys.Add(a); // update cache updateCache(itarget); }
// returns true if autoKey successful, sets output key public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aObj, int frame, int frameRate) { Transform t = GetTarget(itarget) as Transform; if(!t || t != aObj) { return false; } Quaternion r = t.localRotation; if(keys.Count <= 0) { if(r != cachedInitialRotation) { // if updated position, addkey addKey(itarget, addCall, frame, r); return true; } return false; } Quaternion oldRot = getRotationAtFrame(frame, frameRate); if(r != oldRot) { // if updated position, addkey addKey(itarget, addCall, frame, r); return true; } return false; }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AudioClip _clip, bool _loop) { foreach (AMAudioKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { key.audioClip = _clip; key.loop = _loop; // update cache updateCache(itarget); } } AMAudioKey a = addCall(gameObject, typeof(AMAudioKey)) as AMAudioKey; a.frame = _frame; a.audioClip = _clip; a.loop = _loop; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AnimationClip _clip, WrapMode _wrapMode) { foreach (AMAnimationKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { key.amClip = _clip; key.wrapMode = _wrapMode; // update cache updateCache(itarget); return; } } AMAnimationKey a = addCall(gameObject, typeof(AMAnimationKey)) as AMAnimationKey; a.frame = _frame; a.amClip = _clip; a.wrapMode = _wrapMode; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add a new key public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Transform target) { foreach (AMOrientationKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { key.SetTarget(itarget, target); // update cache updateCache(itarget); return; } } AMOrientationKey a = addCall(gameObject, typeof(AMOrientationKey)) as AMOrientationKey; a.frame = _frame; a.SetTarget(itarget, target); // set default ease type to linear a.easeType = (int)Ease.Linear; // AMTween.EaseType.linear; // add a new key keys.Add(a); // update cache updateCache(itarget); }
// add key public AMPropertyKey addKey(AMITarget target, OnAddKey addCall, int _frame) { Component comp = GetTargetComp(target); RefreshData(comp); AMPropertyKey k = null; foreach (AMPropertyKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { k = key; } } if (k == null) { k = addCall(gameObject, typeof(AMPropertyKey)) as AMPropertyKey; k.frame = _frame; k.interp = (int)(canTween ? AMKey.Interpolation.Linear : AMKey.Interpolation.None); // add a new key keys.Add(k); } if (isValueTypeNumeric(valueType)) { k.val = Convert.ToDouble(getCachedInfoValue(target)); } else if (valueType == (int)ValueType.Bool) { k.valb = Convert.ToBoolean(getCachedInfoValue(target)); } else if (valueType == (int)ValueType.String) { k.valString = Convert.ToString(getCachedInfoValue(target)); } else if (valueType == (int)ValueType.Vector2) { k.vect2 = (Vector2)getCachedInfoValue(target); } else if (valueType == (int)ValueType.Vector3) { k.vect3 = (Vector3)getCachedInfoValue(target); } else if (valueType == (int)ValueType.Color) { k.color = (Color)getCachedInfoValue(target); } else if (valueType == (int)ValueType.Rect) { k.rect = (Rect)getCachedInfoValue(target); } else if (valueType == (int)ValueType.Vector4) { k.vect4 = (Vector4)getCachedInfoValue(target); } else if (valueType == (int)ValueType.Quaternion) { k.quat = (Quaternion)getCachedInfoValue(target); } else if (valueType == (int)ValueType.Sprite) { k.valObj = (UnityEngine.Object)getCachedInfoValue(target); } else if (valueType == (int)ValueType.Enum) { k.val = Convert.ToDouble(getCachedInfoValue(target)); } else { Debug.LogError("Animator: Invalid ValueType " + valueType.ToString()); } // update cache updateCache(target); return(k); }
// add key public AMPropertyKey addKey(AMITarget target, OnAddKey addCall, int _frame) { Component comp = GetTargetComp(target); RefreshData(comp); AMPropertyKey k = null; foreach(AMPropertyKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { k = key; } } if(k == null) { k = addCall(gameObject, typeof(AMPropertyKey)) as AMPropertyKey; k.frame = _frame; k.interp = (int)(canTween ? AMKey.Interpolation.Linear : AMKey.Interpolation.None); // add a new key keys.Add(k); } if(isValueTypeNumeric(valueType)) k.val = Convert.ToDouble(getCachedInfoValue(target)); else if(valueType == (int)ValueType.Bool) k.valb = Convert.ToBoolean(getCachedInfoValue(target)); else if(valueType == (int)ValueType.String) k.valString =Convert.ToString(getCachedInfoValue(target)); else if(valueType == (int)ValueType.Vector2) k.vect2 = (Vector2)getCachedInfoValue(target); else if(valueType == (int)ValueType.Vector3) k.vect3 = (Vector3)getCachedInfoValue(target); else if(valueType == (int)ValueType.Color) k.color = (Color)getCachedInfoValue(target); else if(valueType == (int)ValueType.Rect) k.rect = (Rect)getCachedInfoValue(target); else if(valueType == (int)ValueType.Vector4) k.vect4 = (Vector4)getCachedInfoValue(target); else if(valueType == (int)ValueType.Quaternion) k.quat = (Quaternion)getCachedInfoValue(target); else if(valueType == (int)ValueType.Sprite) k.valObj = (UnityEngine.Object)getCachedInfoValue(target); else if(valueType == (int)ValueType.Enum) k.val = Convert.ToDouble(getCachedInfoValue(target)); else { Debug.LogError("Animator: Invalid ValueType " + valueType.ToString()); } // update cache updateCache(target); return k; }
// returns true if autoKey successful public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aobj, int frame, int frameRate) { Transform t = GetTarget(itarget) as Transform; if(!t || aobj != t) { return false; } if(keys.Count <= 0) { if(GetPosition(t) != cachedInitialPosition) { // if updated position, addkey addKey(itarget, addCall, frame, GetPosition(t)); return true; } return false; } Vector3 oldPos = getPositionAtFrame(t, frame, frameRate, false); if(GetPosition(t) != oldPos) { // if updated position, addkey addKey(itarget, addCall, frame, GetPosition(t)); return true; } return false; }
internal void OnAddKey_Trigger(PlayerState player) => OnAddKey?.Handle(args: new object[] { player }, unique: true);
public AMMaterialKey addKey(AMITarget target, OnAddKey addCall, int _frame) { Material mat = GetMaterial(target); //mat.get // AMMaterialKey k = null; foreach(AMMaterialKey key in keys) { // if key exists on frame, update key if(key.frame == _frame) { k = key; } } if(k == null) { k = addCall(gameObject, typeof(AMMaterialKey)) as AMMaterialKey; k.frame = _frame; k.interp = (int)AMKey.Interpolation.Linear; // add a new key keys.Add(k); } //set value if(!string.IsNullOrEmpty(property)) { switch(_propertyType) { case ValueType.Float: case ValueType.Range: k.val = mat.GetFloat(property); break; case ValueType.Vector: k.vector = mat.GetVector(property); break; case ValueType.Color: k.color = mat.GetColor(property); break; case ValueType.TexEnv: k.texture = mat.GetTexture(property); break; case ValueType.TexOfs: k.texOfs = mat.GetTextureOffset(property); break; case ValueType.TexScale: k.texScale = mat.GetTextureScale(property); break; } } else { Debug.LogWarning("Property is not set in: "+name); } updateCache(target); return k; }
public AMMaterialKey addKey(AMITarget target, OnAddKey addCall, int _frame) { Material mat = GetMaterial(target); //mat.get // AMMaterialKey k = null; foreach (AMMaterialKey key in keys) { // if key exists on frame, update key if (key.frame == _frame) { k = key; } } if (k == null) { k = addCall(gameObject, typeof(AMMaterialKey)) as AMMaterialKey; k.frame = _frame; k.interp = (int)AMKey.Interpolation.Linear; // add a new key keys.Add(k); } //set value if (!string.IsNullOrEmpty(property)) { switch (_propertyType) { case ValueType.Float: case ValueType.Range: k.val = mat.GetFloat(property); break; case ValueType.Vector: k.vector = mat.GetVector(property); break; case ValueType.Color: k.color = mat.GetColor(property); break; case ValueType.TexEnv: k.texture = mat.GetTexture(property); break; case ValueType.TexOfs: k.texOfs = mat.GetTextureOffset(property); break; case ValueType.TexScale: k.texScale = mat.GetTextureScale(property); break; } } else { Debug.LogWarning("Property is not set in: " + name); } updateCache(target); return(k); }