コード例 #1
0
	private DoneAnimatorSetup animSetup;		// An instance of the AnimatorSetup helper class.


	void Awake ()
	{
		// Setting up the references.
		player = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
		enemySight = GetComponent<DoneEnemySight>();
		nav = GetComponent<NavMeshAgent>();
		anim = GetComponent<Animator>();
		hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneHashIDs>();
		
		// 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 DoneAnimatorSetup(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;
	}
コード例 #2
0
    private DoneAnimatorSetup animSetup;                // An instance of the AnimatorSetup helper class.


    void Awake()
    {
        // Setting up the references.
        player     = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        enemySight = GetComponent <DoneEnemySight>();
        nav        = GetComponent <NavMeshAgent>();
        anim       = GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneHashIDs>();

        // 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 DoneAnimatorSetup(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;
    }