public bool Place() { if (string.IsNullOrEmpty(CanPlace(_model.transform.position, _model.transform.rotation))) { GameObject go = UnityEngine.Object.Instantiate(_obj, _model.transform.position, _model.transform.rotation); go.SetActive(true); OnPlaced?.Invoke(go); return(true); } return(false); }
public void OverPlacementZone(Transform toPlace) { if (_isheld) { _image.raycastTarget = true; _isheld = false; _placementZone = toPlace; transform.position = _placementZone.position; _isPlaced = true; OnPlaced?.Invoke(); OnHeld(false); } }
public bool Place() { if (_target != null) { if (_placeRequirements.All(x => x() == true)) { GameObject cardGO = UnityEngine.Object.Instantiate(_obj, _target.transform.root); BoosterModBroadcaster card = cardGO.GetComponent <BoosterModBroadcaster>(); card.gameObject.SetActive(true); OnPlaced?.Invoke(cardGO); PlacementController.Instance.CancelAll(); return(true); } } return(false); }
public bool Place() { if (_currentMatch != null) { GameObject placed = UnityEngine.Object.Instantiate(_obj); placed.SetActive(true); placed.transform.position = _currentMatch.Position + Vector3.back * 0.1f; placed.transform.rotation = _currentMatch.Rotation; placed.transform.parent = _currentMatch.Component.transform; foreach (var pair in _currentMatch.SlotPointMappings) { pair.Key.Attach(_componenet); } OnPlaced?.Invoke(placed); return(true); } return(false); }
//Loops: private void Update() { //let headpose warmup a little: if (Time.frameCount < 3) { return; } HeadActivityDetermination(); LookingAtFloorDetermination(); //are we good to go? if (_headIdle && _placementValid) { //place content: if (content != null) { content.SetActive(true); content.transform.position = Location; //face user after placement: Vector3 to = Vector3.Normalize(Location - _mainCamera.position); Vector3 flat = Vector3.ProjectOnPlane(to, Vector3.up); if (!flippedForward) { flat *= -1; } content.transform.rotation = Quaternion.LookRotation(flat); } //instructions: if (instructions != null) { instructions.SetActive(false); } Placed = true; OnPlaced?.Invoke(Location); enabled = false; } }