public void SpawnOrb(Stat _resultStatOfShootStatOrb) { int addStatValue = 0; int statPoints = 0; for (int i = 0; i <= (int)STAT.MR; ++i) { statPoints = (int)_resultStatOfShootStatOrb.GetOrigin((STAT)i); addStatValue = GetFirstStatValueForStatOrb(_resultStatOfShootStatOrb.statPoints); for (int remainStatPoints = statPoints; remainStatPoints > 0; remainStatPoints -= addStatValue) { if (remainStatPoints < addStatValue) { addStatValue = GetStatValueForStatOrb(remainStatPoints); } StatOrb orb = orbPool.DequeueObjectPool().GetComponent <StatOrb>(); orb.Init(addStatValue); orb.transform.localPosition = Vector3.zero; orb.gameObject.SetActive(true); orb.GetComponent <StatOrb>().rigid.velocity = Random.insideUnitCircle * 5f; statOrblistForShoot[i].Add(orb); } } }
public void Shoot(StatOrb orbRoot) { orbRoot.startPoint.transform.position = orbRoot.StatOrbImage.transform.position; orbRoot.endPoint.transform.position = endPoint.transform.position; orbRoot.trs.MoveObject = true; orbRoot.trs.DistanceRatio = 0; orbRoot.trs.SetOnOverflow(OnOverflow, orbRoot.gameObject); orbRoot.rigid.velocity = Vector2.zero; AudioManager.instance.PlaySFX("statFire"); }
void OnOverflow(GameObject _objOfOrb) { StatOrb orb = _objOfOrb.GetComponent <StatOrb>(); this.maxStat.AddOrigin(currentStat, orb.Value); StatTxtUpdate(); used += orb.Value; current--; IconEffect(); bombParticle.Play(); if (used == this.resultStatOfShootStatOrb.statPoints || (currentStat == STAT.MR && this.maxStat.mpRegen == this.maxStat.mpRegenMax)) { StartCoroutine(OnLastOverflow()); } AudioManager.instance.PlaySFX("statDestroy"); orbPool.EnqueueObjectPool(_objOfOrb); }