Пример #1
0
    public void StartFly(Vector3 inOringPos, float inSphereR, float inFlyseed)
    {
        flyspeed           = inFlyseed * Random.Range(0.8f, 1.1f);
        animator.speed     = Random.Range(0.8f, 1.1f);
        orginPos           = inOringPos;
        transform.position = inOringPos;
        sphereR            = inSphereR;

        flyPath.Add(orginPos);

        Vector3 newPos = Random.onUnitSphere * sphereR;

        newPos = new Vector3(newPos.x, 0.1f * newPos.y, newPos.z) + orginPos;
        flyPath.Add(newPos);

        float flyTime = (flyPath[1] - flyPath[0]).magnitude;

        flyTime = flyTime / flyspeed;

        transform.DOPath(flyPath.ToArray(), flyTime, PathType.Linear, PathMode.Full3D, 5, new Color(1, 0, 0)).OnComplete(FlyNextPosition).SetEase(Ease.InOutSine);
        transform.DOLookAt(flyPath[1], 1f);

//#if UNITY_EDITOR
        SceneInteractiveManger.RecoverMatShaderSkinMesh(transform);
//#endif
    }
Пример #2
0
    public void StartMove(Transform searchRoot)
    {
//#if UNITY_EDITOR
        SceneInteractiveManger.RecoverMatShaderSkinMesh(transform);
//#endif

        SearchPointGroup = searchRoot;
        likeGroup        = new bool[12] {
            likeClaphands, likeDance, likeEatsitting, likeIdle, likeListen, likeManipulate, likeSitidle, likeTalk, likeWalk, likeWalkCarry, likeFtStart, likeFtEnd
        };


        ID = (int)(materialsGroup.Length * Random.value);
        skinnedMeshBase = transform.Find(skinnedMeshBasePath);
        skinnedMeshBase.GetComponent <SkinnedMeshRenderer>().sharedMaterial = materialsGroup[ID];

        aniSpeed = aniSpeed * (0.5f * Random.value + 0.75f);
        GetComponent <UnityEngine.AI.NavMeshAgent>().speed = aniSpeed;
        foreach (AnimationState state in GetComponent <Animation>())
        {
            state.speed = aniSpeed;
        }
        GetComponent <Animation>().Play(defaultAnimaiton);
//		animation["walk"].weight = 0.01F;
//		animation["dance"].weight = 1F;
//		animation["dance"].blendMode = AnimationBlendMode.Additive;
//		animation.Play("claphands");
//		animation.Play("dance");
//		animation.Play("eatsitting");
//		animation.Play("idle");
//		animation.Play("listen");
//		animation.Play("manipulate");
//		animation.Play("sitidle");
//		animation.Play("talk");
//		animation["claphands"].wrapMode = WrapMode.Once;
//		animation.Play("walk");
//		animation["talk"].layer =1 ;
//		animation["dance"].blendMode = AnimationBlendMode.Blend;
//		animation["dance"].AddMixingTransform(shoulder);
//		animation["dance"].weight = 0.01F;
//		animation.Play("dance");
//		animation.Play("walk");
//		animation.Blend("dance",0.5f,0.3f);
//		animation.Play("manipulate");
//		animation.CrossFadeQueued("walk", 1F, QueueMode.CompleteOthers);

        StartCoroutine(AutoMove());
    }