void Awake()
 {
     player             = GameObject.FindWithTag(Tags.Player).transform;
     enemySight         = GetComponent <EnemySight>();
     nav                = GetComponent <NavMeshAgent> ();
     anim               = GetComponent <Animator>();
     hash               = GameObject.FindWithTag(Tags.GameController).GetComponent <HashIDs>();
     nav.updateRotation = false;                     //不允许Nav更新敌人的方向
     locomotion         = new SimpleLocomotion(anim, hash);
     anim.SetLayerWeight(1, 1f);                     //设定动画层Shooting\Gun的权重
     anim.SetLayerWeight(2, 1f);
     deadZone *= Mathf.Deg2Rad;                      //将deadZone的单位从角度转换到弧度
 }
Example #2
0
    void Awake()
    {
        player     = GameObject.FindGameObjectWithTag(Tags.Player).transform;
        enemySight = GetComponent <EnemySight>();
        nav        = GetComponent <NavMeshAgent>();
        anim       = GetComponent <Animator>();
        hash       = GameObject.FindWithTag(Tags.GameController).GetComponent <HashIDs>();

        nav.updateRotation = false;
        locomotion         = new SimpleLocomotion(anim, hash);
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);
        deadZone *= Mathf.Deg2Rad;
    }
Example #3
0
    private void Awake()
    {
        player     = GameObject.FindWithTag(Tags.Player).transform;
        enemySight = GetComponent <EnemySight> ();
        nav        = GetComponent <NavMeshAgent> ();
        anim       = GetComponent <Animator> ();
        hash       = GameObject.FindWithTag(Tags.GameController).GetComponent <HashID> ();

        nav.updatePosition = false;        //表示不允许Nav Mesh Agent 更新Enemy001对象的方向
        locomotion         = new SimpleLocomotion(anim, hash);
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);
        deadZone *= Mathf.Deg2Rad;      //将deadZone从角度转到弧度
    }
Example #4
0
    private Transform player; // Reference to the player's transform.

    #endregion Fields

    #region Methods

    void Awake()
    {
        // Setting up the references.
        player = GameObject.FindGameObjectWithTag(Tags.Player).transform;
        enemySight = GetComponent<EnemySight>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<HashIDs>();

        // Making sure the rotation is controlled by Mecanim.
        nav.updateRotation = false;

        // Creating an instance of the AnimatorSetup class and calling it's constructor.
        animSetup = new SimpleLocomotion(anim, hash);

        // Set the weights for the shooting and gun layers to 1.
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        // We need to convert the angle for the deadzone from degrees to radians.
        deadZone *= Mathf.Deg2Rad;
    }