/// <summary> /// Get the first encountered element approached from the specified side of the specified direction /// </summary> /// <typeparam name="TElement"></typeparam> /// <param name="direction"></param> /// <param name="side"></param> /// <param name="undeletedOnly"></param> /// <param name="ignore"></param> /// <param name="bestAngle">Output. The angle of the returned element relative to the specified /// direction.</param> /// <returns></returns> public TElement GetConnectedElementOnSide <TElement>(Vector direction, HandSide side, bool undeletedOnly, Element ignore, out Angle bestAngle) where TElement : Element { bestAngle = 0; TElement best = null; foreach (Vertex v in Vertices) { if (v.Element != null && v.Element is TElement && v.Element != ignore && (!undeletedOnly || !v.Element.IsDeleted)) { TElement element = (TElement)v.Element; var geo = element.GetGeometry(); Vertex v2 = null; if (geo is Curve crv) { v2 = crv.GetOtherEnd(v); Angle angle = (v.Position.AngleTo(v2.Position) - direction.Angle).Normalize(); if (best == null || (side == HandSide.Left && angle > bestAngle) || (side == HandSide.Right && angle < bestAngle)) { bestAngle = angle; best = element; } } // TODO: Other element geometry types? } } return(best); }
protected virtual void TrySwitchHandToSpawner(HandSide handSide) { if (handSide == HandSide.LEFT) { if (BallManager.LocalInstance.playerBallQueue.childCount == 1 && rightHandController.currHandObject == HandObject.SPAWNER ) { // If, when trying to switch this hand to spawner, there is // only 1 ball left and it is being held by another hand, // take it out of that hand rightHandController.ResetSpawnerStateAndSwitchToTool(); } // Only switch to spawner if there is at least 1 ball in queue if (BallManager.LocalInstance.playerBallQueue.childCount > 0) { leftHandController.SwitchToSpawnerHand(); } } else if (handSide == HandSide.RIGHT) { if (BallManager.LocalInstance.playerBallQueue.childCount == 1 && leftHandController.currHandObject == HandObject.SPAWNER) { leftHandController.ResetSpawnerStateAndSwitchToTool(); } // Only switch to spawner if there is at least 1 ball in queue if (BallManager.LocalInstance.playerBallQueue.childCount > 0) { rightHandController.SwitchToSpawnerHand(); } } }
private PuppetToAnalogAnimatedBehavior(BlendTree resting, QualifiedAnimation squeezing, List <QualifiedAnimation> qualificationsOfTreeOfTree, HandSide handSide) { Resting = resting; Squeezing = squeezing; QualificationsOfTree = qualificationsOfTreeOfTree; HandSide = handSide; }
public bool CheckBoundsAndClickedUp(Renderer renderedComponent, HandSide side) { if (renderedComponent == null) { return(false); } Bounds bound = renderedComponent.bounds; if (side == HandSide.Left) { if (bound.Contains(VRInputController.instance.LHandSphere.transform.position)) { return(VRInputController.instance.ActionPressUp(side)); } else { return(false); } } else { if (bound.Contains(VRInputController.instance.RHandSphere.transform.position)) { return(VRInputController.instance.ActionPressUp(side)); } else { return(false); } } }
/// <summary> /// Get the first encountered element approached from the specified side of the specified direction /// </summary> /// <typeparam name="TElement"></typeparam> /// <param name="direction"></param> /// <param name="side"></param> /// <param name="undeletedOnly"></param> /// <param name="ignore"></param> /// <returns></returns> public TElement GetConnectedElementOnSide <TElement>(Vector direction, HandSide side, bool undeletedOnly = true, Element ignore = null) where TElement : LinearElement { Angle bestAngle = 0; TElement best = null; foreach (Vertex v in Vertices) { if (v.Element != null && v.Element is TElement && v.Element != ignore && (!undeletedOnly || !v.Element.IsDeleted)) { TElement element = (TElement)v.Element; Vertex v2 = element.Geometry.GetOtherEnd(v); Angle angle = (v.Position.AngleTo(v2.Position) - direction.Angle).Normalize(); if (best == null || (side == HandSide.Left && angle > bestAngle) || (side == HandSide.Right && angle < bestAngle)) { bestAngle = angle; best = element; } } } return(best); }
FootNote SpawnRandomFootNote(float beattime) { var n = Instantiate(footNote, Vector3.zero, Quaternion.identity).GetComponent <FootNote>(); Vector2 rnd = new Vector2(Random.Range(-.7f, .7f), 0); HandSide handSide = HandSide.any; float? hookSide = null; if (Random.Range(0, 20) < 1) { handSide = HandSide.left; } else if (Random.Range(0, 19) < 1) { handSide = HandSide.right; } else { switch (Random.Range(0, 20)) { case 0: hookSide = 0; break; case 1: hookSide = 90; break; case 2: hookSide = 270; break; case 3: hookSide = 180; break; default: hookSide = null; break; } } n.Init(beattime, rnd, musicPlayer, 1, handSide, hookSide); randomNote.Add(n); return(n); }
/// <summary> /// Displays the hand side. /// </summary> /// <param name="handside">Requires a ManoMotion Handside.</param> void DisplayHandSide(HandSide handside) { handSideGizmo.SetActive(ShowHandSide); if (ShowHandSide) { switch (handside) { case HandSide.Palmside: handSideText.text = "Handside: Palm Side"; break; case HandSide.Backside: handSideText.text = "Handside: Back Side"; break; case HandSide.None: handSideText.text = "Handside: None"; break; default: handSideText.text = "Handside: None"; break; } } }
public Vector3 GetAimPos(HandSide hand, bool isMag = false) { if (!isMag && readyInit) { switch (hand) { case HandSide.Right: return(RightHand.transform.position - (VRInputBridge.instance.aimScript_ref.gun_script.transform.rotation * (relativeTriggerOffset * transform.localScale.x))); case HandSide.Left: return(LeftHand.transform.position - (VRInputBridge.instance.aimScript_ref.gun_script.transform.rotation * (relativeTriggerOffset * transform.localScale.x))); default: return(RightHand.transform.position); } } else { switch (hand) { case HandSide.Right: return(RightHand.transform.position - GetAimDir(hand) * 0.02f); case HandSide.Left: return(LeftHand.transform.position - GetAimDir(hand) * 0.02f); default: return(RightHand.transform.position); } } }
public Vector3 GetAimDir(HandSide hand) { if (!isFrontGrabbing) { switch (hand) { case HandSide.Right: return(-RightHand.transform.up * 1.5f + RightHand.transform.forward); case HandSide.Left: return(-LeftHand.transform.up * 1.5f + LeftHand.transform.forward); default: return(RightHand.transform.forward); } } else { switch (hand) { case HandSide.Right: return(((LHandSphere.transform.position) - RHandSphere.transform.position).normalized); case HandSide.Left: return(((RHandSphere.transform.position) - LHandSphere.transform.position).normalized); default: return(RightHand.transform.forward); } } }
public bool CheckSlidePressCheck(HandSide hand) { Vector3 SlidePressCheckPos = aimScript_ref.gun_script.GetComponent <SlideVisualComponent>().point_slide_start.position; Vector3 HandPos = VRInputController.instance.LHandSphere.transform.position; SlideBounds = SlideObject.bounds; //SlideBounds.extents *= 0.75f; if (hand == HandSide.Right) { HandPos = VRInputController.instance.RHandSphere.transform.position; } float presscheckDistance = Vector3.Distance(HandPos, aimScript_ref.gun_script.GetComponent <SlideVisualComponent>().point_slide_end.position); if ((SlideBounds.Contains(HandPos) && Vector3.Distance(HandPos, SlidePressCheckPos) < presscheckDistance)) { return(VRInputController.instance.ActionPress(hand)); } else { return(false); } }
public Orientation(Vector3 position, Vector3 rotation, HandSide allowedHand, HandSide isDefault) { this.rotation = rotation; this.positionOffset = position; this.allowedHand = allowedHand; this.isDefault = isDefault; }
public Vector3 GetAimHandleDir(HandSide hand) { if (!isFrontGrabbing && Vector3.Distance(LeftHand.transform.localPosition, RightHand.transform.localPosition) > 0.175f) { switch (hand) { case HandSide.Right: if (Vector3.Angle(RightHand.transform.forward, Head.transform.forward) > 90) { if (GunInteractDown(hand)) { FlipFlashlightDirection = true; } } else if (Vector3.Angle(RightHand.transform.forward, Head.transform.forward) < 90) { if (GunInteractDown(hand)) { FlipFlashlightDirection = false; } } return(RightHand.transform.forward * (FlipFlashlightDirection ? -1 : 1)); case HandSide.Left: if (Vector3.Angle(LeftHand.transform.forward, Head.transform.forward) > 90) { if (GunInteractDown(hand)) { FlipFlashlightDirection = true; } } else if (Vector3.Angle(LeftHand.transform.forward, Head.transform.forward) < 90) { if (GunInteractDown(hand)) { FlipFlashlightDirection = false; } } return(LeftHand.transform.forward * (FlipFlashlightDirection ? -1 : 1)); default: return(RightHand.transform.forward); } } else { switch (hand) { case HandSide.Right: return(GetAimDir(HandSide.Left)); case HandSide.Left: return(GetAimDir(HandSide.Right)); default: return(RightHand.transform.position); } } }
public static Hand.Side ConvertToSide(HandSide side) { if (side == HandSide.LEFT) { return(Hand.Side.LEFT); } return(Hand.Side.RIGHT); }
//-------------------------------------------------------------------------------------------------------- // Connection Functions /// <summary> Returns the first valid instance of a SGCore.HapticGlove object, based on HandSide parameters </summary> /// <param name="handSide"></param> /// <param name="gloveInstance"></param> /// <returns></returns> public static bool GetGloveInstance(HandSide handSide, out SGCore.HapticGlove gloveInstance) { if (handSide == HandSide.Any) { return(SGCore.HapticGlove.GetGlove(out gloveInstance)); } return(SGCore.HapticGlove.GetGlove(handSide == HandSide.RightHand, out gloveInstance)); }
public Vector2 GetWalkVector(HandSide hand) { SteamVR_Input_Sources source = (hand == HandSide.Left ? SteamVR_Input_Sources.RightHand : SteamVR_Input_Sources.LeftHand); Vector3 rawAxis = new Vector3(Locomotion.GetAxis(hand == HandSide.Left ? SteamVR_Input_Sources.RightHand : SteamVR_Input_Sources.LeftHand).x, 0, Locomotion.GetAxis(hand == HandSide.Left ? SteamVR_Input_Sources.RightHand : SteamVR_Input_Sources.LeftHand).y); rawAxis = Head.transform.localRotation * rawAxis; return(new Vector2(rawAxis.x, rawAxis.z)); }
void spawnHand(GameObject hand, NetworkInstanceId playerId, HandSide handSide) { var vrHand = hand.GetComponent <VRHand>(); vrHand.HandSide = handSide; vrHand.OwnerId = playerId; NetworkServer.SpawnWithClientAuthority(hand, connectionToClient); }
/// <summary> /// Initializes a new instance of the <see cref="T:Volley.Points.Point`1"/> class. /// </summary> /// <param name="pointKind">Point kind.</param> /// <param name="winnerTeam">Winner team.</param> /// <param name="shotKind">Shot kind.</param> /// <param name="side"></param> /// <param name="receives">Recieves performed.</param> protected Point(PointKinds pointKind, TTeam winnerTeam, ShotKind shotKind, HandSide side, IEnumerable <Receive> receives) { PointKind = pointKind; WinnerTeam = winnerTeam ?? throw new ArgumentNullException(nameof(winnerTeam)); ShotKind = shotKind; Side = side; Receives = receives?.ToArray() ?? throw new ArgumentNullException(nameof(receives)); }
void CmdSpawnTool(HandSide handSide) { var hoge = (GameObject)Instantiate(Prefab, transform); hoge.transform.localPosition = Vector3.zero; hoge.transform.localRotation = Quaternion.identity; hoge.GetComponent <Fude>().OwnerId = netId; NetworkServer.SpawnWithClientAuthority(hoge, NetworkServer.FindLocalObject(OwnerId)); }
// Start is called before the first frame update void Start() { if (GameManager.Instance.playerPlatform == PlayerPlatform.STEAMVR) { handPose = GetComponentInParent <SteamVR_Behaviour_Pose>(); } spawner = GetComponent <Spawner>(); handSide = GetComponentInParent <HandControllerHuman>().handSide; }
/// <summary> /// Initializes a new instance of the <see cref="T:Volley.Points.PointError`1"/> class. /// </summary> /// <param name="winnerTeam">Winner team.</param> /// <param name="shotKind">Shot kind that <paramref name="winnerTeam"/> won the point.</param> /// <param name="numberRallies">Number of rallies.</param> /// <param name="erroredPlayer">The player errored.</param> /// <param name="forced">The value which indicates whether the <paramref name="erroredPlayer"/> is forced to error.</param> public PointError(TTeam winnerTeam, ShotKind shotKind, HandSide side, IEnumerable <Receive> receives, Player erroredPlayer, bool forced) : base(forced ? PointKinds.ForcedError : PointKinds.UnforcedError, winnerTeam, shotKind, side, receives) { ErroredPlayer = erroredPlayer ?? throw new ArgumentNullException(nameof(erroredPlayer)); if (winnerTeam.AllPlayers.Contains(erroredPlayer)) { throw new ArgumentException($"{nameof(erroredPlayer)} must not be one of the {nameof(winnerTeam)}!", nameof(erroredPlayer)); } Forced = forced; }
/// <summary> /// Change the sign of this angle to be relative to the specified side. /// Left-side angles will be flipped. /// </summary> /// <param name="side"></param> /// <returns></returns> public Angle RelativeToSide(HandSide side) { if (side == HandSide.Left) { return(-this); } else { return(this); } }
public float GetAxis(string input_str, HandSide hand) { switch (input_str) { case "Mouse ScrollWheel": return(VRInputController.instance.GetSpinSpeed(hand) * 10f); default: return(Input.GetAxis(input_str)); } }
/// <summary> /// Return the opposite side /// </summary> /// <param name="side"></param> /// <returns></returns> public static HandSide Flip(this HandSide side) { if (side == HandSide.Left) { return(HandSide.Right); } else { return(HandSide.Left); } }
private AnalogAnimatedBehavior(QualifiedAnimation resting, QualifiedAnimation squeezing, HandSide handSide) { if (resting == squeezing) { throw new ArgumentException("AnalogAnimatedBehavior must not have both identical qualified animations"); } Resting = resting; Squeezing = squeezing; HandSide = handSide; }
private void RecognizeSide() { if (gameObject.name.StartsWith("Left")) { side = HandSide.Left; } else { side = HandSide.Right; } }
// Interpolates the position of the hand between the comfort and max points to amplify input. public Vector3 interpolatePosition(HandSide side, Vector3 shoulderPos, Vector3 comfortCenter, Vector3 controllerPosition, float comfortRadius, Vector3 maxHitPoint) { var currentReach = Vector3.Distance(comfortCenter, controllerPosition); var maxReach = Vector3.Distance(comfortCenter, maxHitPoint); var percentReach = currentReach / maxReach; float amplifiedOffset = ampCurve.Evaluate(percentReach); float magnitude = amplifiedOffset * maxReach; float shoulderDistance = Vector3.Distance(shoulderPos, controllerPosition); return(comfortCenter + (maxHitPoint - comfortCenter).normalized * magnitude); }
static void ClearQueue(HandSide handSide) { if (handSide == HandSide.Left) { leftHandVelocityHistory = new CircularQueue <PositionVelocityTime>(); } else { rightHandVelocityHistory = new CircularQueue <PositionVelocityTime>(); } }
public Gesture GestureFor(HandSide side) { foreach (var gesture in gestures) { if (gesture.Side() == side) { return(gesture); } } ; return(null); }
public void Init(float beat, Vector2 pos, MusicPlayer parent, float speed, HandSide hs = HandSide.any, float?hss = null) { this.beat = beat; this.pos = pos; this.mp = parent; this.speed = speed; handSide = hs; Color c; switch (handSide) { case HandSide.any: c = Color.white; break; case HandSide.both: c = new Color(.5f, 0, .5f); //purple break; case HandSide.left: c = Color.red; break; case HandSide.right: c = Color.blue; break; default: throw new Exception(); } #if UNITY_2018 gameObject.GetComponent <Renderer>().material.color = c; #elif UNITY_2019 // You can re-use this block between calls rather than constructing a new one each time. var block = new MaterialPropertyBlock(); // You can look up the property by ID instead of the string to be more efficient. block.SetColor("_BaseColor", c); // You can cache a reference to the renderer to avoid searching for it. GetComponentInChildren <Renderer>().SetPropertyBlock(block); #endif hookSide = hss; if (hookSide == null) { sideIndicator.gameObject.SetActive(false); } else { sideIndicator.Rotate(0, 0, hss ?? 0); } //var tmp__ = from Renderer a in GetComponents<Renderer>() select a.enabled = false; var tmp___ = from Renderer a in GetComponentsInChildren <Renderer>() select a.enabled = false; }
public float GetSpinSpeed(HandSide hand) { if (!checkedCylinderRenderer && VRInputBridge.instance.aimScript_ref != null && VRInputBridge.instance.aimScript_ref.gun_script.HasGunComponent(GunAspect.REVOLVER_CYLINDER)) { CylinderVisualComponent cylvis = VRInputBridge.instance.aimScript_ref.gun_script.GetComponent <CylinderVisualComponent>(); if (cylvis != null) { if (cylvis.cylinder_assembly.Find("cylinder") != null) { cylinderRenderer = cylvis.cylinder_assembly.Find("cylinder").GetComponent <Renderer>(); } else { cylinderRenderer = cylvis.cylinder_assembly.GetComponent <Renderer>(); } } checkedCylinderRenderer = true; } if (cylinderRenderer != null) { switch (hand) { case HandSide.Right: if (cylinderRenderer.bounds.Contains(RHandSphere.transform.position)) { return(ControllerPose.GetVelocity(SteamVR_Input_Sources.RightHand).y); } else { return(0f); } case HandSide.Left: if (cylinderRenderer.bounds.Contains(LHandSphere.transform.position)) { return(-ControllerPose.GetVelocity(SteamVR_Input_Sources.LeftHand).y); } else { return(0f); } default: return(ControllerPose.GetVelocity(SteamVR_Input_Sources.RightHand).y); } } else { return(0f); } }
// Use this for initialization /** * Initialize all values */ void Start() { GameModel.initSandbox (); handSide = HandSide.RIGHT_HAND; //GameObject heroGameObject = Instantiate (warrior); GameObject heroGameObject = Instantiate (wizard); Hero hero = heroGameObject.GetComponent<Hero> (); GameModel.HerosInGame.Add (hero); string heroClass = hero.GetType ().ToString (); //LEAP leapInstance = Instantiate (leapPrefab); //Debug.Log ("leapInstance : " + leapInstance); //the leap motion scene is child of camera so it follow the translation leapInstance.transform.parent = Camera.main.transform; leapInstance.transform.position = new Vector3 (0f, 2.5f, 1.6f); //sets the "hand parent" field so the arms also are child of camera and don't flicker leapControl = leapInstance.GetComponent<HandController> (); leapControl.setModel(handSide, hero); leapControl.handParent = Camera.main.transform; //If leap is not connected, Pause game and show warning message if ( !leapControl.IsConnected()) { //pause() Time.timeScale = 0.0f; GameObject detectedCanvas = GameObject.Find("DetectedLeapCanvas"); detectedCanvas.GetComponent<Canvas>().enabled = true; } ter = Instantiate (terrain, new Vector3 (-100, -2, 0), Quaternion.identity) as Terrain; //Génération du HUD hudMaster = Instantiate (hud).GetComponent<HudMaster>(); Camera.main.transform.parent = heroGameObject.transform; Camera.main.transform.position = new Vector3 (0, 2.18f, 0); }
/** * @author Baptiste Valthier * defines whether the user is left handed or not and choose the appropriate graphics and features according to the class. **/ public void setModel(HandSide hs, Hero _hero) { hero = _hero; //saves the value locally heroClass = hero.GetType().ToString(); handSide = hs; string prefab = heroClass + "_"; //puts the right-handed or left-handed attribute to the prefab name prefab += (hs == HandSide.RIGHT_HAND ? "RH" : "LH"); //sets Left hand model GameObject leftGO = Resources.Load("prefabs/leapmotion/" + prefab + "_left") as GameObject; //GameObject leftGO = Resources.Load("prefabs/leapmotion/PepperLightFullLeftHand") as GameObject; if (leftGO == null) { Debug.LogError("Baptiste says : Can't find GameObject " + "prefabs/leapmotion/" + prefab + "_left" + ". Does it exists?"); } leftGraphicsModel = leftGO.GetComponent<RiggedHandBV>(); GameObject rightGO = Resources.Load("prefabs/leapmotion/" + prefab + "_right") as GameObject; if (rightGO == null) { Debug.LogError("Baptiste says : Can't find GameObject " + "prefabs/leapmotion/" + prefab + "_right" + ". Does it exists?"); } rightGraphicsModel = rightGO.GetComponent<RiggedHandBV>(); //load extra prefabs if needed if (heroClass == "Wizard") { fireballGo = Resources.Load("prefabs/leapmotion/Fireball") as GameObject; vortexGo = Resources.Load("prefabs/leapmotion/Vortex") as GameObject; } }
/** * Initialisation of the game * Generation of the scene from the level file */ void Start() { //GameModel.Init(); GameModel.resetDataBeforeLevel (); level = GameModel.ActualLevel; //Debug.Log (level.Name); //Debug.Log ("START Start GameController"); //recupération des options handSide = HandSide.RIGHT_HAND; //lire fichier niveau //LevelParser parser = new LevelParser (FILE_PATH); //génération du héros //instanciate a hero using the class contained in the model Hero modelHero = GameModel.Hero; string heroClass = modelHero.GetType ().ToString (); if (heroClass == "Warrior") heroGameObject = Instantiate (warrior); else if (heroClass == "Monk") heroGameObject = Instantiate (monk); else if (heroClass == "Wizard") heroGameObject = Instantiate (wizard); else heroGameObject = Instantiate (warrior); //Debug.Log (heroGameObject); GameModel.HerosInGame.Add (heroGameObject.GetComponent<Hero> ()); hero = GameModel.HerosInGame [0]; float vitesseHeros = hero.MovementSpeed; hero.XpQuantity = modelHero.XpQuantity; //LEAP leapInstance = Instantiate (leapPrefab); //Debug.Log ("leapInstance : " + leapInstance); //the leap motion scene is child of camera so it follow the translation leapInstance.transform.parent = Camera.allCameras[0].transform; leapInstance.transform.position = new Vector3 (0f, 2.5f, 1.6f); //sets the "hand parent" field so the arms also are child of camera and don't flicker leapControl = leapInstance.GetComponent<HandController> (); leapControl.setModel(handSide, hero); leapControl.setGameController(this); leapControl.handParent = Camera.allCameras[0].transform; leapCanvas = Instantiate(leapCanvasPrefab); //Génération de terrain float longueurTerrain = vitesseHeros * tempsMusique; /*ter = Instantiate( terrain, new Vector3(0,0,0), Quaternion.identity) as GameObject; ter.transform.Rotate (0, -90, 0); ter.transform.localScale = new Vector3 (longueurTerrain, 1, 1); */ ter = Instantiate (terrain, new Vector3 (-100, -2, 0), Quaternion.identity) as Terrain; //ter.terrainData.size = new Vector3 (1.0f, 1.0f, 1.0f); //ter.terrainData.size = new Vector3 (200, 200, 1); //génération des ennemis npcList = new List<GameObject> (); //Debug.Log (npcList); //List<Thing> ennemies = parser.getEnnemies (); List<Item> items = level.ItemList; //Debug.Log ("FINAL ITEM LIST COUNT : " + items.Count); foreach (Item item in items) { GameObject go = null; if (item.Type == "basicLancer") go = basicLancer; else if (item.Type == "fireLancer") go = fireLancer; else if (item.Type == "iceLancer") go = iceLancer; else if (item.Type == "basicDragonet") go = basicDragonet; else if (item.Type == "fireDragonet") go = fireDragonet; else if (item.Type == "iceDragonet") go = iceDragonet; else if (item.Type == "wall") go = wall; else if (item.Type == "cannon") go = canon; else if (item.Type == "assassin") go = assassin; else if (item.Type == "life") go = lifePotion; else if (item.Type == "power") go = powerPotion; else if (item.Type == "invincibility") go = invincibilityPotion; if (go != null){ GameObject instance = Instantiate(go, new Vector3(item.PositionInX, go.transform.localScale.y/2, vitesseHeros*item.PositionInSeconds), Quaternion.identity) as GameObject; NPC npc = instance.GetComponent<NPC>(); if (npc != null) GameModel.NPCsInGame.Add(npc); //GameModel.NPCsInGame[GameModel.NPCsInGame.Count-1].transform.Rotate(0, 180, 0); } } //Génération du HUD hudMaster = Instantiate (hud).GetComponent<HudMaster>(); //Debug.Log ("hudMaster : " + hudMaster); state = GameState.PLAY; Camera.main.transform.parent = heroGameObject.transform; Camera.main.transform.position = new Vector3 (0, 2.18f, 0); //Camera.main.transform.Translate(new Vector3(0, 2.18f, 0)); pausedMenu = GameObject.Find("Canvas"); pausedMenu.SetActive(false); paused = false; Time.timeScale = 1.0f; musicCanvas = Instantiate (musicCanvasPrefab); audioManager = musicCanvas.GetComponent<AudioManager> (); audioManager.SetMusicName (level.MusicPath); audioManager.Init (); //If leap is not connected, Pause game and show warning message if ( !leapControl.IsConnected()) { //pause() audioManager.Pause(); Time.timeScale = 0.0f; GameObject detectedCanvas = GameObject.Find("DetectedLeapCanvas"); detectedCanvas.GetComponent<Canvas>().enabled = true; } //Debug.Log ("END Start GameController"); //ADD TUTORIAL MANAGER if (level.Tutorial) { GameObject tutoGO = Resources.Load("prefabs/controllers/TutorialManager") as GameObject; Instantiate (tutoGO); } }