HandCursor GetCursor() { HandCursor cursor = null; if (allCursors.Count - activeCursors.Count == 0) { cursor = Instantiate(cursorPrefab); cursor.transform.parent = transform; cursor.name = cursorPrefab.name; allCursors.Add(cursor); activeCursors.Add(cursor); } else { foreach (HandCursor c in allCursors) { if (!activeCursors.Contains(c)) { cursor = c; break; } } activeCursors.Add(cursor); cursor.gameObject.SetActive(true); } return(cursor); }
public InstructionsScreen() { textBox = new Rectangle(); OkButton = new Button(); Hand = new HandCursor(); WrapTexter = false; }
void FixedUpdate() { if (inputEnabled) { activeCursors.Clear(); Frame frame = controller.Frame(); HandList hands = frame.Hands; for (int h = 0; h < hands.Count; h++) { Hand hand = hands[h]; HandCursor cursor = GetCursor(); cursor.OnFrame(hand); } //hide all inactive cursors foreach (HandCursor cursor in allCursors) { if (!activeCursors.Contains(cursor)) { cursor.gameObject.SetActive(false); cursor.Release(); } } MoleculeManager.instance.OnFrame(activeCursors); } }
public void OnRelease(HandCursor cursor) { grabbingCursor = null; hull.isTrigger = false; if (invalid) { Destroy(gameObject); return; } else { MoleculeManager molecule = MoleculeManager.instance; HashSet <Atom> atoms = molecule.atoms; Vector3 pos = transform.position; pos = molecule.transform.InverseTransformPoint(pos); int newBonds = 0; foreach (Atom atom in potentialBonds) { molecule.bondPrefab.CreateNew(this, atom); newBonds++; } outlineThickness = 0; molecule.AddAtom(this); } }
private void Cursor_CursorDeactivated(object sender, CursorEventArgs e) { if (spawnedItem != null) { Destroy(spawnedItem.GetComponent <OnePointMove>()); } cursor = null; }
public PhotographsScreen(List <byte[]> colorDataList, int score) { this.colorDataList = colorDataList; saveButton = new Button(); nextButton = new Button(); hand = new HandCursor(); playerScore = score; }
public LosingScreen(int Score) { scores = new List <string>(); buttons = new List <Button>(); hand = new HandCursor(); score = Score; textBox = new StringBuilder("", 6); }
public HighScoresScreen() { okButton = new Button(); hand = new HandCursor(); listScore = new List <int>(); list = new List <string>(); okButton.Clicked += new Button.ClickedEventHandler(menu_Clicked); }
public override void Initialize() { showAvatar = true; button = new Button(); hand = new HandCursor(); hand.Initialize(ScreenManager.Kinect); button.Initialize("Buttons/OK", this.ScreenManager.Kinect, new Vector2(620, 500)); button.Clicked += new Button.ClickedEventHandler(button_Clicked); avatars = new Texture2D[4]; base.Initialize(); }
private void Awake() { if (me == null) { me = this; } else if (me != this) { Destroy(gameObject); } }
private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Cursor") { cursor = other.gameObject.GetComponent <HandCursor>(); if (cursor) { cursor.CursorActivated -= Cursor_CursorActivated; } } }
public override void Initialize() { showAvatar = true; treadmill = new Button(); dumbbell = new Button(); Hand = new HandCursor(); kinect = ScreenManager.Kinect; Hand.Initialize(ScreenManager.Kinect); dumbbell.Clicked += new Button.ClickedEventHandler(dumbbell_Clicked); treadmill.Clicked += new Button.ClickedEventHandler(treadmill_Clicked); base.Initialize(); }
public override void Initialize() { showAvatar = true; enablePause = false; button = new Button(); hand = new HandCursor(); hand.Initialize(ScreenManager.Kinect); button.Initialize("Buttons/ok", this.ScreenManager.Kinect, new Vector2(820, 350)); button.Clicked += new Button.ClickedEventHandler(button_Clicked); Text = "- Welcome to Wundersound, You will see your depth image colored in green if you're \n standing in the kinect's field of view, smile and wave. \n -to switch on an LED say \"One\" or do the swipe up/down gestures. \n - You can also try the joined hands, waveleft and zoom in/out gestures just for the hell of it. \n - Press the Ok button to exit."; textPosition = new Vector2(75, 145); textBox = new Rectangle((int)textPosition.X, (int)textPosition.Y, 1020, 455); base.Initialize(); }
void CursorActivate(CursorEventArgs e) { if (!isReady) { return; } activeCursor = e.Cursor; var loader = Instantiate(ContentLoaderPrefab); loader.transform.position = e.Cursor.Cursor.transform.position; loader.transform.LookAt(Camera.main.transform); loader.GetComponent <ContentLoader>().RequestContent(SocketId, activeCursor); }
public void RequestContent(string SocketId, HandCursor Cursor) { this.cursor = Cursor; requestCount = (requestCount + 1) % 1000; requestKey = requestCount.ToString(); var data = new XElement("root", new XElement("key", requestKey)); SocketController.Instance.io.On("content", onContentArrived); SocketController.Instance.Send("query", data, SocketId); if (cursor != null) { cursor.CursorDeactivated += Cursor_CursorDeactivated; } }
public override void Initialize() { showAvatar = true; newGame = new Button(); instructions = new Button(); highscores = new Button(); exit = new Button(); Hand = new HandCursor(); kinect = ScreenManager.Kinect; Hand.Initialize(ScreenManager.Kinect); newGame.Clicked += new Button.ClickedEventHandler(newGame_Clicked); instructions.Clicked += new Button.ClickedEventHandler(instructions_Clicked); highscores.Clicked += new Button.ClickedEventHandler(highscores_Clicked); exit.Clicked += new Button.ClickedEventHandler(exit_Clicked); base.Initialize(); }
private void Awake() { if (me == null) { me = this; } else if (me != this) { Destroy(gameObject); } pasoNombre = SceneManager.GetActiveScene().name; if (pasoNombre == "paso 3") { // Se obtienen la palabra que se está jugando actualmente y el componente estado juego txtPalabra = EstadoJuego.estadoJuego.palabra; estadoJuego = EstadoJuego.estadoJuego; // Se inicia el arreglo de sílabas al tamaño necesario con sus sílabas necesarias silabas = estadoJuego.obtenerSilabasPalabra(txtPalabra); tamanioSilabas = silabas.Length; Debug.Log("Palabra que se está jugando actualmente: " + txtPalabra); Debug.Log("Valor de estado juego: " + estadoJuego); for (int i = 0; i < tamanioSilabas; i++) { Debug.Log("Arreglo de sílabas: " + silabas[i].ToString()); } Debug.Log("Tamaño de sílabas: " + tamanioSilabas); // Se asigna la imagen al cursor principal cursorImage = Resources.Load("Textures/mano1", typeof(Texture2D)) as Texture2D; // Se reparten todas las piezas del tablero repartirPiezas(); // Se reproduce el sonido acorde a la palabra en juego Debug.Log("Intentando hacer un sonido de: " + txtPalabra); AudioClip audioClip; audioClip = Resources.Load("Sonidos/Figuras/" + txtPalabra, typeof(AudioClip)) as AudioClip; AudioSource sonido = GameObject.Find("sonido").GetComponent <AudioSource>(); reproducirSonido(sonido, audioClip); GameObject.Find("btnAudio").GetComponent <AudioSource>().clip = audioClip; // Se esconde el botón de siguiente puesto que no tiene funcionalidad a la hora de iniciar el juego GameObject.Find("btnSiguiente").gameObject.SetActive(false); } }
public void OnReady(string SocketId) { this.SocketId = SocketId; GetComponent <MeshRenderer>().material = ReadyMaterial; var data = new XElement("root", new XElement("pose", new XElement("position", new XElement("x", transform.position.x.ToString("0.000")), new XElement("y", transform.position.y.ToString("0.000")), new XElement("z", transform.position.z.ToString("0.000"))), new XElement("rotation", new XElement("x", transform.rotation.eulerAngles.x.ToString("0.000")), new XElement("y", transform.rotation.eulerAngles.y.ToString("0.000")), new XElement("z", transform.rotation.eulerAngles.z.ToString("0.000"))), new XElement("scale", new XElement("x", transform.localScale.x.ToString("0.000")), new XElement("y", transform.localScale.y.ToString("0.000")), new XElement("z", transform.localScale.z.ToString("0.000"))))); SocketController.Instance.Send("enrolled", data, SocketId); SocketController.Instance.io.On("drop", onScreenDrop); if (IsHandHeld) { var cursors = FindObjectsOfType <HandCursor>(); foreach (var cursor in cursors) { if (cursor.HandType == UnityEngine.XR.MagicLeap.MLHandType.Left) { disabledCursor = cursor; disabledCursor.gameObject.SetActive(false); break; } } } isReady = true; }
public override void Initialize() { showAvatar = true; virusBar = new Bar(100, 950, 15, 270, 30); rightSwordBounds = new Rectangle(0, 400, 80, 80); leftSwordBounds = new Rectangle(1350, 400, 80, 80); shields = new Texture2D[4]; shieldBounds = new Rectangle[4]; shieldBounds[0] = new Rectangle(590, -80, 80, 80); shieldBounds[2] = new Rectangle(590, 720, 80, 80); shieldBounds[1] = new Rectangle(-90, 500, 80, 80); shieldBounds[3] = new Rectangle(1304, 500, 80, 80); cam = new Camera2D(ScreenManager); cam.Initialize(); cam.Focus = new Vector2(640, 360); cam.Position = new Vector2(500.0f, 200.0f); button = new Button(); hand = new HandCursor(); hand.Initialize(ScreenManager.Kinect); button.Initialize("Buttons/OK", this.ScreenManager.Kinect, new Vector2(820, 100)); button.Clicked += new Button.ClickedEventHandler(button_Clicked); base.Initialize(); }
public void OnGrab(HandCursor cursor) { grabbingCursor = cursor; hull.isTrigger = true; }
// Update is called once per frame private void Update() { switch (currentState) { case (TurnState.PROCESSING): UpgradeProgressBar(); break; case (TurnState.CHOOSEACTION): if (BSM.PlayerInBattle.Count == 0) { BSM.battleStates = BattleStateMachine.PerformAction.LOSE; } else { ChooseAction(); currentState = TurnState.WAITING; } break; case (TurnState.WAITING): break; case (TurnState.ACTION): StartCoroutine(TimeForAction()); break; case (TurnState.DEAD): if (!isAlive) { return; } else { //Change tag of enemy this.gameObject.tag = "DeadEnemy"; //Not selectable by player BSM.EnemyInBattle.Remove(this.gameObject); //disable hand cursor HandCursor.SetActive(false); //remove all input player attack if (BSM.EnemyInBattle.Count > 0) { for (int i = 0; i < BSM.PerformList.Count; i++) { if (i != 0) { if (BSM.PerformList[i].AttackerGameObject == this.gameObject) { BSM.PerformList.Remove(BSM.PerformList[i]); } else if (BSM.PerformList[i].AttackerTarget == this.gameObject) { BSM.PerformList[i].AttackerTarget = BSM.EnemyInBattle[Random.Range(0, BSM.EnemyInBattle.Count)]; } } } } //change color / play animation this.gameObject.GetComponent <SpriteRenderer>().material.color = new Color32(105, 105, 105, 255); ThisEntity.DeadInBattle(true); //reset enemy buttons BSM.EnemyButtons(); //check alive BSM.battleStates = BattleStateMachine.PerformAction.CHECKALIVE; isAlive = false; } break; } }
void CursorDeactivate(CursorEventArgs e) { activeCursor = null; }