public void Acquire() { Debug.Assert(status == ESkillStatus.Learnable); status = ESkillStatus.Acquired; // All contradictory skills are now unlearnable foreach (SkillNode n in antireqs) { n.PropagateUnlearnable(); } // All dependents are one skill closer to being learnable foreach (SkillNode n in dependents) { if (n.status == ESkillStatus.Unlearnable) { continue; } n.remainingPrereqs--; // When all prereqs are met the skill is learnable if (n.remainingPrereqs == 0) { GuiOutput.Log(String.Format("{0} is learnable now!", n.type)); n.status = ESkillStatus.Learnable; } } }
private bool MeetsPrereqs(PlayerManager m) { foreach (EAbility skill in m_Prereqs) { if (!m.HasSkill(skill)) { GuiOutput.Log(String.Format("{0} is required to interact!", skill)); return(false); } } return(true); }
override public void OnTargetChange(RaycastHit?HitInfo) { if (HitInfo != null) { m_LastHit = ((RaycastHit)HitInfo).collider.gameObject; } else { m_LastHit = null; GuiOutput.ClearDebugDistanceMessage(); GuiOutput.ClearContextMessage(); } }
private void PropagateUnlearnable() { Debug.Assert(status != ESkillStatus.Acquired); if (status == ESkillStatus.Unlearnable) { return; } status = ESkillStatus.Unlearnable; GuiOutput.Log(String.Format("{0} is unlearnable now!", type)); // All skills that depend on this skill are now unlearnable foreach (SkillNode n in dependents) { n.PropagateUnlearnable(); } }
public void AcquireSkill(EAbility skill) { SkillNode newSkill = m_SkillTree[(int)skill]; switch (newSkill.GetStatus()) { case ESkillStatus.Learnable: GuiOutput.Log(String.Format("{0} Acquired!", skill)); newSkill.Acquire(); break; case ESkillStatus.MissingPrereq: GuiOutput.Log("MISSING PREREQ"); break; case ESkillStatus.Unlearnable: GuiOutput.Log("UNLEARNABLE"); break; case ESkillStatus.Acquired: GuiOutput.Log("ALREADY LEARNT"); break; } }
public ReadController(PlayerManager m, string message) : base(m) { GuiOutput.DisplayFullText(message); }
private void QuitContext() { GuiOutput.HideFullText(); m_Manager.ChangeContext(new DefaultController(m_Manager)); }
private void Update() { // Context switch was requested // To ensure we do not switch controllers in the middle of the frame we only update the // controller at the beginning of the frame. Controller change requests made in the middle // of the frame will only affect the m_NewController. if (m_NewController != null) { m_controller = m_NewController; m_NewController = null; } RotateView(); RaycastHit HitInfo; int NotPlayerMask = ~(1 << LayerMask.NameToLayer("PlayerCharacter")); if (Physics.Raycast(m_Camera.transform.position, m_Camera.transform.forward, out HitInfo, 10.0f, NotPlayerMask)) { GuiOutput.DisplayDebugDistanceMessage("" + ((RaycastHit)HitInfo).distance); m_WasHovering = true; GameObject NewTarget = HitInfo.collider.gameObject; if (NewTarget == m_PreviousTarget) { m_HoverTime += Time.deltaTime; m_controller.OnHover(m_HoverTime); } else { m_HoverTime = 0.0f; m_controller.OnTargetChange(HitInfo); } m_PreviousTarget = NewTarget; } else if (m_WasHovering) { m_WasHovering = false; m_PreviousTarget = null; m_controller.OnTargetChange(null); } if (!m_MouseDown) { m_MouseDown = Input.GetMouseButtonDown(0); m_HoldTime = 0.0f; } else if (Input.GetMouseButtonUp(0)) { m_MouseDown = false; if (m_HoldTime < m_ClickSensitivity) { m_controller.OnClick(); } else { m_controller.OnRelease(m_HoldTime); } } else { m_HoldTime += Time.deltaTime; if (m_HoldTime > m_ClickSensitivity) { m_controller.OnHold(m_HoldTime); } } }