public void recovery_HitPoint(GameObject go) //回收打击点 { if (HitPointList.Count >= MaxHitPoint) { Destroy(go); } else { HitPointList.Add(go); go.SetActive(false); } }
private void Start() { instance = this; character = GameObject.Find("character"); shootArrowParticleLifeTime = shootArrowParticleObject.GetComponent <ParticleSystem>().startLifetime; dashParticle = dashParticleObject.GetComponent <ParticleSystem>().emission; WalkDustEmission = WalkDust.emission; WalkDustEmission_rain = WalkDust_rain.emission; _attack1_left = GameObject.Find("attack1_left"); _attack1_right = GameObject.Find("attack1_right"); _attack2_left = GameObject.Find("attack2_left"); _attack2_right = GameObject.Find("attack2_right"); _attack1_left.SetActive(false); _attack1_right.SetActive(false); _attack2_left.SetActive(false); _attack2_right.SetActive(false); pool_arrow = GameObject.Find("Pool_arrow"); arrowList = new ArrayList(); arrow_2List = new ArrayList(); for (int i = 0; i < MaxArrowNum; i++) //初始化创建箭 { GameObject t_gameobject = Instantiate(_arrow, pool_arrow.transform) as GameObject; t_gameobject.SetActive(false); arrowList.Add(t_gameobject); } for (int i = 0; i < MaxArrow_2Num; i++) //初始化创建箭2 { GameObject t_gameobject = Instantiate(_arrow_2, position: pool_arrow.transform.position, rotation: _arrow_2.transform.localRotation) as GameObject; t_gameobject.SetActive(false); arrow_2List.Add(t_gameobject); } for (int i = 0; i < MaxHitPoint; i++) { GameObject t_gameobject = Instantiate(hitPoint, position: Vector3.zero, rotation: new Quaternion(0, 0, 0, 0)) as GameObject; t_gameobject.SetActive(false); HitPointList.Add(t_gameobject); } //刀攻击粒子特效初始化 GameObject t = Instantiate(Source_Particle_swordHurt, position: Vector3.zero, rotation: Quaternion.Euler(Vector3.zero)) as GameObject; Particle_swordHurt = t.GetComponent <ParticleSystem>(); }