private void Awake() { if (!interactionArea) { interactionArea = GetComponentInParent <InteractionArea>(); } }
public void OnExitInteractionArea(InteractionArea area) { if (currentInteractionArea == area) { currentInteractionArea = null; Dehighlight(); } }
private void OnTriggerExit(Collider other) { InteractionArea interactionArea = other.GetComponent <InteractionArea>(); if (interactionArea && interactionArea == currentInteractionArea) { currentInteractionArea.OnPlayerExitTrigger(); currentInteractionArea = null; } }
private void OnTriggerEnter(Collider other) { InteractionArea interactionArea = other.GetComponent <InteractionArea>(); if (interactionArea && !interactionArea.isFinished) { currentInteractionArea = interactionArea; currentInteractionArea.OnPlayerEnterTrigger(); } }
public void LeaveInteractionArea() { if (currentInteractionArea) { currentInteractionArea.OnPlayerExit(); } Game.inst.cursor.SetVisibility(false); isInsideArea = false; currentInteractionArea = null; }
// Use this for initialization protected override void Start() { base.Start(); characterMovement = new PlayerMovement(this.gameObject); interactableArea = new InteractionArea(this.gameObject); characterCombat = new PlayerCombat("Player", this.gameObject, playerWeapon); determiningCollisions = new DeterminingCollisionActions(this.gameObject, ((PlayerMovement)characterMovement)); keyChecker = GameObject.Find("Databases").GetComponent <KeyboardInput> (); playerHud = new PlayerHUD(this.gameObject.name, ((PlayerCombat)characterCombat).Health, ((PlayerCombat)characterCombat).Mana); playerInventory = new Inventory(); }
protected void OnEnable() { for (int n = 0; n < dependencyList.Count; n++) { if (dependencyList[n].providedEvent is TimelineEvent) { TimelineEvent currentEvent = dependencyList[n].providedEvent as TimelineEvent; awaitingEvents.Add(currentEvent); dynamicDelegateList.Add(EventUtility.SubscribeToEvent(this, currentEvent, dependencyList[n].eventToListen, "OnDependentTimeline", null, GetType(), BindingFlags.Instance | BindingFlags.NonPublic)); } else if (dependencyList[n].providedEvent is InteractionArea) { InteractionArea currentEvent = dependencyList[n].providedEvent as InteractionArea; awaitingEvents.Add(currentEvent); dynamicDelegateList.Add(EventUtility.SubscribeToEvent(this, currentEvent, dependencyList[n].eventToListen, "OnDependentInteractionArea", null, GetType(), BindingFlags.Instance | BindingFlags.NonPublic)); } else if (dependencyList[n].providedEvent is GestureInteraction) { GestureInteraction currentEvent = dependencyList[n].providedEvent as GestureInteraction; awaitingEvents.Add(currentEvent); dynamicDelegateList.Add(EventUtility.SubscribeToEvent(this, currentEvent, dependencyList[n].eventToListen, "OnDependentTimeline", null, GetType(), BindingFlags.Instance | BindingFlags.NonPublic)); } } // If there are no dependencies, you start at the scene's start CheckDependencyCount(); }
public IEnumerator OnFinishInteractionArea(InteractionArea interactionArea) { ui.SetBackButtonActive(false); refs.playerCandle.SetCandleActive(false); yield return(interactionArea.OnFinish()); refs.playerCandle.SetCandleActive(true); interactionsFinished++; if (interactionsFinished >= config.totalInteractions) { StartCoroutine(GameEndSequence()); } else { yield return(CandleUpgradeSequence()); } }
public override void StartReaction(object o, EventArgs e) { Vector3 originalObjectLocation = objectToTeleport.transform.position; objectToTeleport.transform.parent = teleportationLocation; objectToTeleport.transform.localPosition = Vector3.zero; objectToTeleport.transform.localRotation = Quaternion.identity; if (teleportIAObjects) { InteractionArea attachedIA = objectToTeleport.GetComponentInChildren <InteractionArea>(); if (attachedIA != null) { foreach (GameObject gameObjectInInteractionArea in attachedIA.ObjectsInInteractionAreaList) { Vector3 positionDifference = gameObjectInInteractionArea.transform.position - originalObjectLocation; gameObjectInInteractionArea.transform.position = objectToTeleport.transform.position + positionDifference; } } } }
public void OnEnterInteractionArea(InteractionArea area) { currentInteractionArea = area; Highlight(); }