public GameObject Get(E_DeadBodyType type) { List <GameObject> cache = Cache [(int)type]; GameObject obj; for (int i = 0; i < cache.Count; i++) { obj = cache [i]; if (obj.layer == cache_free) { obj.SetActive(true); obj.transform.position = new Vector3(0, 0, 10000); obj.layer = cache_inuse; return(obj); } } return(null); }
/// <summary> /// Gets the dead. /// 获取死亡模型资源 /// </summary> public GameObject GetDead(Agent agent, E_DeadBodyType deadType) { int len = DeadCaches.Length; GameObject go; for (int i = 0; i < len; i++) { if (DeadCaches[i].EnemyType == agent.EnemyType) { go = DeadCaches[i].Get(deadType); if (go != null) { ComponentChoppedBody ed = go.GetComponent <ComponentChoppedBody>(); ed.Enable(agent.transform); } return(go); } } return(null); }
public GameObject GetDeadBody(Agent agent, E_DeadBodyType type) { GameObject g; for (int i = 0; i < DeadBodies.Length; i++) { if ((DeadBodies[i]).EnemyType == agent.EnemyType) { g = DeadBodies[i].Get(type); if (g != null) { g.SendMessage("Activate", agent.Transform); } return(g); } } //Debug.LogError(agent.name.ToString() + " Unable find dead body " + type + " in cache!!!"); return(null); }