コード例 #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
ファイル: HeroMono.cs プロジェクト: xiaoxw66/TurnBasedBattle
 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
ファイル: HeroMono.cs プロジェクト: xiaoxw66/TurnBasedBattle
 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
ファイル: HeroManager.cs プロジェクト: ma-chu/BattleRoyal
    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
ファイル: Goblin.cs プロジェクト: lovett2/dirkwood_dragons
    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);
 }