void sprayES() { for (int touch = 0; touch < Input.touchCount; touch++) { if (Input.GetTouch(touch).phase == TouchPhase.Began) { Vector2 touchPosition = Input.GetTouch(touch).position; Vector3 point = Camera.main.ScreenToWorldPoint(touchPosition); Color color = getRandomColor(); for (int i = 0; i < 360; i += 360 / totES) { EnergyShape es = createES(point); es.destination = getPosition(point, i, maxDistance); es.color = color; es.timeToCenter = speed; es.rigidbody.isKinematic = true; es.Prepare(); } social.checkSprayCount(++sprayCount); } } }
void spawn(ESInfo info) { EnergyShape[] esList = null; //posizionamento switch (info.positioning) { case Positioning.Standard: esList = standard(info.count); break; case Positioning.Parallel: esList = parallel(info.count); break; case Positioning.Perpendicular: esList = perpendicular(info.count); break; } //comportamento for (int i = 0; i < esList.Length; i++) { EnergyShape es = esList[i]; es.moveType = info.movetype; es.timeToCenter = info.timeToCenter; es.isFast = info.timeToCenter == timeToCenter.fast ? true : false; es.spiralAngularSpeed = es.spiralAngularSpeed * info.verse; // verse รจ 1 o -1 quindi determina il verso di rotazione es.Prepare(); //reinizializza l'ES nel caso sia stata riutilizzata dal pool } }