Example #1
0
    public FlameController LowerIntensity(Vector2 coords, double waterStrength, out double outIntensity)
    {
        outIntensity = 0f;

        GridItem cell = _fireGrid.GetGridItem(coords.x, coords.y);

        FlameController flame = cell.GetPayload(0) as FlameController;

//        Debug.Log("Clicked on  " + flame + " at position " + coords);
        if (flame != null)
        {
            outIntensity = cell.GetVariable <double>("intensity");
            cell.SetVariable("intensity",
                             outIntensity - waterStrength
                             );
            if (cell.GetVariable <double>("intensity") <= 0)
            {
                Debug.Log(_levelManager.Player.GetRemainingHitPoints() / _growthFeedback);
                if (_activeFlames.Count < _levelManager.Player.GetRemainingHitPoints() / _growthFeedback)
                {
                    Grow();
                }
                if (Random.Range(0f, 1f) > _spreadFeedback)
                {
                    Spread();
                }
                _activeFlames.Remove(cell);
                _flamePool.Remove(flame);

                cell.SetVariable("intensity", 0d);
                cell.SetVariable("onfire", false);
//                Debug.Log( cell.GetVariable<int>( "intensity" )  );
                cell.RemovePayload(0);
            }
            else
            {
                cell.SetPayload(flame, 0);
            }
            _fireGrid.UpdateGridItem(coords, cell);
        }
        return(flame);
    }
Example #2
0
 public void RemoveNumber(ObjectPoolItem sender)
 {
     _poolController.Remove(sender);
     PoolCount = _poolController.ObjectCount();
 }