protected virtual void Start()
        {
            if (TargetGroundFitter == null)
            {
                TargetGroundFitter = GetComponent <FGroundFitter_Base>();
            }

            if (TargetGroundFitter)
            {
                TargetGroundFitter.GlueToGround = false;
            }

            agent = GetComponent <NavMeshAgent>();

            agent.Warp(transform.position);
            agent.SetDestination(transform.position);
            moving             = false;
            lastAgentPosition  = transform.position;
            reachedDestination = true;

            animationClips = new FAnimationClips(GetComponentInChildren <Animator>());
            animationClips.AddClip("Idle");

            if (FAnimatorMethods.StateExists(animationClips.Animator, "Move") || FAnimatorMethods.StateExists(animationClips.Animator, "move"))
            {
                movementClip = "Move";
            }
            else
            {
                movementClip = "Walk";
            }

            animationClips.AddClip(movementClip);
        }
        /// <summary>
        /// Preparin initial stuff
        /// </summary>
        protected virtual void Start()
        {
            fitter      = GetComponent <FGroundFitter>();
            animator    = GetComponentInChildren <Animator>();
            rigb        = GetComponent <Rigidbody>();
            itsCollider = GetComponentInChildren <Collider>();

            if (animator)
            {
                if (HasParameter(animator, "AnimationSpeed"))
                {
                    animatorHaveAnimationSpeedProp = true;
                }
                animator.applyRootMotion = false;
            }

            fitter.UpAxisRotation = transform.rotation.eulerAngles.y;
            initialUpOffset       = fitter.UpOffset;

            fitter.RefreshLastRaycast();

            clips = new FAnimationClips(animator);
            clips.AddClip("Idle");
            clips.AddClip("Walk");
            clips.AddClip("Run");
        }
Exemplo n.º 3
0
    protected override void Start()
    {
        base.Start();
        animator = GetComponentInChildren <Animator>();

        clips = new FAnimationClips(animator);
        clips.AddClip("Idle");
        clips.AddClip("Walk");
        clips.AddClip("RotateL");
        clips.AddClip("RotateR");
    }
        void Start()
        {
            fitter   = GetComponent <FGroundFitter>();
            animator = GetComponentInChildren <Animator>();
            timer    = Random.Range(1f, 5f);

            if (name.Contains("Fpider"))
            {
                bodyTransform = transform.GetChild(0).Find("BSkeleton").GetChild(0).Find("Body_Shield");
            }

            transform.rotation    = Quaternion.Euler(0f, Random.Range(-180f, 180f), 0f);
            fitter.UpAxisRotation = transform.rotation.eulerAngles.y;

            onDestination = true;

            transform.localScale = Vector3.one * Random.Range(0.5f, 1f);

            clips = new FAnimationClips(animator);
            clips.AddClip("Idle");
            clips.AddClip("Move");
        }