Esempio n. 1
0
 /// <inheritdoc/>
 public void DragStarted()
 {
     draggedInstance = GetControllableInstance(selectedVariant);
     draggedInstance.transform.SetParent(ScenarioManager.Instance.transform);
     draggedInstance.transform.SetPositionAndRotation(inputManager.MouseRaycastPosition,
                                                      Quaternion.Euler(0.0f, 0.0f, 0.0f));
 }
Esempio n. 2
0
        /// <inheritdoc/>
        public void DragFinished()
        {
            var controllable = draggedInstance.GetComponent <ScenarioControllable>();

            ScenarioManager.Instance.GetExtension <ScenarioUndoManager>()
            .RegisterRecord(new UndoAddElement(controllable));
            draggedInstance = null;
        }
Esempio n. 3
0
        public void SetupNewControllable(ScenarioControllable scenarioControllable)
        {
            var rb = scenarioControllable.gameObject.GetComponentInChildren <Rigidbody>();

            if (rb != null)
            {
                rb.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
                rb.isKinematic            = true;
            }
            var colliders = scenarioControllable.gameObject.GetComponentsInChildren <Collider>();

            foreach (var col in colliders)
            {
                col.isTrigger = true;
            }
        }
Esempio n. 4
0
 /// <inheritdoc/>
 public void DragCancelled()
 {
     draggedInstance.RemoveFromMap();
     draggedInstance.Dispose();
     draggedInstance = null;
 }