//ADD METHOD public void Add(string data) { //CREATE A NEW NODE TutorialNode tutorialNode = new TutorialNode(data); //IF THE Head (FIRST ITEM) DOES NOT EXIST if (Head == null) { //UPDATE THE Head Head = tutorialNode; Head.Next = null; Head.Previous = null; return; } //SET THE Current NODE TO THE Head NODE Current = Head; //WHILE THE NEXT NODE EXISTS while (Current.Next != null) { //SET THE Current NODE TO THE NEXT NODE Current = Current.Next; } //SET THE NEXT BLANK NODE TO THE ADDED NODE Current.Next = tutorialNode; //UPDATE THE PREVIOUS NODE OF THE ADDED NODE Current.Next.Previous = Current; }
public TutorialNode OtherNode(TutorialNode node) { if (!isDirectedEdge) { return((node1 == node) ? node2 : node1); } return((node1 == node) ? node2 : null); }
public void StepComplete(NodeAddedEvent e, TutorialStepNode stepNode, [JoinByTutorial] TutorialNode tutorialNode, [JoinAll] SingleNode <Dialogs60Component> dialogs) { if (tutorialActive && (tutorialNode.tutorialData.TutorialId.Equals((long)(-1229949270L)) && stepNode.tutorialStepData.StepId.Equals((long)0x5aeb2e04L))) { Debug.Log("Bingo"); dialogs.component.Get <NewModulesScreenUIComponent>().Show(TankPartModuleType.WEAPON); } }
public bool AllMyNeighborsVisited() { foreach (TutorialEdge edge in edges) { TutorialNode otherNode = edge.OtherNode(this); if (!otherNode.Visited) { return(false); } } return(true); }
// Use this for initialization void Start() { prevNodeShot = null; laserBeam = GetComponent <LineRenderer>(); laserBeam.material = laserMaterials[0]; // Bit shift the index of the layer (8) to get a bit mask layerMask = 1 << 8; // This would cast rays only against colliders in layer 8. // But instead we want to collide against everything except layer 8. The ~ operator does this, it inverts a bitmask. layerMask = ~layerMask; }
public void TutorialComplete(TutorialCompleteEvent e, TutorialNode tutorial, [JoinByTutorial] ICollection <TutorialStepNode> steps, [JoinAll] SingleNode <ClientSessionComponent> session) { if (!tutorial.Entity.HasComponent <TutorialCompleteComponent>()) { tutorial.Entity.AddComponent <TutorialCompleteComponent>(); } foreach (TutorialStepNode node in steps) { if (!node.Entity.HasComponent <TutorialStepCompleteComponent>()) { base.ScheduleEvent(new TutorialActionEvent(tutorial.tutorialData.TutorialId, node.tutorialStepData.StepId, TutorialAction.START), session); base.ScheduleEvent(new TutorialActionEvent(tutorial.tutorialData.TutorialId, node.tutorialStepData.StepId, TutorialAction.END), session); node.Entity.AddComponent <TutorialStepCompleteComponent>(); } } TutorialCanvas.Instance.Hide(); }
private void AddItemResultHandler(TutorialIdResultEvent e, AddItemStepHandler stepHandler, TutorialStepNode step, SingleNode <ClientSessionComponent> session) { if (!e.ActionExecuted) { stepHandler.Fail(e.Id); } else { if (step != null) { IList <TutorialNode> source = base.Select <TutorialNode>(step.Entity, typeof(TutorialGroupComponent)); if (source.Count > 0) { TutorialNode node = source.Single <TutorialNode>(); base.ScheduleEvent(new ApplyTutorialIdEvent(node.tutorialData.TutorialId), session); } } stepHandler.Success(e.Id); } }
private void Start() { if (SavingLoadingManager.instance.GetHasSave()) { LoadTutorialStatus(); } else { foreach (var tutorial in tutorials) { tutorial.tutorialFinished = false; } currentTutorial = tutorials[1]; SaveTutorialStatus(); } rooms = FindObjectsOfType <RoomStats>(); ticker = FindObjectOfType <Tick>(); }
//call this to display a tutorial. Tutorial IDs can be found in the inspector public void SetCurrentTutorial(int tutorialID, bool forcedTutorial) { if (disableTutorial) { return; } //if you're already in this same tutorial, stop. if (tutorials[tutorialID] == currentTutorial && tutorialPanel.activeSelf) { return; } //if the game tries to force a tutorial the player has already seen, stop. if (tutorials[tutorialID].tutorialFinished == true && forcedTutorial == true) { return; } //if you're already in a tutorial, close it and continue if (tutorialPanel.activeSelf == true) { CloseCurrentTutorial(true); } //reset effects tutorialPrerequisitesComplete = false; currentTutorial = tutorials[tutorialID]; if (tutorialPanel.activeSelf == false) { tutorialPanel.SetActive(true); tutorialTextbox.text = currentTutorial.tutorialMessages[0].message; tutorialTitleTextbox.text = currentTutorial.tutorialName; index = 0; } }
public void LoadTutorialStatus() { tutorials = SavingLoadingManager.instance.Load <TutorialNode[]>("tutorials"); currentTutorial = SavingLoadingManager.instance.Load <TutorialNode>("currentTutorial"); }
public void TutorialAdded(NodeAddedEvent e, TutorialCompleteIdsNode userSteps, [Combine] TutorialNode tutorial) { bool flag = userSteps.registrationDate.RegistrationDate.UnityTime != 0f; bool flag2 = this.TutorialCompleted(tutorial.tutorialData.TutorialId, userSteps.tutorialCompleteIds.CompletedIds); bool flag3 = (!flag || !tutorial.tutorialData.ForNewPlayer) ? (!flag && tutorial.tutorialData.ForOldPlayer) : true; if (flag2 || !flag3) { if (!tutorial.Entity.HasComponent <TutorialCompleteComponent>()) { tutorial.Entity.AddComponent <TutorialCompleteComponent>(); } if (!flag3) { return; } } foreach (string str in tutorial.tutorialData.Steps.Keys) { Entity entity = base.CreateEntity(tutorial.tutorialData.Steps[str], tutorial.tutorialData.StepsPath + str); if (entity.GetComponent <TutorialStepDataComponent>().VisualStep) { entity.AddComponent <TutorialVisualStepComponent>(); } if (flag2) { entity.AddComponent <TutorialStepCompleteComponent>(); } tutorial.tutorialGroup.Attach(entity); } }
public void CompleteTutorial(NodeAddedEvent e, TankRentOfferNode rentOffer, [JoinBy(typeof(SpecialOfferGroupComponent))] SingleNode <PersonalSpecialOfferPropertiesComponent> personalOffer, [Context, Combine] TutorialNode tutorial) { if (!tutorial.Entity.HasComponent <TutorialCompleteComponent>()) { tutorial.Entity.AddComponent <TutorialCompleteComponent>(); } }
public void PerformUserAction(string userAction) { Debug.Log("User action: " + userAction); // Check if first node if (!tutorialTask.undirectedGraphStarted) { Visited = true; Instruction = traverseHighlightInstruction; tutorialTask.undirectedGraphStarted = true; return; } string validation = ""; switch (userAction) { case UtilGraph.NODE_VISITED: validation = IsCorrectlyShot(); break; case UtilGraph.NODE_TRAVERSED: validation = IsCorrectlyTraversed(); break; default: Debug.LogError("Invalid user move: " + userAction); break; } Debug.Log("Validation: " + validation); switch (validation) { case UtilGraph.NODE_VISITED: animator.SetBool(UtilGraph.NODE_VISIT_ANIMATION, false); Visited = true; FindEdgeAndChangeAppearance(UtilGraph.VISITED_COLOR, true); visitNextMove = false; Instruction = traverseHighlightInstruction; break; case UtilGraph.NODE_TRAVERSED: animator.SetBool(UtilGraph.NODE_TRAVERSE_ANIMATION, false); Traversed = true; if (prevEdge != null) { prevEdge.ChangeAppearance(UtilGraph.TRAVERSED_COLOR); } // Give a hint which nodes can be shot foreach (TutorialEdge edge in edges) { TutorialNode otherNode = edge.OtherNode(this); if (otherNode != null && !otherNode.Visited) { otherNode.Instruction = visitHighlightInstruction; } } traverseNextMove = false; tutorialTask.Progress(); break; case UtilGraph.NODE_ERROR: if (traversed) { return; } animator.Play(UtilGraph.NODE_ERROR_ANIMATION); break; } }
// Update is called once per frame void Update() { if (!allowShooting) { ResetLaserBeam(); return; } transform.position = rightHand.position; transform.rotation = rightHand.rotation; //if (SteamVR_Input.__actions_default_in_ToggleStart.GetState(SteamVR_Input_Sources.Any)) if (SteamVR_Input.__actions_default_in_PointerShoot.GetState(SteamVR_Input_Sources.RightHand)) { // Declare a raycast hit to store information about what our raycast hit RaycastHit hit; // Set the start position of our visual effect for our laser to the position of the pointerEnd laserBeam.SetPosition(0, transform.position); // Check if our raycast has hit anything if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, laserRange)) { // Set the end position for our laser line laserBeam.SetPosition(1, hit.point); laserBeam.enabled = true; // Get a reference to the node the raycast collided with TutorialNode node = hit.collider.GetComponent <TutorialNode>(); // If there was a node script attached if (node != null && prevNodeShot != node) { node.PerformUserAction(UtilGraph.NODE_VISITED); prevNodeShot = node; //// First check if it's the first node the player shot //if (edgeLeadingToNode == null) //{ // node.Visited = true; //} //else //{ // bool isDirectedEdge = edgeLeadingToNode.IsDirectedEdge; // if (isDirectedEdge) // { // bool correctDirection = edgeLeadingToNode.OtherNode(node) != null; // if (correctDirection && !node.Visited) // { // node.PrevEdge = edgeLeadingToNode; // node.Visited = true; // } // } // else // { // if (!node.Visited) // { // node.PrevEdge = edgeLeadingToNode; // node.Visited = true; // } // } //} } } else { // If we didn't hit anything, set the end of the line to a position directly in front of the camera at the distance of laserRange laserBeam.SetPosition(1, transform.position + (laserRange * transform.TransformDirection(Vector3.forward))); } } else { ResetLaserBeam(); } }
public void ResetPointer() { prevNodeShot = null; allowShooting = false; }
public bool PlayerCurrentlyAtOtherNode(TutorialNode node) { return((node == node1) ? node2.CurrentTraversing : node1.CurrentTraversing); }