public void Spawn(FieldObject obj) { var primitive = _towerElementsFactory.Create(_prefabsContainer.Get("Cyllinder")); primitive.FieldObject = obj; primitive.transform.position = obj.Position; primitive.transform.SetParent(_rootGameObject.transform); primitive.IsKinematic = true; primitive.IsColored = true; // primitive.transform.localScale = Vector3.one * _levelConfig.BallRadius; OnBallSpawned(primitive); }
public InputController(StringPrefabPairContainer prefabContainer, CameraController cameraController) { _inputCanvas = GameObject.Instantiate(prefabContainer.Get("InputCanvas")); _cameraController = cameraController; var eventTrigger = _inputCanvas.GetComponent <EventTrigger>(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerClick; entry.callback.AddListener((eventData) => { Raycast(eventData); }); eventTrigger.triggers.Add(entry); EventTrigger.Entry entry2 = new EventTrigger.Entry(); entry2.eventID = EventTriggerType.Drag; entry2.callback.AddListener((eventData) => { Drag(eventData); }); eventTrigger.triggers.Add(entry2); }