Ejemplo n.º 1
0
    private AnimatorSetup animSetup;            // An instance of the AnimatorSetup helper class.


    void Awake()
    {
        // Setting up the references.
        //Congiguracion de las referencias.
        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.
        //Cerciorarse de que la rotacion es controlada por Mecanin y no por el navmeshagent.
        nav.updateRotation = false;

        // Creating an instance of the AnimatorSetup class and calling it's constructor.
        // Creando una instancia de la Clase AnimatorSetup y llamamos el constructor.
        animSetup = new AnimatorSetup(anim, hash);

        // Set the weights for the shooting and gun layers to 1.
        // Establecemos el peso de las capas Shooting y gun a 1.
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        // We need to convert the angle for the deadzone from degrees to radians.
        // Necesitamos convertir el angulo de deadzone de grados a radianes, ya que el motor lo opera asi mas facil.
        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 2
0
    public void EnqueueAnimator(Animator animator, AnimatorSetup setup, AnimationEnd end)
    {
        if (animatorSetup.ContainsKey(animator))
        {
            animatorSetup[animator].Add(setup);
        }
        else
        {
            List <AnimatorSetup> list = new List <AnimatorSetup>();
            list.Add(setup);
            animatorSetup.Add(animator, list);
        }

        if (animationEnd.ContainsKey(animator))
        {
            animationEnd[animator].Add(end);
        }
        else
        {
            List <AnimationEnd> list = new List <AnimationEnd>();
            list.Add(end);
            animationEnd.Add(animator, list);
        }

        animators.Enqueue(animator);
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        anim = GetComponent<Animator>();
        // Creating an instance of the AnimatorSetup class and calling it's constructor.
        animSetup = new AnimatorSetup(anim);

        angleTolerance *= Mathf.Deg2Rad;
    }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        anim = GetComponent <Animator>();
        // Creating an instance of the AnimatorSetup class and calling it's constructor.
        animSetup = new AnimatorSetup(anim);

        angleTolerance *= Mathf.Deg2Rad;
    }
Ejemplo n.º 5
0
    void Awake()
    {
        nav  = GetComponent <NavMeshAgent>();
        anim = GetComponent <Animator>();
        hash = GameObject.FindGameObjectWithTag("GameController").GetComponent <HashIDs>();

        nav.updateRotation = false;
        animSetup          = new AnimatorSetup(anim, hash);
        deadZone          *= Mathf.Deg2Rad;
    }
Ejemplo n.º 6
0
    void Awake()
    {
        anim           = GetComponent <Animator>();
        hash           = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>();
        unitController = transform.parent.gameObject.GetComponent <ControllerBase>();

        animSetup = new AnimatorSetup(anim, hash);
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);
        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 7
0
    void Awake()
    {
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();

        nav.updateRotation = false;
        animSetup = new AnimatorSetup(anim, hash);
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);
        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 8
0
    void Awake()
    {
        anim = GetComponent<Animator>();
        agent = GetComponent<NavMeshAgent>();
        opticSphereCol = GetComponent<SphereCollider>();

        playerGameObject = GameObject.FindGameObjectWithTag(DoneTags.player);

        hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneHashIDs>();
        animSetup = new AnimatorSetup(anim, hash);

        patrolIndex = 0;
    }
Ejemplo n.º 9
0
    void Awake()
    {
        player = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent<EnemySight>();
        navMeshAgent = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();

        navMeshAgent.updateRotation =false;
        animSetup = new AnimatorSetup(anim, hash);

        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 10
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;
    }
Ejemplo n.º 11
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;//把角度转换成弧度
    }
