void CheckHitObject() { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit[] hits; hits = Physics.RaycastAll(ray, 10f); foreach (RaycastHit hit in hits) { if (hit.transform == spheres[step].transform) { if (step >= 4) { SetEmission(false); Unlocked?.Invoke(); Exit(); } else { lightSphere(step, false); lightSphere(step + 1, true); step++; } } } }
public virtual void SetLocked(bool lockState) { if (IsLocked == lockState) { return; } IsLocked = lockState; InternalSetLocked(lockState); if (IsLocked) { if (Locked != null) { Locked.Invoke(this, new LockStateChangedEventArgs(IsLocked)); } } else { if (Unlocked != null) { Unlocked.Invoke(this, new LockStateChangedEventArgs(IsLocked)); } } }
public void Unlock(Relic relic) { relic.Owner = gameObject; Available.Add(relic); Unlocked?.Invoke(this, relic); }
// constructor public Turnstile() { itsLockedState = new Locked(); itsUnlockedState = new Unlocked(); itsState = itsLockedState; // Entry functions for: Locked }
public void Evaluate() { if (IsUnlocked || Quantity < RequiredQuantity) { return; } IsUnlocked = true; AnyAchievementUnlocked?.Invoke(this); Unlocked?.Invoke(this); Unsubscribe(); }
void CheckHitObject() { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit[] hits; hits = Physics.RaycastAll(ray, 10f); foreach (RaycastHit hit in hits) { if (hit.transform.CompareTag("KeypadButton")) { if (keypressSound != null) { keypadSound.clip = keypressSound; keypadSound.Play(); } enteredCode += hit.transform.name; if (enteredCode.Length >= codeLength) { if (code.Equals(enteredCode)) { Unlocked?.Invoke(); Exit(); Debug.Log("Correct"); if (keypressSound != null) { keypadSound.clip = correctSound; keypadSound.Play(); } } else { Debug.Log("Incorrect"); if (keypressSound != null) { keypadSound.clip = incorrectSound; keypadSound.Play(); } } enteredCode = ""; } } } }
/// <summary> /// Adds an unlocked ally to the roster. /// </summary> /// <param name="name">The name of the ally to unlock.</param> /// <param name="level">The level of the unlocked ally.</param> /// <param name="raiseChangeEvent">Whether or not to raise an event for the roster change.</param> public void AddUnlocked(string name, int level, bool raiseChangeEvent = true) { if (!Unlocked.Contains(name)) { this.AddUnlocked(name, raiseChangeEvent); allyLevels.Add(name, level); var entity = GetEntityObject(name) as Ally; var manager = GameManager.GetManagerByType(ListableEntityType.Ability); if (manager != null) { manager.AddUnlocked(entity.Lesson.name, false); } } }
public JournalTechnologyBroker(JObject evt) : base(evt, JournalTypeEnum.TechnologyBroker) { BrokerType = evt["BrokerType"].Str("Unknown"); MarketID = evt["MarketID"].LongNull(); ItemsUnlocked = evt["ItemsUnlocked"]?.ToObjectProtected <Unlocked[]>(); //3.03 entry CommodityList = evt["Commodities"]?.ToObjectProtected <Commodities[]>(); MaterialList = evt["Materials"]?.ToObjectProtected <Materials[]>(); if (ItemsUnlocked != null) { foreach (Unlocked u in ItemsUnlocked) { u.Name_Localised = JournalFieldNaming.CheckLocalisation(u.Name_Localised ?? "", u.Name); } } if (CommodityList != null) { foreach (Commodities c in CommodityList) { c.FriendlyName = MaterialCommodityData.GetNameByFDName(c.Name); } } if (MaterialList != null) { foreach (Materials m in MaterialList) { m.FriendlyName = MaterialCommodityData.GetNameByFDName(m.Name); m.Category = JournalFieldNaming.NormaliseMaterialCategory(m.Category); } } string oldentry = evt["ItemUnlocked"].StrNull(); // 3.02 journal entry if (ItemsUnlocked == null && oldentry != null) { ItemsUnlocked = new Unlocked[] { new Unlocked() { Name = oldentry, Name_Localised = oldentry } } } ; }
/// <summary> /// Lowers the time scale lock by one, time scale value is applied when gets unlocked /// </summary> public void Unlock() { lock (this) { if (Locks == 0) { Log.Warning("Trying to unlock already unlocked semaphore."); return; } if (--Locks == 0) { Unlocked?.Invoke(); } LocksCountChanged?.Invoke(Locks); } }
//saves level progress public static void SaveLevels() { Unlocked data = new Unlocked(GlobalVariables.UnlockedLevels); string destination = Application.persistentDataPath + "/levels.dat"; FileStream file; if (File.Exists(destination)) { file = File.OpenWrite(destination); } else { file = File.Create(destination); } BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(file, data); file.Close(); }
//loads settings public static void LoadLevels() { string destination = Application.persistentDataPath + "/levels.dat"; FileStream file; if (File.Exists(destination)) { file = File.OpenRead(destination); } else { SaveLevels(); return; } BinaryFormatter bf = new BinaryFormatter(); Unlocked data = (Unlocked)bf.Deserialize(file); file.Close(); GlobalVariables.UnlockedLevels = data.level; }
/// <summary> /// called when the player gets the number right. Subscribe to the event on your seperate script (for hub) /// </summary> private void FinishWithLock() { /// <summary> /// do something special, depending on which lock it is /// calls player state if all the numbers are inputed. this disables the script so users are not able to move the lock after completing all the numbers /// </summary> Brackets.SetActive(true); switch (thisLock) { case LockType.NormaPuzzle: currentState = PlayerStates.Roaming; if (Unlocked != null) { Unlocked.Invoke(); } break; case LockType.HubLock: currentState = PlayerStates.Roaming; if (Unlocked != null) { Unlocked.Invoke(); } break; default: break; } //Should disable the lock now after completing it enabled = false; LockisActive = false; StartCoroutine(UnlockedCoroutine()); //Gets out of the lock sequence }
private void ButtonPressed(string key) { if (!locked) { return; } if (keyCode.Substring(currentSequence.Length, 1) == key) { currentSequence += key; if (currentSequence == keyCode) { Unlocked?.Invoke(); locked = false; baseMeshRenderer.material.EnableKeyword("_EMISSION"); } } else { currentSequence = key; } }
protected override void OnUnlocked(int param1, int param2, int param3, int param4, int param) { Unlocked?.Invoke(); }
public void Unlock(SecureString password) { Wallet.Unlock(password); Unlocked?.Invoke(this, EventArgs.Empty); }
public void Unlock() { IsUnlocked = true; Unlocked?.Invoke(this); }
/// <summary> /// Raises the <see cref="Unlocked" /> event. /// </summary> /// <seealso cref="EventArgs" /> protected virtual void OnUnlocked() { Unlocked?.Invoke(this, EventArgs.Empty); }