Example #1
0
        public void TransferToAnother(ISubstanceContainer otherContainer)
        {
            Debug.Log(gameObject.name + ": transfering liquids to " + otherContainer.gameObject);

            float amount = Mathf.Min(_transferAmount, _mixture.Volume);

            if (Math.Abs(amount) < 0.0001f)
            {
                Debug.Log("Nothing to transfer!");
            }
            else
            {
                Debug.Log("Amount: " + amount);
                SubstanceMixture subtractedMixture = _mixture.SubtractVolume(amount);

                otherContainer.TransferInto(subtractedMixture);

                _mixture.Concatinate(subtractedMixture);
            }
        }
Example #2
0
        public void TransferInto(SubstanceMixture incomingMixture)
        {
            float remainingVolume = GetRemainingVolume();

            SubstanceMixture concatinationMixture;

            if (remainingVolume >= incomingMixture.Volume)
            {
                concatinationMixture = incomingMixture.Clone() as SubstanceMixture;
                incomingMixture.Clear();
            }
            else
            {
                concatinationMixture = incomingMixture.SubtractVolume(remainingVolume);
            }

            _mixture.Concatinate(concatinationMixture);

            Debug.Log(gameObject.name + ": New contents: " + _mixture);
        }