Beispiel #1
0
 void Start()
 {
     enemySight   = this.GetComponent <fps_EnemySight>();
     nav          = this.GetComponent <NavMeshAgent>();
     player       = GameObject.FindGameObjectWithTag(tags.player).transform;
     playerHealth = player.GetComponent <fps_PlayerHealth>();
 }
Beispiel #2
0
    void Start()
    {
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = this.GetComponent <fps_EnemySight>();
        nav        = this.GetComponent <NavMeshAgent>();
        anim       = this.GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>();
        animSetup  = new AnimatorSetup(anim, hash);

        nav.updateRotation = false;
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        deadZone *= Mathf.Deg2Rad;
    }
Beispiel #3
0
    void Start()
    {
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = this.GetComponent <fps_EnemySight>();
        nav        = this.GetComponent <NavMeshAgent>();
        anim       = this.GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>();
        animSetup  = new AnimatorSetup(anim, hash);

        nav.updateRotation = false; //通过动画来控制敌人AI的旋转
        anim.SetLayerWeight(1, 1f); //设置动画状态机层级的权重,第一层为1
        anim.SetLayerWeight(2, 1f); //第二层为1
        //因为设置了骨骼作用的范围,设置权重就不会影响到其他层动画的播放

        deadZone *= Mathf.Deg2Rad;//把角度转换成弧度
    }