Ejemplo n.º 12
0
    void Awake()
    {
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent <EnemySight> ();
        nav        = GetComponent <UnityEngine.AI.NavMeshAgent> ();
        //anim = GetComponent<Animator> ();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs> ();

        nav.updateRotation = false;
        animSetUp          = new AnimatorSetup(anim, hash);

        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        deadZone *= Mathf.Deg2Rad;
    }
    void Awake()
    {
        touchObject = this.transform.FindChild("SenseTouch").gameObject;
        woken = touchObject.GetComponent<Woken>();
        santaTransform = GameObject.FindGameObjectWithTag("Player").transform;

        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();

        // Must make sure rotation of person is by the animator and not by the nav mesh agent
        nav.updateRotation = false;
        animSetup = new AnimatorSetup(anim);

        // Convert deadZone variable from degrees to radians
        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 14
0
    void Awake()
    {
        navMeshAgent = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        animSetup = new AnimatorSetup(anim, hash);
        enemySight = GetComponent<EnemySight>();
        enemyHealth = GetComponent<EnemyHealth>();
        player = GameObject.FindGameObjectWithTag("Player").transform;

        //INITIALIZING THE PATROLLING
        currentWaypointIndex = 0;
        navMeshAgent.destination = waypoints[currentWaypointIndex].position;
        anim.SetFloat("Speed", patrollingSpeed * patrolSpeedRatio);
        navMeshAgent.speed = patrollingSpeed;
        previousNavMeshDestination = Vector3.zero;
    }
Ejemplo n.º 15
0
    void Awake()
    {
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent <EnemySight> ();
        nav        = GetComponent <NavMeshAgent> ();
        anim       = GetComponent <Animator> ();
        hash       = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs> ();

        nav.updateRotation = false;                                                     // 转向不是用 nav 来做, 而是用 anim 来做, 所以先把 nav.updateRoatation 关掉
        animSetup          = new AnimatorSetup(anim, hash);

        anim.SetLayerWeight(1, 1f);                                             // 0 ~ 1f 是权威的范围, 越接近 1f 就比其他 Layer 更优先
        anim.SetLayerWeight(2, 1f);

        deadZone *= Mathf.Deg2Rad;                                                      // 把角度转换成弧度
    }
Ejemplo n.º 16
0
    void Awake()
    {
        enemySight = GetComponent <EnemySight>();
        nav        = GetComponent <NavMeshAgent>();
        anim       = GetComponent <Animator>();

        playerTransform = GameObject.FindGameObjectWithTag(Tags.player).transform;

        nav.updateRotation = false;
        animSetup          = new AnimatorSetup(anim); //, hash);

        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 17
0
    void Awake()
    {
        player = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent<EnemySight>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();

        nav.updateRotation = false; //To make sure that the rotation of the enemy is set by the animator and not by the nav mesh agent - To reduce foot slipping whilst turning corners

        animSetup = new AnimatorSetup(anim, hash);

        anim.SetLayerWeight(1, 1f); //Shooting Layer
        anim.SetLayerWeight(2, 1f); //Gun Layer

        deadZone *= Mathf.Deg2Rad; //Convert from degrees to radians
    }
Ejemplo n.º 18
0
    //private DoneHashIDs hashIDs;
    void Awake()
    {
        animator      = GetComponentInChildren <Animator> ();
        animatorSetup = new AnimatorSetup(animator);
        attackModule  = GetComponent <AttackModule> ();
        //hashIDs = new DoneHashIDs();
        // animatorSetup = new DoneAnimatorSetup(animator, hashIDs);

        aiPath = GetComponent <GG_AIPath> ();

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

        deadZone *= Mathf.Deg2Rad;
        //NavAnimSetup();
    }
Ejemplo n.º 19
0
    private AnimatorSetup animSetup; //animatorSetupスクリプト

    void Start()
    {
        //初期化
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = this.GetComponent <EnemySight>();
        nav        = this.GetComponent <NavMeshAgent>();
        anim       = this.GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>();
        animSetup  = new AnimatorSetup(anim, hash);

        //navの回転を無効・animatorが回転をする(スムーズに見える)
        nav.updateRotation = false;
        //Shooting(1)とGun(2)のWeightを1に設定、他の層より優先順位が高い
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);
        //弧度に変更
        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 20
0
    void Awake()
    {
        InitialiseSantaTransform();
        personSight = GetComponent<PersonSight>();
        suspicion = GetComponent<Suspicion>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();

        touchObject = this.transform.FindChild("SenseTouch").gameObject;
        woken = touchObject.GetComponent<Woken>();

        // Must make sure rotation of person is by the animator and not by the nav mesh agent
        nav.updateRotation = false;
        animSetup = new AnimatorSetup(anim);

        // Convert deadZone variable from degrees to radians
        deadZone *= Mathf.Deg2Rad;
    }
Ejemplo n.º 21
0
    void Awake()
    {
        //referencing scripts
        player = GameObject.FindGameObjectWithTag("Player").transform;
        enemySight = GetComponent<EnemySight>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag("gameController").GetComponent<HashIDs>();
        EnemyAI = GetComponent<enemyAI>();

<<<<<<< HEAD
        nav.updateRotation = false;                //make sure the rotation is controlled by mecanim
        animSetup = new AnimatorSetup(anim, hash); //creating an instance of the AnimatorSetu class and calling it´s constructor
        deadZone += Mathf.Deg2Rad;                 //convert the angle for the deadzone from degrees to radiants
=======
        nav.updateRotation = false; //make sure the rotation is controlled by mecanim
        animSetup = new AnimatorSetup(anim, hash); //creating an instance of the AnimatorSetu class and calling it´s constructor
        deadZone += Mathf.Deg2Rad;   //convert the angle for the deadzone from degrees to radiants
>>>>>>> dd5711ced731f99b586cb33f83b71c58174c8409
    }
Ejemplo n.º 22
0
    private Transform player; // Reference to the player's transform.

    #endregion Fields

    #region Methods

    void Awake()
    {
        // Setting up the references.
        player = GameObject.Find("N40").transform;
        enemySight = GetComponent<EnemySight>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();

        // 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 AnimatorSetup(anim);

        // 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;
    }
Ejemplo n.º 23
0
    private AnimatorSetup animSetup;         // An instance of the AnimatorSetup helper class.


    void Awake()
    {
        // Setting up the references.
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent <EnemySight>();
        nav        = GetComponent <UnityEngine.AI.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 AnimatorSetup(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;
    }
Ejemplo n.º 24
0
 // ---------------------------------------------------------------------------------------------------
 // METHOD:      Start()
 // Desciption:  Get a reference to the TagsHashIDs.cs file, and construct a new AnimatorSetup.cs class
 // ---------------------------------------------------------------------------------------------------
 private void Start()
 {
     _hashIDs       = _controller.TagsHash;
     _animatorSetup = new AnimatorSetup(_anim, _hashIDs);
 }
Ejemplo n.º 25
0
 public void EnqueueAnimator(Animator animator, AnimatorSetup setup)
 {
     EnqueueAnimator(animator, setup, () => { });
 }
Ejemplo n.º 26
0
 protected override void Awake()
 {
     base.Awake();
     anim = GetComponent<Animator>();
     hash = GameObject.FindGameObjectWithTag("GameController").GetComponent<HashIDs>();
     animSetup = new AnimatorSetup(anim, hash);
 }