Exemple #1
0
        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);
        }
Exemple #2
0
        private void InitBarrier(GameObject b)
        {
            if (SpawnParent != null)
            {
                SpawnHelper.SetParentInHierarchy(b, SpawnParent.gameObject);
            }

            var barrier = b.GetComponent <BarrierScript>();

            barrier.ExplosionParent = ExplosionParent;
            barrier.Life            = BarrierLife;
        }
Exemple #3
0
 protected override void AfterUpdate()
 {
     if (Vector2.Distance(transform.position, Vector2.zero) > 100)
     {
         var position = SpawnHelper.RandomPositionInArea(GameScript.Game.Spawnarea);
         if (position != null)
         {
             transform.position = position.Value;
         }
         else
         {
             transform.position = Vector3.zero;
         }
         lb.Force.AddTorque(Random.Range(0, 360));
     }
 }
Exemple #4
0
        private void SpawnBarrier()
        {
            var spawnArea = Spawnarea;

            if (spawnArea != null)
            {
                var position = SpawnHelper.RandomPositionInArea(spawnArea);
                if (position != null)
                {
                    var b = SpawnHelper.TrySpawn(BarrierPrefab, position.Value, Quaternion.identity);
                    if (b != null)
                    {
                        InitBarrier(b);
                        UpdateLoadingPanel();
                    }
                }
            }
        }
Exemple #5
0
        public void PlaceBomb()
        {
            if (FindObjectsOfType <HelpItemScript>().Length >= 5)
            {
                return;
            }

            Vector2?position;

            do
            {
                position = SpawnHelper.RandomPositionInArea(GameScript.Game.Spawnarea);
            } while (position == null);

            var bomb          = Instantiate(gameObject, position.Value, Quaternion.identity);
            var rotationspeed = Random.Range(0, 30) - Random.Range(0, 30);

            var rb = GetRigidbody(bomb);

            rb.AddTorque(rotationspeed * Time.deltaTime);
            rb.AddForce(Vector2.up * 10 * Time.deltaTime);
        }
Exemple #6
0
        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();
        }