private void BuildMesh() { renderVerts = new Vector3[header.triCount * 3]; renderTris = new int[header.triCount * 3]; renderUVs = new Vector2[header.triCount * 3]; SetFrame(0, 0, 0); go = new GameObject(Name); mesh = new Mesh(); mesh.vertices = renderVerts; mesh.uv = renderUVs; mesh.triangles = renderTris; mesh.RecalculateNormals(); go.AddComponent <MeshFilter>().mesh = mesh; MDLAnimator animator = go.AddComponent <MDLAnimator>(); animator.mdl = this; MeshRenderer rend = go.AddComponent <MeshRenderer>(); rend.material.shader = Shader.Find("Legacy Shaders/Diffuse"); rend.material.mainTexture = skins[0].texture; rend.material.mainTexture.filterMode = FilterMode.Point; }
protected override void OnAwake() { base.OnAwake(); CheckAssigned(m_data, "data"); m_timerManager = new TimerManager(); m_navMeshAgent = GetRequiredComponent <NavMeshAgent>(); m_animator = GetRequiredComponent <MDLAnimator>(); }
const float kUpdateChasePathDelay = 1.0f / 2; // 2 times/second #region Life cycle protected override void OnAwake() { base.OnAwake(); CheckAssigned(m_data, "data"); m_timerManager = new TimerManager(); m_navMeshAgent = GetRequiredComponent <UnityEngine.AI.NavMeshAgent>(); m_navMeshAgent.stoppingDistance = m_data.ai.closeCombatRange; m_animator = GetRequiredComponent <MDLAnimator>(); }
public void ChangeWeapon(WeaponType weaponType) { m_weaponType = weaponType; m_weaponInfo = m_weapons[(int)weaponType]; #if UNITY_EDITOR m_animator = GetComponent <MDLAnimator>(); #endif m_animator.model = m_weaponInfo.model; m_audioSource.clip = m_weaponInfo.shotSound; m_shootDelayed = 60.0f / m_weaponInfo.shotsPerMinute; }
void Awake() { m_animator = GetComponent <MDLAnimator>(); m_audioSource = GetComponent <AudioSource>(); }