private void SpawnHitEffect() { var textEffect = Instantiate(HitPrefab, gameObject.transform.position, Quaternion.identity); SpawnHelper.SetParentInHierarchy(textEffect, spawnParent); textEffect.transform.position = gameObject.transform.position; textEffect.GetComponentInChildren <HitTextScript>().SetHit(HitForce); Destroy(textEffect, 0.5f); }
private void InitBarrier(GameObject b) { if (SpawnParent != null) { SpawnHelper.SetParentInHierarchy(b, SpawnParent.gameObject); } var barrier = b.GetComponent <BarrierScript>(); barrier.ExplosionParent = ExplosionParent; barrier.Life = BarrierLife; }
void Update() { button.interactable = PlayerScript.Player.Money.GreaterThan(Hit.FromFullLife(Costs)); if (spawnBall && ballScript == null && BallPrefab != null) { var spawnArea = GameScript.Game.Spawnarea; var bo = SpawnHelper.TrySpawn(BallPrefab, spawnArea.transform.position, spawnArea.bounds.size, Quaternion.identity); if (bo != null) { SpawnHelper.SetParentInHierarchy(bo, ballsSpawnParent); //Debug.Log("Spawn Ball"); ballScript = bo.GetComponent <BallScript>(); ballScript.HitForce = spawnBallForce; ballScript.Speed = Speed; ballScript.Mass = Mass; spawnBall = false; } } PermanentEffect_FullUpgrade(); }