private void Update() { foreach (GameObject LinkedObject in LinkedSpawners) { Debug.DrawLine(GetComponent <Renderer>().bounds.center, end: LinkedObject.GetComponent <Renderer>().bounds.center, color: Color.red); } }
public override void Start() { if (!LinkedObject.HasComponent <Button2DComponent>()) { Debug.LogWarning("The 2DObject \"" + LinkedObject.ObjectName + "\" has a Dropdown 2D Component but no button to interact with it. A button 2D Component has automatically been added.", true); LinkedObject.AddComponent(new Button2DComponent()); } DropDownParent = new Object2D("Dropdown_" + LinkedObject.ObjectName, LinkedObject.Position + new Vector2(0, LinkedObject.Size.Y / 2), Size, LinkedObject.Rotation, new Component2D[] { new Image2DComponent(DefaultValues.PixelTexture, DropDownColor), new Spacer2DComponent(SpacerOption.VerticalSpacer, ItemSpacing, Alignment.TopLeft, ItemSpacing) }, Alignment.TopLeft, LinkedObject.Layer, LinkedObject); if (MustClick) { LinkedObject.GetComponent <Button2DComponent>().OnClick += () => OpenDropdown(); LinkedObject.GetComponent <Button2DComponent>().OnClickOutside += () => CloseDropdown(); } else { LinkedObject.GetComponent <Button2DComponent>().OnEnter += () => OpenDropdown(); LinkedObject.GetComponent <Button2DComponent>().OnExit += () => CloseDropdown(); } foreach (Object2D obj in DropdownItems.ToArray()) { DropDownParent.AddChild(obj); } CloseDropdown(); }
public void OnPointerClick(PointerEventData eventData) { //Catch double click on layer, to move camera to the linked object if (layerType == LayerType.ANNOTATION) { Annotation annotation = LinkedObject.GetComponent <Annotation>(); CameraModeChanger.Instance.CurrentCameraControls.MoveAndFocusOnLocation(annotation.WorldPointerFollower.WorldPosition, new Quaternion()); annotation.StartEditingText(); } else if (layerType == LayerType.CAMERA) { WorldPointFollower follower = LinkedObject.GetComponent <WorldPointFollower>(); FirstPersonLocation obj = LinkedObject.GetComponent <FirstPersonLocation>(); CameraModeChanger.Instance.CurrentCameraControls.MoveAndFocusOnLocation(follower.WorldPosition, obj.savedRotation); } else { //If this is a Transformable, select it var transformable = LinkedObject.GetComponent <Transformable>(); if (transformable) { transformable.Select(); ToggleLayerOpened(); } } }
// Start is called before the first frame update void Start() { //Sets bridge open/closed if (LinkedObjectType == ObjectType.Bridge) { Activated = LinkedObject.GetComponent <Bridge>().isOpen(); } }
public override void Draw() { if ((float)Game.Gametime.TotalGameTime.TotalSeconds > TimeToPass) { LinkedObject.GetComponent <Text2DComponent>().Text = "FPS: " + FramesPassed; TimeToPass += 1; FramesPassed = 0; } else { FramesPassed += 1; } }
public override void Start() { Debug.Log(LinkedObject.ObjectName + "\nText: " + (LinkedObject.HasComponent <Text2DComponent>() ? (LinkedObject.Layer + ((float)LinkedObject.GetComponent <Text2DComponent>().SubLayer / 10000)).ToString() : "null") + "\nImage: " + (LinkedObject.Layer + ((float)LinkedObject.GetComponent <Image2DComponent>().SubLayer / 10000)).ToString() + "\n"); }