Esempio n. 1
0
        public C_Object TakeObject()
        {
            _currentRobotArm  = null;
            _currentRobotPart = null;

            var obj = _currentObject;

            _currentObject = null;

            ChangeLEDColor(new Color(.04f, .04f, .04f));

            return(obj);
        }
Esempio n. 2
0
        public void OnCollisionEnter(Collision collision)
        {
            if (_currentObject != null)
            {
                return;
            }

            var obj = collision.collider.GetComponent <C_Object>();

            if (obj == null || obj.ObjectType != _workbenchType)
            {
                return;
            }

            var robotArm  = collision.collider.GetComponent <C_RobotArm>();
            var robotPart = collision.collider.GetComponent <C_RobotPart>();

            if (robotArm == null && robotPart == null)
            {
                return;
            }

            _currentObject = obj;

            ChangeLEDColor(new Color(1.0f, 0.15f, 0));

            if (robotArm != null)
            {
                _currentRobotArm = robotArm;

                if (_currentRobotArm.Progress >= 1f)
                {
                    ChangeLEDColor(new Color(.04f, 1f, 0));
                }
            }
            else if (robotPart != null)
            {
                _currentRobotPart = robotPart;

                if (_currentRobotPart.Progress >= _currentRobotPart.Hardness)
                {
                    ChangeLEDColor(new Color(.04f, 1f, 0));
                }
            }

            obj.transform.SetParent(_objectPosition);
            obj.transform.localPosition = -obj.OffsetHand.localPosition;
            obj.transform.localRotation = Quaternion.identity;
            obj.EnterWorkbench();
        }