public void RegisterStaticObject(StaticObjectBehaviour obj) { Debug.Log("REGISTER!"); if (_StaticObjects.Contains(obj)) { return; } _StaticObjects.Add(obj); }
public static ObjectCollided Get(StaticObjectBehaviour sObj) { if (_Instance == null) { _Instance = new ObjectCollided(); } _Instance.CollidingObject = sObj; return(_Instance); }
private void NotifyAboutCollidingObject(StaticObjectBehaviour obj) { _Icon.sprite = obj.Icon; DOTween.Kill(_SpeechBubble, false); _SpeechBubble.alpha = 1.0f; _SpeechBubble .DOFade(0.0f, 0.5f) .SetDelay(3.0f); }
void ChooseObject() { if (!IsHolding) { RaycastHit hit; var ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, Mathf.Infinity, hitLayers)) { if (hit.rigidbody != null && hit.collider.gameObject.layer == 9) { tempObject = hit.collider.gameObject; if (Input.GetMouseButtonDown(0)) { FirstClick = Input.mousePosition; selectedObject = tempObject.GetComponent <StaticObjectBehaviour>(); IsHolding = true; Cursor.visible = false; selectedObject.ShowPath(); TinyMessengerHub .Instance .Publish(Msg.PlaySound.Get(SoundController.Sounds.PICK_UP_OBJ)); } } } } if (Input.GetMouseButtonUp(0)) { if (selectedObject != null) { selectedObject.Body.angularVelocity = Vector2.zero; selectedObject.HidePath(); } selectedObject = null; IsHolding = false; Cursor.visible = true; TinyMessengerHub .Instance .Publish(Msg.PlaySound.Get(SoundController.Sounds.PUT_DOWN_OBJ)); } }