private void Awake() { ///Getting GrownFood so I can snag the potency value. grownFood = GetComponent <GrownFood>(); cottonPotency = grownFood.GetPlantData().Potency; ///calculating how much cotton/durathread you should get. seedModifier = Mathf.RoundToInt(cottonPotency / 25f); finalAmount = seedModifier + 1; }
public void Explode() { if (hasExploded) { return; } hasExploded = true; if (!CustomNetworkManager.IsServer) { return; } if (lemonPotencyOverride == 0) { lemonPotency = grownFood.GetPlantData().Potency; } else { lemonPotency = lemonPotencyOverride; } finalDamage = maxDamage * (lemonPotency / 100f); finalRadius = Convert.ToSingle(Math.Ceiling(maxRadius * (lemonPotency / 100f))); // Get data from grenade before despawning var explosionMatrix = registerItem.Matrix; var worldPos = objectBehaviour.AssumedWorldPositionServer(); // Despawn grenade Despawn.ServerSingle(gameObject); // Explosion here var explosionGO = Instantiate(explosionPrefab, explosionMatrix.transform); explosionGO.transform.position = worldPos; explosionGO.SetExplosionData(Mathf.RoundToInt(finalDamage), finalRadius); explosionGO.Explode(explosionMatrix); }