private void Start() { trayInputButton = GetComponentInParent <TrayInputButton>(); if (trayInputButton != null) { clickListener = trayInputButton.GetComponent <ButtonClickListener>(); clickListener.OnClick.AddListener(OnClicked); } else { Log.LogError(this, "TrayInputButton not found"); } dispatcher = Service.Get <EventDispatcher>(); GameObject localPlayerGameObject = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject; if (localPlayerGameObject != null) { locomotionEventBroadcaster = localPlayerGameObject.GetComponent <LocomotionEventBroadcaster>(); SlideController component = localPlayerGameObject.GetComponent <SlideController>(); if (component != null && component.enabled) { changeState(isSliding: true); } } if (locomotionEventBroadcaster != null) { locomotionEventBroadcaster.OnControllerChangedEvent += onControllerChanged; } else { Log.LogError(this, "LocomotionEventBroadcaster was not found in the scene"); } }
void Start() { pointsInTime = new List <PointInTime>(); rb = GetComponent <Rigidbody>(); slide = GetComponent <SlideController>(); _colliders = GetComponentsInChildren <Collider>(); }
// Use this for initialization void Start() { CurrentHealth = maxHealth; healthControl = slider.GetComponent <SlideController>(); animator = GetComponent <Animator>(); prevHealth = CurrentHealth; }
public SlideController(Vector2 _mapWidth, Vector2 _mapHeight, Mode _mode = Mode.SlideAndZoom, int _version = 1) { instance = this; directedWidth = _mapWidth; directedHeight = _mapHeight; mode = _mode; firstTouchStart = new Vector2(-100, -100); secondTouchStart = new Vector2(-100, -100); firstTouch = new Vector2(0, 0); secondTouch = new Vector2(0, 0); delta = new Vector2(0, 0); zoomDeltaStart = 0; mapWidthStart = 0; zoomDelta = 0; lastTouches = 0; isZooming = false; isSliding = false; if (version != _version) { Debug.LogWarning("Wrong version of SlideController"); } }
public void Place(GameObject slideToPlace) { placedSlide = slideToPlace; placedSlide.transform.position = placePoint.position; SlideController tempSlide = placedSlide.gameObject.GetComponent <SlideController>(); tempSlide.SetHolder(gameObject); MySceneManager.instance.slideDisplayed = placedSlide.gameObject.name; }
public void SetDataHandle(AvatarDataHandle dataHandle, SlideController slideController) { this.slideController = slideController; this.dataHandle = dataHandle; getTubeDefinitions(); if (dataHandle != null && Service.Get <CPDataEntityCollection>().TryGetComponent(dataHandle.Handle, out tubeData)) { tubeData.OnTubeSelected += onTubeSelected; onTubeSelected(tubeData.SelectedTubeId); } }
/** * * Viewer Controller constructor * * @param slides List<Sprite> "the sprite objects for the slides" * * @param video VideoPlayer "The video object preloaded with video" * * @param screen GameObject "the 2d plane that hosts the slides" * **/ public ViewerController(List <Sprite> slides, VideoPlayer video, GameObject screen) { Debug.Log("Standard ViewerController Initializer"); this.aController = ActiveController.slide; this.sController = new SlideController(slides, screen); this.slidesBuilt = true; this.vController = new VideoController(video); this.videoBuilt = true; this.sController.setEnabled(true); this.vController.setEnabled(false); Debug.Log("Finished Standard ViewerController CTOR"); }
public void Restart() { GameObject localPlayerGameObject = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject; if (localPlayerGameObject != null) { locomotionEventBroadcaster = localPlayerGameObject.GetComponent <LocomotionEventBroadcaster>(); SlideController component = localPlayerGameObject.GetComponent <SlideController>(); if (component != null && component.enabled) { changeState(isSliding: true); } } }
public void Place(GameObject slideToPlace) { placedSlide = slideToPlace; StartCoroutine(MoveSlide()); //while (!inPlace) //{ // placedSlide.transform.position = Vector3.MoveTowards(placedSlide.transform.position, placePoint.transform.position, 0.05f); //} //placedSlide.transform.position = placePoint.transform.position; SlideController tempSlide = placedSlide.gameObject.GetComponent <SlideController>(); tempSlide.SetHolder(gameObject); MySceneManager.instance.slideDisplayed = placedSlide.gameObject.name; }
private void PickUpSlide(Collider slide) { SlideController tempSlide = slide.gameObject.GetComponent <SlideController>(); // Is the slide in the microscope if (tempSlide.IsHeld()) { // Release the slide from the microscope MicroscopeController tempMicro = tempSlide.GetHolder().GetComponent <MicroscopeController>(); tempMicro.Release(); tempSlide.SetHolder(gameObject); } else { ; } }
public static void OnInit() { _stepController = FindObjectOfType <SlideController>(); if (_stepController) { m_StepsSO = new SerializedObject(_stepController); m_ReordableList = new ReorderableList(m_StepsSO, m_StepsSO.FindProperty("_slides"), true, true, true, true); m_ReordableList.drawHeaderCallback = (rect) => EditorGUI.LabelField(rect, "Slides"); m_ReordableList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { rect.y += TOP_PADDING; rect.height = EditorGUIUtility.singleLineHeight; GUIContent steplabel = new GUIContent(string.Format("Slide {0}", index)); EditorGUI.PropertyField(rect, m_ReordableList.serializedProperty.GetArrayElementAtIndex(index), steplabel); }; } }
// Start is called before the first frame update void Start() { if (MySceneManager.instance) { if (MySceneManager.instance.slideDisplayed != "") { //Place(GameObject.Find(MySceneManager.instance.slideDisplayed)); GameObject tempSlide = GameObject.Find(MySceneManager.instance.slideDisplayed); placedSlide = tempSlide; placedSlide.transform.position = placePoint.transform.position; placedSlide.transform.eulerAngles = new Vector3(-90f, 0f, 0f); inPlace = true; readyToEnter = true; SlideController tempSlideControl = placedSlide.gameObject.GetComponent <SlideController>(); tempSlideControl.SetHolder(gameObject); MySceneManager.instance.slideDisplayed = placedSlide.gameObject.name; } } }
// void OnMultipleImageSelect(List<string> imgPath) // { // Debug.Log("Multiple images Selected"); // this.slidePathSet = imgPath; // for (int i = 0; i < this.slidePathSet.Count; i++) // Debug.Log("these are the results" + slidePathSet[i]); // Debug.Log("about to populate slides"); // // Debug.Log("Finished populating slides"); // // this.slidesBuilt = true; // } // // void OnVideoSelect(string vidPath) // { // this.videoPath = vidPath; // Debug.Log("OnVideoSelect Location : " + vidPath); // // // this.videoBuilt = true; // // } // public bool buildUpdate() { // Debug.Log("viewer update"); //don't try and populate until the user has chosen files if (this.slidePathSet == null || this.videoPath == null) { return(false); } //the first time populate if (!isBuilt()) { Debug.Log("building"); populateSlides(); this.sController = new SlideController(slideSet, screen); this.sController.setEnabled(true); populateVideo(); this.vController = new VideoController(video); this.vController.setEnabled(false); return(true); } return(false); }
void Start() { //TODO: public instatiate a SceneView sController = new SlideController(this.slideLocation, screen); this.sController.Update(); }
void FixedUpdate() { Ray ray = new Ray(transform.position, transform.forward); // Looking to determine if there is something to interact with Physics.Raycast(ray, out RaycastHit hit, maxInteractionDistance); // You try to grab here if (Input.GetMouseButtonDown(0)) { // TODO Add all grabbin cases i.e grabbing and you want to switch with something and etc // Nothing in your hand and you're trying to grab something if (!grabbing && hit.collider != null && hit.collider.gameObject.layer == 8) { heldObject = hit.collider; grabbing = true; // Check if we are grabbing a slide if (hit.collider.gameObject.CompareTag("Slide")) { SlideController tempSlide = hit.collider.gameObject.GetComponent <SlideController>(); // Is the slide in the microscope if (tempSlide.IsHeld()) { // Release the slide from the microscope MicroscopeController tempMicro = tempSlide.GetHolder().GetComponent <MicroscopeController>(); tempMicro.Release(); tempSlide.SetHolder(gameObject); } } } // Inserting and releasing Slide Bed if we are grabbing it else if (heldObject != null && heldObject.gameObject.CompareTag("Slide") && hit.collider != null && hit.collider.gameObject.name == "Slide Bed") { MicroscopeController tempMicroscopeController = hit.collider.transform.parent.gameObject.GetComponent <MicroscopeController>(); if (!tempMicroscopeController.ContainSlide()) { tempMicroscopeController.Place(heldObject.gameObject); heldObject.gameObject.GetComponent <SlideController>().SetHolder(tempMicroscopeController.gameObject); Release(); } else { // Placeholder for tooltip that tells there is a slide in the microscope Debug.Log("Theres already A slide in the microscope"); } } // You are releasing it into nothing i.e dropping it else { Release(); } if (hit.collider != null && hit.collider.gameObject.name == "Looking part") { // Saves position // TODO Save slide posiitons and microscope heling SavePlayer(); MySceneManager.instance.SwitchScene("MicroscopeView"); } } // Object Tracking for when you are holding it // Goes faster wehn you are moving to prevent jitter if (grabbing) { bool isMoving = System.Math.Abs(Input.GetAxisRaw("Horizontal") + Input.GetAxisRaw("Vertical")) > 0; heldObject.transform.position = Vector3.MoveTowards(heldObject.transform.position, holdPoint.transform.position, isMoving ? .08f : 0.05f); } }
public static void OnGUI() { if (_slideController == null && GameObject.FindObjectOfType <SlideController>()) { _slideController = GameObject.FindObjectOfType <SlideController>(); } scrollPosition = GUILayout.BeginScrollView(scrollPosition, true, true); GUIStyle guiStyle = new GUIStyle(); guiStyle.alignment = TextAnchor.MiddleCenter; EditorGUILayout.Space(); _selectedSlideTypeEnumVal = (ESlideType)EditorGUILayout.EnumPopup("Select slide type : ", _selectedSlideTypeEnumVal); _slideName = EditorGUILayout.TextField("Slide GameObject name", _slideName); DrawSpecificSlideOptions(); //CANVAS GUILayoutExtension.DrawHorizontalLine("More options"); _addCanvas = EditorGUILayout.Toggle("Canvas : ", _addCanvas); if (_addCanvas) { _canvasRenderMode = (RenderMode)EditorGUILayout.EnumPopup("Canvas type : ", _canvasRenderMode); if (_canvasRenderMode == RenderMode.WorldSpace) { _deviceType = (apperture.editor.DeviceType)EditorGUILayout.EnumPopup("Device type : ", _deviceType); _canvasSizeIfWorldSpace = apperture.editor.DeviceUtility.GetSize(_deviceType); EditorGUILayout.BeginHorizontal(); var oldCol = GUI.contentColor; GUI.contentColor = Color.yellow; EditorGUILayout.LabelField("Width : " + _canvasSizeIfWorldSpace.x, GUILayout.MaxWidth(100f)); EditorGUILayout.LabelField("Height : " + _canvasSizeIfWorldSpace.y, GUILayout.MaxWidth(100f)); GUI.contentColor = oldCol; EditorGUILayout.EndHorizontal(); _eventCamera = EditorGUILayout.ObjectField("Event Camera : ", _eventCamera, typeof(Camera), true) as Camera; } if (_canvasRenderMode == RenderMode.ScreenSpaceCamera) { _eventCamera = EditorGUILayout.ObjectField("Event Camera : ", _eventCamera, typeof(Camera), true) as Camera; _canvasPlaneDistance = EditorGUILayout.FloatField("Plane distance : ", _canvasPlaneDistance); } EditorGUILayout.Space(); //IMAGES GUILayoutExtension.DrawHorizontalLine("Image(s)"); _addImg = EditorGUILayout.Toggle("Image", _addImg); if (_addImg) { _imgNb = Mathf.Clamp(EditorGUILayout.IntField("Number :", _imgNb), 0, 10); GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); EditorGUILayout.Space(); for (int i = 0; i < _imgNb; i++) { EditorGUILayout.LabelField("Image " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { }); EditorGUILayout.Space(); _imgNames[i] = EditorGUILayout.TextField("Name :", _imgNames[i]); _imgSprites[i] = EditorGUILayout.ObjectField("Sprite : ", _imgSprites[i], typeof(Sprite), false) as Sprite; _imgSetNativeSizes[i] = EditorGUILayout.Toggle("Native Size :", _imgSetNativeSizes[i]); _imgAreFullScreen[i] = EditorGUILayout.Toggle("FullScreen :", _imgAreFullScreen[i]); if (_imgSetNativeSizes[i] == true) { _imgAreFullScreen[i] = false; } if (_imgAreFullScreen[i] != true) { _imgRectPositions[i] = (ERectPosition)EditorGUILayout.EnumPopup("Button Pos :", _imgRectPositions[i]); _imgOffSets[i] = EditorGUILayout.Vector2Field("Offset :", _imgOffSets[i]); } GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); } } //BUTTONS GUILayoutExtension.DrawHorizontalLine("Button(s)"); _addBtn = EditorGUILayout.Toggle("Button", _addBtn); if (_addBtn) { _btnNb = Mathf.Clamp(EditorGUILayout.IntField("Number : ", _btnNb), 0, 10); GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); EditorGUILayout.Space(); for (int i = 0; i < _btnNb; i++) { EditorGUILayout.LabelField("Button " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { }); EditorGUILayout.Space(); _btnNames[i] = EditorGUILayout.TextField("Button Name :", _btnNames[i]); _btnSprites[i] = EditorGUILayout.ObjectField("Button Sprite :", _btnSprites[i], typeof(Sprite), false) as Sprite; _btnSpritesAreNatives[i] = EditorGUILayout.Toggle("Set native :", _btnSpritesAreNatives[i]); if (_btnSpritesAreNatives[i] == false) { _btnSpriteSizes[i] = EditorGUILayout.Vector2Field("Size :", _btnSpriteSizes[i]); } _btnRectPositions[i] = (ERectPosition)EditorGUILayout.EnumPopup("Button Pos :", _btnRectPositions[i]); _btnOffSets[i] = EditorGUILayout.Vector2Field("Offset :", _btnOffSets[i]); _btnTextNames[i] = EditorGUILayout.TextField("Text Name :", _btnTextNames[i]); _btnTextText[i] = EditorGUILayout.TextField("Text :", _btnTextText[i]); _btnTextSizes[i] = EditorGUILayout.IntField("Size :", _btnTextSizes[i]); _btnTextFonts[i] = (EFontStyle)EditorGUILayout.EnumPopup("Font Style :", _btnTextFonts[i]); _btnColors[i] = EditorGUILayout.ColorField("Color :", _btnColors[i]); GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); } } //TEXTS GUILayoutExtension.DrawHorizontalLine("Text(s)"); _addTxt = EditorGUILayout.Toggle("Text", _addTxt); if (_addTxt) { _txtNb = Mathf.Clamp(EditorGUILayout.IntField("Number : ", _txtNb), 0, 10); GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); EditorGUILayout.Space(); for (int i = 0; i < _txtNb; i++) { EditorGUILayout.LabelField("Text " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { }); EditorGUILayout.Space(); _txtNames[i] = EditorGUILayout.TextField("Text Name :", _txtNames[i]); _txtTexts[i] = EditorGUILayout.TextField("Text :", _txtTexts[i]); _txtSizes[i] = EditorGUILayout.IntField("Size :", _txtSizes[i]); _txtFontStyles[i] = (EFontStyle)EditorGUILayout.EnumPopup("Font Style :", _txtFontStyles[i]); _txtColors[i] = EditorGUILayout.ColorField("Color :", _txtColors[i]); _txtBoxSizes[i] = EditorGUILayout.Vector2Field("Taille :", _txtBoxSizes[i]); _txtRectPositions[i] = (ERectPosition)EditorGUILayout.EnumPopup("Text Pos :", _txtRectPositions[i]); _txtOffSets[i] = EditorGUILayout.Vector2Field("Offset :", _txtOffSets[i]); GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); } } //PREFABS GUILayoutExtension.DrawHorizontalLine("Prefabs(s)"); _addPrefab = EditorGUILayout.Toggle("Prefab", _addPrefab); if (_addPrefab) { _prefabNb = Mathf.Clamp(EditorGUILayout.IntField("Number : ", _prefabNb), 0, 10); GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); EditorGUILayout.Space(); for (int i = 0; i < _prefabNb; i++) { EditorGUILayout.LabelField("Prefab " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { }); EditorGUILayout.Space(); _prefabGameObjects[i] = EditorGUILayout.ObjectField("Prefab :", _prefabGameObjects[i], typeof(GameObject), false) as GameObject; GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); } } } EditorGUILayout.Space(); GUILayoutExtension.DrawHorizontalLine(); EditorGUILayout.Space(); if (GUILayout.Button("Create step", new GUILayoutOption[] { GUILayout.Height(50), } )) { CreateStep(_selectedSlideTypeEnumVal); } GUILayout.EndScrollView(); }
public override void Initialize(BaseController _slideController) { m_slideController = (SlideController)_slideController; base.Initialize(_slideController); SetupLineRenderer(); }
// Use this for initialization void Start() { staminaController = slider.GetComponent <SlideController>(); }