public void Add(AnimationID id, SealedAnimation sa) { if (animationIDToAnimationObject == null) { animationIDToAnimationObject = new Dictionary<AnimationID, SealedAnimation>(); } animationIDToAnimationObject.Add(id, sa); }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.E)) { anim = AnimationID.Ekard_Attack_01; } }
protected int CalculateDamage(AnimationID attackID) { if (attackID == AnimationID.ATTACK_3) { return(3); } return(1); }
private CharacterAnimation _GetAnimation(AnimationID id) { foreach (CharacterAnimation anim in GetComponentsInChildren<CharacterAnimation>(true)) { if (anim.id == id) { return anim; } } return null; }
public void TauntCommand() { string animID = AnimationID.GetTaunt(); if (animID == null) { return; } p_UnitAnimator.SetTrigger(animID); }
public CharacterAnimation GetAnimation(AnimationID id) { CharacterAnimation anim = _GetAnimation(id); if (anim == null) { anim = new GameObject(id.ToString()).AddComponent<CharacterAnimation>(); anim.transform.parent = transform; anim.id = id; anim.followingAnimation = id; } return anim; }
public void BlockCommand() { string animID = AnimationID.GetBlock(); if (animID == null) { return; } p_UnitAnimator.SetTrigger(animID); m_IsInvulnerable = true; }
public void stop(AnimationID id) { if (0 < this.anims.Count) { var anims = this.anims.FindAll(a => a.id().Equals(id)); foreach (IAnimation anim in anims) { anim.stop(); } this.anims.RemoveAll(a => a.id().Equals(id)); } }
protected AnimationID DoAttack(int comboCount) { AnimationID attackID = (AnimationID)((int)AnimationID.ATTACK_1 + comboCount % 2); //Debug.Log(attackID); PlayAnimation(attackID, true); MoveToward(transform.forward); int damage = CalculateDamage(attackID); HandleDealingDamage(damage); return(attackID); }
public void PlayImmediate(AnimationID id, AnimationCallBack callback, object arg, AnimationEndEventCallBack endEventCallBack, object endEventArg) { // //if (!gameObject.activeInHierarchy) return; //_callback = callback; //_arg = arg; // _endEventCallBack = endEventCallBack; // _endEventArg = endEventArg; ////_stateHash = Animator.StringToHash(_id2Name[(int)id]); // if (_animator != null) { // _animator.SetInteger(kAnimatorStateParam, (int)id); // _animator.CrossFade(_id2Name[(int)id], 0); // } }
public SealedFrame StartAnimationOrNext(AnimationID animationId, AnimationID? backup=null) { DisableCurrentFrame(); if (currentAnimation != animationId && (!backup.HasValue || backup.Value != currentAnimation) ) { currentAnimation = animationId; currentFrame = 0; FlipIfNeeded(); return EnableCurrentFrame(); } else { return NextFrame(); } }
public void start(AnimationID id) { switch (id) { case AnimationID.walk: this.anims.Add(new Animation.Walk(this.bones)); break; case AnimationID.touch: this.anims.Add(new Animation.Touch(this.bones)); break; } }
public void Play(AnimationID id, AnimationCallBack callback = null, object arg = null, AnimationEndEventCallBack endEventCallBack = null, object endEventArg = null) { //if (!gameObject.activeInHierarchy) return; _callback = callback; _endEventCallBack = endEventCallBack; _endEventArg = endEventArg; //_stateHash = Animator.StringToHash(_id2Name[(int)id]); _arg = arg; if (_animator != null) { //_animator.SetInteger(kAnimatorStateParam, (int)id); _animator.Play(id.ToString()); } }
public void PlayAnimation(AnimationID id, bool force = false) { if (!force && m_currentAnimation != null && (m_currentAnimation.m_id == id || m_currentAnimation.m_blocking && m_currentFrameIndex < m_currentAnimation.m_frames.Count)) { return; } AnimationData data; if (m_animationMapping.TryGetValue(id, out data)) { PlayAnimation(data); } }
public bool IsPlaying(AnimationID Id, bool inTransition = true) { if (_animator != null) { if (_animator.IsInTransition(0)) { return(inTransition); } AnimatorStateInfo state = _animator.GetCurrentAnimatorStateInfo(0); return(state.IsName(_id2Name[(int)Id])); } else { return(false); } }
public void AttackCommand(Limb limb) { string animID = AnimationID.GetAttackLimb(limb); if (animID == null) { return; } m_LastAttackedLimb = limb; p_UnitAnimator.SetTrigger(animID); m_AttackTrigger = 1.2f; //UnitAnimator.GetCurrentAnimatorClipInfo(0).Length; IsAttacking = true; AudioManager.Instance.Play3DAudio(Resources.Load <AudioClip>("Audio/Woosh"), UnitObj.transform.position, 30, 40); }
/// <summary> /// アニメ関係終了 /// </summary> public void Awake() { _isAlly = true; if (characters == null) { characters = new List <Character>(); } _id = characters.Count; characters.Add(this); _remainHp = _hp; _buff = false; UpdateHpBar(); int headerIdx = 0; foreach (string header in _headerList) { List <Sprite> spriteList = new List <Sprite>(); for (int i = 1; i <= _maxList[headerIdx]; i++) { string numberString; if (i < 10) { numberString = "0" + i; } else { numberString = i.ToString(); } spriteList.Add( (Sprite)Resources.Load <Sprite>(header + numberString) ); } ValueList vl = new ValueList(spriteList); _imageList.Add(vl); headerIdx++; } _passTime = 0f; _counter = 0; _status = AnimationID.stay; }
/// <summary> /// / /// </summary> /// <param name="id"></param> /// <param name="reset"></param> private void SetBaseAnimation(AnimationID id, bool reset) { if ((int)baseAnimID >= 0 && (int)baseAnimID < NumAnims) { // if we have an old animation, fade it out fadingIn[(int)baseAnimID] = false; fadingOut[(int)baseAnimID] = true; } baseAnimID = id; if (id != AnimationID.None) { // if we have a new animation, enable it and fade it in anims[(int)id].IsEnabled = true; anims[(int)id].Weight = 0; fadingOut[(int)id] = false; fadingIn[(int)id] = true; if (reset) { anims[(int)id].Time = 0; } } }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="reset"></param> private void SetTopAnimation(AnimationID id, bool reset) { if ((int)this.topAnimID >= 0 && (int)this.topAnimID < NumAnims) { // if we have an old animation, fade it out this.fadingIn[(int)this.topAnimID] = false; this.fadingOut[(int)this.topAnimID] = true; } this.topAnimID = id; if (id != AnimationID.None) { // if we have a new animation, enable it and fade it in this.anims[(int)id].IsEnabled = true; this.anims[(int)id].Weight = 0; this.fadingOut[(int)id] = false; this.fadingIn[(int)id] = true; if (reset) { this.anims[(int)id].Time = 0; } } }
/// <summary> /// /// </summary> /// <param name="id"></param> private void SetTopAnimation(AnimationID id) { SetTopAnimation(id, false); }
/// <summary> /// /// </summary> /// <param name="id"></param> private void SetBaseAnimation(AnimationID id) { SetBaseAnimation(id, false); }
private SealedAnimation GetAnimationById(AnimationID id) { return animationIDToAnimationObject[id]; }
bool MidAttack(AnimationID cid) { return cid == AnimationID.ATTACK; }
bool IsLanding(AnimationID cid) { return ((cid == AnimationID.FALL) || (cid == AnimationID.JUMP)); }
bool CanMove(AnimationID cid) { return (cid != AnimationID.ATTACK) && (cid != AnimationID.CROUCH); }
bool CanJump(AnimationID cid) { if (grounded) { return (cid != AnimationID.ATTACK); } else { // No air jumps for now return false; } }
/// <summary> /// /// </summary> /// <param name="id"></param> private void SetTopAnimation( AnimationID id ) { SetTopAnimation( id, false ); }
public void ChangeStatus(AnimationID status) { _status = status; _counter = 0; _passTime = 0f; }
void ApplyLandingLagAndTransitionAnimation(AnimationID cid) { animator.StartAnimationOrNext (AnimationID.IDLE); }
/// <summary> /// /// </summary> /// <param name="id"></param> private void SetBaseAnimation( AnimationID id ) { SetBaseAnimation( id, false ); }
void ApplyTraction(AnimationID cid) { if (grounded && ((cid != AnimationID.DASH && cid != AnimationID.RUN) || (velocity.x > 0 && controls.Horizontal () <= 0 || velocity.x < 0 && controls.Horizontal () >= 0))) { velocity.x = velocity.x * traction; } if (Mathf.Abs (velocity.x) < 0.1f) { velocity.x = 0f; } }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="reset"></param> private void SetTopAnimation( AnimationID id, bool reset ) { if ( (int)topAnimID >= 0 && (int)topAnimID < NumAnims ) { // if we have an old animation, fade it out fadingIn[ (int)topAnimID ] = false; fadingOut[ (int)topAnimID ] = true; } topAnimID = id; if ( id != AnimationID.None ) { // if we have a new animation, enable it and fade it in anims[ (int)id ].IsEnabled = true; anims[ (int)id ].Weight = 0; fadingOut[ (int)id ] = false; fadingIn[ (int)id ] = true; if ( reset ) anims[ (int)id ].Time = 0; } }
bool CanAttack(AnimationID cid) { return grounded; }