Example #1
0
        public void Assemble()
        {
            //if(history.IsEmpty())
            //	return;
            if (selected)
            {
                UnSelect();
            }
            StopAllCoroutines();
            currentState = States.Assembling;
            //Debug.Log(soundName + " @ start local position: " + startLocalPosition);
            StartCoroutine(PhysicalManipulation.LocalMove(transform, transform.localPosition, startLocalPosition, UIManager.ins.MovementTime));
            StartCoroutine(PhysicalManipulation.LocalRotate(transform, transform.localRotation, startLocalRotation, UIManager.ins.MovementTime));

            if (selectedScale != 1f)
            {
                StartCoroutine(PhysicalManipulation.LocalScale(transform, transform.localScale, Vector3.one, UIManager.ins.MovementTime));
            }

            if (!assembled)
            {
                SubAssemble();
            }

            myCollider.enabled = false;
            selected           = false;
            //disassembled = false;
        }
Example #2
0
 private void StartDisassemble()
 {
     //StartCoroutine(Move(transform.position, new Vector3(Random.Range(-15, 5), Random.Range(-15, 5), transform.position.z), 1f));
     StopAllCoroutines();
     currentState = ObjectPart.States.Disassembling;
     StartCoroutine(PhysicalManipulation.Move(transform, transform.position, disassemblePosition, UIManager.ins.MovementTime));
     StartCoroutine(PhysicalManipulation.Rotate(transform, transform.rotation, Quaternion.Euler(disassembleRotation), UIManager.ins.MovementTime));
 }
Example #3
0
 public void GetSelected()
 {
     StopAllCoroutines();
     StartCoroutine(PhysicalManipulation.Move(transform, transform.position, UIManager.ins.PartPositionOnPanel, UIManager.ins.MovementTime));
     if (selectedScale != 1f)
     {
         StartCoroutine(PhysicalManipulation.LocalScale(transform, transform.localScale, Vector3.one * selectedScale, UIManager.ins.MovementTime));
     }
 }
Example #4
0
 public void PartAssembled()
 {
     amountOfAssembledParts++;
     if (amountOfAssembledParts >= parts.Count)
     {
         UIManager.ins.HidePartPanel();
         DisselectPart();
         currentState = ObjectPart.States.Assembling;
         StartCoroutine(PhysicalManipulation.Rotate(transform, transform.rotation, startRotation, UIManager.ins.MovementTime));
     }
 }
Example #5
0
 public void Disassemble()
 {
     currentState = ObjectPart.States.Disassembling;
     StartCoroutine(PhysicalManipulation.Rotate(transform, transform.rotation, startRotation, UIManager.ins.MovementTime));
     foreach (var c in parts)
     {
         c.Disassemble();
     }
     amountOfAssembledParts = 0;
     myCategoryPanel.ShowBgImage();
 }
Example #6
0
        public void GetSelected()
        {
            //history.SaveState(new PartMemento(transform.localPosition));
            StopAllCoroutines();
            StartCoroutine(PhysicalManipulation.Move(transform, transform.position, UIManager.ins.PartPositionOnPanel, UIManager.ins.MovementTime));
            if (selectedScale != 1f)
            {
                StartCoroutine(PhysicalManipulation.LocalScale(transform, transform.localScale, Vector3.one * selectedScale, UIManager.ins.MovementTime));
            }

            //selected = true;
            //PlaySound();
        }
Example #7
0
 public void GetUnSelected()
 {
     if (selected)
     {
         StopAllCoroutines();
         StartCoroutine(PhysicalManipulation.Move(transform, transform.position, disassemblePosition, UIManager.ins.MovementTime));
         if (selectedScale != 1f)
         {
             StartCoroutine(PhysicalManipulation.LocalScale(transform, transform.localScale, Vector3.one, UIManager.ins.MovementTime));
         }
         myGlowObject.GlowOff();
     }
 }
Example #8
0
 public void SubDisassemble()
 {
     if (hasSubParts)
     {
         StartCoroutine(PhysicalManipulation.Rotate(transform, transform.localRotation, startLocalRotation, UIManager.ins.MovementTime));
         foreach (var c in subParts)
         {
             c.Disassemble();
         }
         myCollider.enabled        = false;
         assembled                 = false;
         amountOfAssembledSubParts = 0;
     }
 }
Example #9
0
        public void GetUnSelected()
        {
            //currentState = States.UnSelecting;
            if (assembled)
            {
                StopAllCoroutines();
                StartCoroutine(PhysicalManipulation.Rotate(transform, transform.rotation, Quaternion.Euler(disassembleRotation), 1f));
                StartCoroutine(PhysicalManipulation.Move(transform, transform.position, disassemblePosition, UIManager.ins.MovementTime));
                if (selectedScale != 1f)
                {
                    StartCoroutine(PhysicalManipulation.LocalScale(transform, transform.localScale, Vector3.one, UIManager.ins.MovementTime));
                }
                //selected = false;
            }

            GlowOff();
        }
Example #10
0
 public void Assemble()
 {
     //if(history.IsEmpty())
     //	return;
     StopAllCoroutines();
     currentState = ObjectPart.States.Assembling;
     StartCoroutine(PhysicalManipulation.LocalMove(transform, transform.localPosition, startLocalPosition, UIManager.ins.MovementTime));
     StartCoroutine(PhysicalManipulation.LocalRotate(transform, transform.localRotation, startLocalRotation, UIManager.ins.MovementTime));
     if (selectedScale != 1f)
     {
         StartCoroutine(PhysicalManipulation.LocalScale(transform, transform.localScale, Vector3.one, UIManager.ins.MovementTime));
     }
     myCollider.enabled = false;
     myObjectPart.PartAssembled();
     selected = false;
     myGlowObject.GlowOn();
     //disassembled = false;
 }
Example #11
0
 public void Assemble()
 {
     if (IsAnyPartSubDisassembled())
     {
         selectedPart.SubAssemble();
         //selectedPart.SendMessage("UnSelect");
     }
     else
     {
         UIManager.ins.HidePartPanel();
         DisselectPart();
         foreach (var c in parts)
         {
             if (c.Disassembled)
             {
                 amountOfAssembledParts++;
                 c.Assemble();
             }
         }
         currentState = ObjectPart.States.Assembling;
         StartCoroutine(PhysicalManipulation.Rotate(transform, transform.rotation, startRotation, UIManager.ins.MovementTime));
     }
 }