// Use this for initialization void Start() { pos.x = (int)this.transform.position.x; pos.y = (int)this.transform.position.y; restrictActions = new bool[5]; for (int i = 0; i < 5; i++) { restrictActions[i] = false; } ApplyEquipmentStats(); MaxSpeed = BaseSpeed; MaxAttackRange = BaseAttackRange; MaxStrength = BaseStrength; MaxMagic = BaseMagic; //MaxMana = BaseMana; MaxHealth = BaseHealth; MaxArmour = BaseArmour; ModifiedSpeed = BaseSpeed; ModifiedAttackRange = BaseAttackRange; ModifiedStrength = BaseStrength; ModifiedMagic = BaseMagic; ModifiedArmour = BaseArmour; //this.GetComponent<Animator>().Play("CharacterAnimationIdle"); CurrentAnimState = ANIM_STATE.IDLE; UpdateAnimState(); }
public void UseSkill() { Debug.Log("Using skill!"); theSkill.GetComponent <BaseSkills>().DoEffect(this); this.CurrentAnimState = ANIM_STATE.STAND_DOWN; }
void CheckIfDead() { if (BaseHealth <= 0) { //Debug.Log("Died."); IsDead = true; CurrentAnimState = ANIM_STATE.DIE; } }
public void TakeDamage(int damage) { int damageTaken = (int)Mathf.Clamp(damage - ModifiedArmour, 1.0f, 999.0f); BaseHealth -= damageTaken; GameObject.Find("DmgIndiManager").GetComponent <dmgDisp>().dispNum(dmgDisp.DISPLAY_TYPE.DAMAGE, damageTaken, transform.position); CurrentAnimState = ANIM_STATE.TAKE_DAMAGE; UpdateAnimState(); GameObject go = Instantiate(GameObject.Find("Damage Particle System"), pos, Quaternion.identity) as GameObject; go.GetComponent <CleanUp>().enabled = true; CheckIfDead(); }
void Update() { if (m_CurrAnimState == ANIM_STATE.ANIM_IN) { Debug.Log("Told to animate in the Logo"); // show all the children ShowHideChildren(true); // start the animation Animator animator = transform.GetComponent <Animator>(); animator.CrossFade("Collapse_To_Logo", 0.0f); // immediately flag as not animating - the anim is pre-built, is only triggered once, does not need to be updated **** CHANGE!! m_CurrAnimState = ANIM_STATE.SOLID_VISIBLE; // change state // make interactible // enable the box collider } }
// ATTACK->IDLE은 Animation Event로 처리 // 나머지 State Transition은 Attcker와 Health에서 호출 public void ChangeAnimState(int state) { if (ANIMSTATE == (ANIM_STATE)state) // 무한 트리거 방지. { return; } if ((ANIM_STATE)state == ANIM_STATE.DEAD) { attacker.enabled = false; } ANIMSTATE = (ANIM_STATE)state; animator.SetInteger("AnimState", state); animator.SetTrigger("AnimTrigger"); if (state == (int)ANIM_STATE.DEAD) { Destroy(gameObject, 3f); } }
void UpdateAnimState() { if (this.GetComponent <AnimationEnd>().b_AnimationEnded&& CurrentAnimState != ANIM_STATE.IDLE) { if (this.CurrentAnimState == ANIM_STATE.DIE) { this.CurrentAnimState = ANIM_STATE.DEAD; if (IsEnemy) { this.GetComponent <FSMBase>().enabled = false; GameObject.Find("EnemyTeamManager").GetComponent <teamManager>().popPlayer(this.gameObject); } this.GetComponent <Pathfinder>().enabled = false; if (!IsEnemy) { this.GetComponent <BoxCollider2D>().enabled = false; } this.enabled = false; GameObject.Find("friendlyTeamManager").GetComponent <teamManager>().popPlayer(this.gameObject); this.GetComponent <CharacterFadeOut>().StartFade = true; } else { this.CurrentAnimState = ANIM_STATE.IDLE; } //Debug.Log(this.name + ": Reset anim."); } switch (CurrentAnimState) { case ANIM_STATE.IDLE: this.GetComponent <Animator>().Play("Idle"); break; case ANIM_STATE.MOVE_DOWN: this.GetComponent <Animator>().Play("MoveDown"); break; case ANIM_STATE.MOVE_LEFT: this.GetComponent <Animator>().Play("MoveLeft"); break; case ANIM_STATE.MOVE_RIGHT: this.GetComponent <Animator>().Play("MoveRight"); break; case ANIM_STATE.MOVE_UP: this.GetComponent <Animator>().Play("MoveUp"); break; case ANIM_STATE.ATTACK_DOWN: this.GetComponent <Animator>().Play("AttackDown"); break; case ANIM_STATE.ATTACK_LEFT: this.GetComponent <Animator>().Play("AttackLeft"); break; case ANIM_STATE.ATTACK_RIGHT: this.GetComponent <Animator>().Play("AttackRight"); break; case ANIM_STATE.ATTACK_UP: this.GetComponent <Animator>().Play("AttackUp"); break; case ANIM_STATE.STAND_DOWN: this.GetComponent <Animator>().Play("Stand"); break; case ANIM_STATE.STAND_LEFT: this.GetComponent <Animator>().Play("Stand"); break; case ANIM_STATE.STAND_RIGHT: this.GetComponent <Animator>().Play("Stand"); break; case ANIM_STATE.STAND_UP: this.GetComponent <Animator>().Play("Stand"); break; case ANIM_STATE.DIE: this.GetComponent <Animator>().Play("Die"); break; case ANIM_STATE.DEAD: this.GetComponent <Animator>().Play("Dead"); break; case ANIM_STATE.TAKE_DAMAGE: this.GetComponent <Animator>().Play("TakeDamage"); break; } }
public void SetAnimationState(ANIM_STATE animState) { m_CurrAnimState = animState; Debug.Log("Animation state set on logo: " + animState); }
// By default, the object becomes hidden private void SetDefaultState() { m_CurrAnimState = ANIM_STATE.HIDDEN; // hide children //ShowHideChildren(false); }
private void Start() { ANIMSTATE = ANIM_STATE.IDLE; animator = GetComponent <Animator>(); attacker = GetComponent <Attacker>(); }
public void SetState(ANIM_STATE s) { state |= 1 << (int)s; }
public bool IsPlayAnim(ANIM_STATE s) { return((state & (1 << (int)s)) > 0); }