Exemple #1
0
    private void OnDestructibleWallDestroy(DestructibleWall destructibleWall)
    {
        destructibleWall.OnDestroy.RemoveListener(OnDestructibleWallDestroy);

        SetEntityType(EEntityType.None, destructibleWall.transform.position);

        _destructibleWalls.Remove(destructibleWall);

        // Spanw a bonus?
        if (Random.value < _gameSettings.BonusProbability)
        {
            AddBonus(destructibleWall.transform.position);
        }
    }
Exemple #2
0
    public void AddDestructibleWall(Vector3 worldPosition)
    {
        DestructibleWall destructibleWall = Instantiate(
            _destructibleWallPrefab,
            worldPosition,
            Quaternion.identity,
            transform
            );

        destructibleWall.OnDestroy.AddListener(OnDestructibleWallDestroy);

        _destructibleWalls.Add(destructibleWall);

        SetEntityType(EEntityType.DestructibleWall, destructibleWall.transform.position);
    }
Exemple #3
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "DestructibleWall")
     {
         DestructibleWall wall = collision.gameObject.GetComponent <DestructibleWall>();
         if (wall != null && wall.AttemptToDestroy(collision.relativeVelocity.y))
         {
             SoundManager.main.PlaySound(SoundType.DestroyBlock);
             Debug.Log("Paow!");
         }
         else
         {
             Debug.Log(string.Format("Not enough ({0})", collision.relativeVelocity.y));
         }
     }
 }
Exemple #4
0
 public void OnDestroyedWall(DestructibleWall wall)
 {
     OnWallDestroy?.Invoke(this);
 }