예제 #1
0
 void Awake()
 {
     instance  = this;
     rigidBody = GetComponent <Rigidbody2D>();
     heroAnim  = GetComponent <HeroAnimation>();
     StartPos  = transform.localPosition;
 }
예제 #2
0
파일: Hero.cs 프로젝트: qinyeli/GuruGuru
    // 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;
    }
예제 #3
0
 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]);
 }
예제 #4
0
 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]);
 }
예제 #5
0
    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>();
    }
예제 #6
0
    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);
        }
    }
예제 #7
0
    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");
        }
    }
예제 #8
0
    public void PlayAnimation(HeroAnimation animation)
    {
        string s = Animation(animation);

        heroAnimator.SetTrigger(s);
    }
예제 #9
0
 void Start()
 {
     _animation = this.GetComponent <HeroAnimation>();
     //lowMonsterModel = SetSQliteData.Instance().LowMonster("level", "1");
     //Debug.Log(lowMonsterModel.PhysicsAttack + "--" + lowMonsterModel.MagicAttack);
 }