Ejemplo n.º 1
0
        public void OnCoroutineEnd()
        {
            switch (currentState)
            {
            case ObjectPart.States.Assembling:
                Disassembled = false;
                break;

            case ObjectPart.States.Disassembling:
                Disassembled = true;
                break;

            case ObjectPart.States.Selecting:
                GetComponent <GlowObject>().GlowOn();
                Selected = true;
                //PlaySound();
                break;

            case ObjectPart.States.UnSelecting:
                GetComponent <GlowObject>().GlowOff();
                Selected = false;
                break;

            default:
                break;
            }
            currentState = ObjectPart.States.Idle;
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 3
0
 private void UnSelect()
 {
     if (Disassembled)
     {
         currentState = ObjectPart.States.UnSelecting;
         myObjectPart.DisselectPart();
         GetUnSelected();
     }
 }
Ejemplo n.º 4
0
 private void Select()
 {
     if (Disassembled)
     {
         currentState = ObjectPart.States.Selecting;
         myObjectPart.SelectPart(this);
         myGlowObject.GlowOn();
     }
 }
Ejemplo n.º 5
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));
     }
 }
Ejemplo n.º 6
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();
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
0
        public void OnCoroutineEnd()
        {
            switch (currentState)
            {
            case ObjectPart.States.Assembling:
                assembled          = true;
                myCollider.enabled = true;
                myCategoryPanel.HideBgImage();
                break;

            case ObjectPart.States.Disassembling:
                assembled          = false;
                myCollider.enabled = false;
                myCategoryPanel.ShowBgImage();
                break;

            default:
                break;
            }
            currentState = ObjectPart.States.Idle;
        }
Ejemplo n.º 9
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));
     }
 }