本文整理汇总了C#中AMITarget类的典型用法代码示例。如果您正苦于以下问题:C# AMITarget类的具体用法?C# AMITarget怎么用?C# AMITarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AMITarget类属于命名空间,在下文中一共展示了AMITarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getDependencies
public override List<GameObject> getDependencies(AMITarget itarget)
{
Transform t = GetTarget(itarget) as Transform;
List<GameObject> ls = new List<GameObject>();
if(t) ls.Add(t.gameObject);
return ls;
}
示例2: previewFrame
// preview a frame in the scene view
public override void previewFrame(AMITarget target, float frame, int frameRate, bool play, float playSpeed)
{
GameObject go = GetTarget(target) as GameObject;
if(keys == null || keys.Count <= 0) {
return;
}
if(!go) return;
// if before the first frame
if(frame < (float)keys[0].frame) {
//go.rotation = (cache[0] as AMPropertyAction).getStartQuaternion();
go.SetActive(startActive);
return;
}
// if beyond or equal to last frame
if(frame >= (float)(keys[keys.Count - 1] as AMGOSetActiveKey).frame) {
go.SetActive((keys[keys.Count - 1] as AMGOSetActiveKey).setActive);
return;
}
// if lies on property action
foreach(AMGOSetActiveKey key in keys) {
if((frame < (float)key.frame) || (key.endFrame != -1 && frame >= (float)key.endFrame)) continue;
go.SetActive(key.setActive);
return;
}
}
示例3: getDependencies
public override List<GameObject> getDependencies(AMITarget target)
{
AudioSource src = GetTarget(target) as AudioSource;
List<GameObject> ls = new List<GameObject>();
if(src) ls.Add(src.gameObject);
return ls;
}
示例4: getDependencies
public override List<GameObject> getDependencies(AMITarget target)
{
GameObject go = GetTarget(target) as GameObject;
List<GameObject> ls = new List<GameObject>();
if(go) ls.Add(go);
return ls;
}
示例5: addKey
// 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);
}
示例6: updateDependencies
public override List<GameObject> updateDependencies(AMITarget target, List<GameObject> newReferences, List<GameObject> oldReferences)
{
GameObject go = GetTarget(target) as GameObject;
bool didUpdateObj = false;
bool didUpdateParameter = false;
if(go) {
for(int i = 0; i < oldReferences.Count; i++) {
if(oldReferences[i] == go) {
// check if new GameObject has all the required components
foreach(AMEventKey key in keys) {
string componentName = key.getComponentName();
if(newReferences[i].GetComponent(componentName) == null) {
// missing component
Debug.LogWarning("Animator: Event Track component '" + componentName + "' not found on new reference for GameObject '" + obj.name + "'. Duplicate not replaced.");
List<GameObject> lsFlagToKeep = new List<GameObject>();
lsFlagToKeep.Add(oldReferences[i]);
return lsFlagToKeep;
}
}
SetTarget(target, newReferences[i].transform);
didUpdateObj = true;
break;
}
}
}
foreach(AMEventKey key in keys) {
if(key.updateDependencies(newReferences, oldReferences, didUpdateObj, go) && !didUpdateParameter) didUpdateParameter = true;
}
if(didUpdateObj || didUpdateParameter) updateCache(target);
return new List<GameObject>();
}
示例7: AMSequence
public AMSequence(AMITarget itarget, int id, AMTakeData take)
{
mTarget = itarget;
mId = id;
mTake = take;
if(mTake.loopBackToFrame > 0 && mTake.numLoop <= 0)
mTake.numLoop = 1;
}
示例8: getDependencies
public override List<GameObject> getDependencies(AMITarget target)
{
GameObject go = GetTarget(target) as GameObject;
List<GameObject> ls = new List<GameObject>();
if(go) ls.Add(go);
foreach(AMEventKey key in keys) {
ls = ls.Union(key.getDependencies()).ToList();
}
return ls;
}
示例9: Pause
public override void Pause(AMITarget itarget)
{
AudioSource src = GetTarget(itarget) as AudioSource;
if(src && src.isPlaying) {
pausedLoop = src.loop && src.clip && src.clip.length - src.time < 1f; //only end loop if it's short enough to do so
if(pausedLoop)
src.loop = false;
else
src.Pause();
paused = true;
}
}
示例10: getAllCameras
public Camera[] getAllCameras(AMITarget itarget)
{
List<Camera> lsCameras = new List<Camera>();
foreach(AMCameraSwitcherKey key in keys) {
Camera cam = key.getCamera(itarget);
if(key.type == 0 && cam) {
if(lsCameras.IndexOf(cam) == -1) {
lsCameras.Add(cam);
}
}
}
return lsCameras.ToArray();
}
示例11: drawGizmos
// draw gizmos
public override void drawGizmos(AMITarget itarget, float gizmo_size, bool inPlayMode, int frame)
{
if(!obj) return;
// draw line to target
bool isLineDrawn = false;
if(!inPlayMode) {
for(int i = 0; i < keys.Count; i++) {
AMOrientationKey key = keys[i] as AMOrientationKey;
if(key == null)
continue;
AMOrientationKey keyNext = i + 1 < keys.Count ? keys[i + 1] as AMOrientationKey : null;
Transform t = key.GetTarget(itarget);
if(t) {
//draw target
Gizmos.color = new Color(245f/255f, 107f/255f, 30f/255f, 1f);
Gizmos.DrawSphere(t.position, 0.2f * (AnimatorTimeline.e_gizmoSize/0.1f));
//draw line
if(!isLineDrawn) {
if(key.frame > frame) isLineDrawn = true;
if(frame >= key.frame && frame <= key.endFrame) {
if(!keyNext || t == keyNext.GetTarget(itarget)) {
Gizmos.color = new Color(245f / 255f, 107f / 255f, 30f / 255f, 0.2f);
Gizmos.DrawLine(obj.transform.position, t.position);
}
isLineDrawn = true;
}
}
}
}
}
// draw arrow
Gizmos.color = new Color(245f / 255f, 107f / 255f, 30f / 255f, 1f);
Vector3 pos = obj.transform.position;
float size = (1.2f * (gizmo_size / 0.1f));
if(size < 0.1f) size = 0.1f;
Vector3 direction = obj.forward * size;
float arrowHeadAngle = 20f;
float arrowHeadLength = 0.3f * size;
Gizmos.DrawRay(pos, direction);
Vector3 right = Quaternion.LookRotation(direction) * Quaternion.Euler(0, 180 + arrowHeadAngle, 0) * new Vector3(0, 0, 1);
Vector3 left = Quaternion.LookRotation(direction) * Quaternion.Euler(0, 180 - arrowHeadAngle, 0) * new Vector3(0, 0, 1);
Gizmos.DrawRay(pos + direction, right * arrowHeadLength);
Gizmos.DrawRay(pos + direction, left * arrowHeadLength);
}
示例12: addKey
// 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);
}
示例13: addKey
// 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);
}
示例14: getCamera
public Camera getCamera(AMITarget itarget)
{
if(itarget.isMeta) {
if(!string.IsNullOrEmpty(_cameraPath)) {
Transform t = itarget.GetCache(_cameraPath);
if(t)
return t.GetComponent<Camera>();
else {
t = AMUtil.GetTarget(itarget.root, _cameraPath);
itarget.SetCache(_cameraPath, t);
if(t)
return t.GetComponent<Camera>();
}
}
return null;
}
else
return _camera;
}
示例15: addKey
// 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);
}