Exemplo n.º 1
0
        public override CheckResult CanAttach(GameObject obj)
        {
            if (Contains(obj))
            {
                return(CheckResult.VALID);
            }

            Physical physical = obj as Physical;

            if (physical == null)
            {
                return(CheckResult.INVALID);
            }

            CheckResult result = base.CanAttach(obj);

            if (result != CheckResult.VALID)
            {
                return(result);
            }

            if (capacity >= 0 && physical.GetVolume() > remainingCapacity)
            {
                return(CheckResult.RESTRICTED);
            }

            return(CheckResult.VALID);
        }
Exemplo n.º 2
0
        public CheckResult CanContain(Physical obj)
        {
            if (obj == null)
            {
                return(CheckResult.INVALID);
            }

            double objVolume = obj.GetVolume();

            if (objVolume > innerVolume)
            {
                return(CheckResult.INVALID);
            }

            if (objVolume > remainingVolume)
            {
                return(CheckResult.RESTRICTED);
            }

            return(CheckResult.VALID);
        }