Ejemplo n.º 1
0
        void Awake()
        {
                        #if USE_ASTAR
            Debug.Log("Use Astar!");
                        #endif

            aiTransform     = GetTransform();
            animationStates = aiTransform.GetComponent <AIAnimationStates>();
            navMeshAgent    = aiTransform.GetComponent <NavMeshAgent>();

            objectFinder.CacheTransforms(CachePoint.Awake);
            InitGlobalTriggers();

            if (!useSightTransform || sightTransform == null)
            {
                sightTransform               = new GameObject("Sight Transform").transform;
                sightTransform.parent        = aiTransform;
                sightTransform.localRotation = Quaternion.identity;
                sightTransform.localPosition = eyePosition;
                useSightTransform            = false;
            }

            currentDestination = aiTransform.position;

            SetActive(true);
        }
Ejemplo n.º 2
0
        void Awake()
        {
            thisTFM         = transform;
            animationStates = GetComponent <AIAnimationStates>();
            navMeshAgent    = GetComponent <NavMeshAgent>();

            objectFinder.CacheTransforms(CachePoint.Awake);
            InitGlobalTriggers();

            if (!useSightTransform || sightTransform == null)
            {
                sightTransform               = new GameObject("Sight Transform").transform;
                sightTransform.parent        = thisTFM;
                sightTransform.localRotation = Quaternion.identity;
                sightTransform.localPosition = eyePosition;
                useSightTransform            = false;
            }

            currentDestination = transform.position;

            SetActive(true);
        }