コード例 #1
0
    public void Burning()
    {
        Owner.Amount -= 0.5f * Time.deltaTime;

        _cellPosition = new Vector2Int((int)Math.Round(this.transform.position.x), (int)Math.Round(this.transform.position.y));

        MediumCell cell = _airMedium.GetCellByPosition(_cellPosition);

        for (int i = 0; i < IOElements.Length; i++)
        {
            if (i != 2)
            {
                cell.Content[i] += IOElements[i] * Time.deltaTime;
            }
            else // Oxygen
            {
                if (cell.Content[i] > 0)
                {
                    cell.Content[i] -= IOElements[i] * Time.deltaTime;
                }
                else //if no Oxygen Fire dies
                {
                    _burning = false;
                    Destroy(_fire.gameObject);
                }
            }
        }
    }
コード例 #2
0
    void Produce()
    {
        _position = new Vector2Int((int)Math.Round(this.transform.position.x), (int)Math.Round(this.transform.position.y));

        MediumCell cell = _airMedium.GetCellByPosition(_position);

        if (ProducerType.ProduceElements)
        {
            for (int i = 0; i < ElementsOutput.Length; i++)
            {
                cell.Content[i] += ElementsOutput[i] * Time.deltaTime;
            }
        }
    }