private void CreateRunes() { var player = GetComponent <Player>(); for (int index = 0; index < profiles.Length; index++) { RuneProfile profile = profiles[index]; if (profile.RuneType == RuneType.Magnesis) { runes.Add(new MagnesisRune(profile, player, interactableLayer.value, 5.0f)); } else if (profile.RuneType == RuneType.RemoteBombSphere) { runes.Add(new BombRune(profile, player, this)); } else if (profile.RuneType == RuneType.RemoteBombBox) { runes.Add(new BombRune(profile, player, this)); } else if (profile.RuneType == RuneType.Cryonis) { runes.Add(new CryonisRune(profile, player, cryonisLayerMask, iceblockLayerMask, this)); } else if (profile.RuneType == RuneType.Stasis) { runes.Add(new StasisRune(profile, player, interactableLayer.value, this)); } else { throw new ArgumentOutOfRangeException(); } OnCreatedRune.Invoke(runes[index]); } }
private void ActivateRune() { if (currentRune == null || currentRune.IsActive) { return; } currentRune.ActivateRune(); runeIsActive = currentRune.IsActive; if (runeIsActive) { OnRuneActivated.Invoke(currentRune); } }
public void DeactivateRune() { if (currentRune == null || !currentRune.IsActive) { return; } currentRune.DeactivateRune(); runeIsActive = currentRune.IsActive; if (!runeIsActive) { OnRuneDeactivated.Invoke(currentRune); } }
public void SelectRune(int index) { if (index < 0 || index >= runes.Count) { currentRune = null; return; } Rune rune = runes[index]; if (rune == currentRune) { return; } if (currentRune != null && currentRune.IsActive) { return; } currentRune = rune; OnRuneSelected.Invoke(currentRune); }
private void FixedUpdate() { if (PlayerInput.Instance.ToggleRuneActivation) { ToggleRuneActivation(); } if (currentRune == null || !currentRune.IsActive) { return; } if (!currentRune.IsRunning) { if (currentRune.ConfirmRune()) { OnRuneConfirmed.Invoke(currentRune); } } else { currentRune.UseRune(); } }