void Awake() { instance = this; rigidBody = GetComponent <Rigidbody2D>(); heroAnim = GetComponent <HeroAnimation>(); StartPos = transform.localPosition; }
// Use this for initialization void Start() { rigid = GetComponent <Rigidbody> (); myCollider = GetComponent <SphereCollider> (); ground = GameObject.Find("Ground").GetComponent <Ground> (); anim = GetComponent <HeroAnimation> (); audioManager = GameObject.Find("GameManager").GetComponent <AudioManager> (); // Set the initail value of startJumpHeight to avoid the ground from rotating at start startJumpHeight = transform.position.y; }
public void PlayBoolAnimation(HeroAnimation animation, bool value) { AnimatorControllerParameter[] param = Animator.parameters; for (int i = 0; i < param.Length; i++) { if (param[i].type == AnimatorControllerParameterType.Float && SystemSetting.HeroAnimationParameters[animation] == param[i].name) { Animator.SetBool(param[i].name, value); return; } } BattleController.Instance.DebugLog(LogType.ERROR, "Not found hero:" + Name + " float animation:" + SystemSetting.HeroAnimationParameters[animation]); }
public void PlayTriggerAnimation(HeroAnimation animation) { AnimatorControllerParameter[] param = Animator.parameters; for (int i = 0; i < param.Length; i++) { if (param[i].type == AnimatorControllerParameterType.Trigger && SystemSetting.HeroAnimationParameters[animation] == param[i].name) { Animator.SetTrigger(param[i].name); return; } } BattleController.Instance.DebugLog(LogType.ERROR, "Not found hero:" + Name + " trigger animation:" + SystemSetting.HeroAnimationParameters[animation]); }
protected virtual void Awake() { _HP = GetComponent("HP") as HP; series = GetComponent("Series") as Series; m_HeroAnimation = GetComponent("HeroAnimation") as HeroAnimation; m_Tweakers = new Tweakers(); player_countRoundsWon = 0; enemy_countRoundsWon = 0; // получаем ссылки на компоненты оружия shieldMeshFilter = heroShield.GetComponent <MeshFilter>(); twoHandedSwordMeshFilter = hero2HandedSword.GetComponent <MeshFilter>(); swordMeshRenderer = heroSword.GetComponent <MeshRenderer>(); sword2MeshRenderer = heroSword_2.GetComponent <MeshRenderer>(); shieldMeshRenderer = heroShield.GetComponent <MeshRenderer>(); twoHandedSwordMeshRenderer = hero2HandedSword.GetComponent <MeshRenderer>(); }
protected override void OnCantMove <T> (T component) { if (component.gameObject.tag == "Wall") { // Stop and move in the other direction Flip(); } else if (component.gameObject.tag == "Player") { //Declare hitPlayer and set it to equal the encountered component. HeroAnimation hitPlayer = component as HeroAnimation; //Set the attack trigger of animator to trigger Enemy attack animation. // anim.SetTrigger("goblinAttack"); //Call the LoseHealth function of hitPlayer passing it playerDamage, the amount of foodpoints to be subtracted. hitPlayer.LoseHealth(playerDamage); } }
string Animation(HeroAnimation a) { switch (a) { case HeroAnimation.ATTACK: attackPowerUp.Play(); return("Attack"); case HeroAnimation.DEFEAT: return("Defeat"); case HeroAnimation.DODGE_LEFT: return("EvadeLeft"); case HeroAnimation.DODGE_RIGHT: return("EvadeRight"); case HeroAnimation.VICTORY: return("Victory"); default: return("Victory"); } }
public void PlayAnimation(HeroAnimation animation) { string s = Animation(animation); heroAnimator.SetTrigger(s); }
void Start() { _animation = this.GetComponent <HeroAnimation>(); //lowMonsterModel = SetSQliteData.Instance().LowMonster("level", "1"); //Debug.Log(lowMonsterModel.PhysicsAttack + "--" + lowMonsterModel.MagicAttack); }