public void PlayIdle() { if (mAnimation == null) { return; } mAnimation.Play("idle", 0, fadeFrame); }
void InstantiateObject() { for (int i = 0; i < Count; ++i) { Vector2 v = Random.insideUnitCircle * radius; GameObject prefab = Prefabs[Count == 1 ? 0 : Random.Range(0, Prefabs.Count)]; GameObject go = Instantiate(prefab) as GameObject; go.transform.position = Count == 1?new Vector3(0, 5, -10): new Vector3(v.x, 0, v.y); go.SetActive(true); if (Controll && Count == 1) { samplePlay = go.AddComponent <SamplePlay>(); } if (Rotate && Count == 1) { go.AddComponent <SampleRotate>(); } SamplePlayEffect samplePlayEffect = go.GetComponent <SamplePlayEffect>(); if (samplePlayEffect != null) { samplePlayEffect.enabled = ShowEffect && Count == 1; } GpuInstancedAnimation animation = go.GetComponent <GpuInstancedAnimation>(); int index = Random.Range(0, animation.animationClips.Count); var animationFrame = animation.animationClips[index]; animation.speed = Count == 1? 1: Random.Range(0.5f, 3); animation.Play(animationFrame.Name); mUpdateList.Add(animation); if (Count == 1) { controllAnimation = animation; } if (Count > 1) { foreach (var clip in animation.animationClips) { clip.wrapMode = GpuInstancedAnimationClip.WrapMode.Loop; } } } }