private void OnPickupEvent(PickupEvent e) { if (e.pickupObject == pickup && typeOfCheckpoint == CheckpointType.PickupItem) { ConditionCompleted(); } }
public void Init() { Logger.Clear(); inputStream = EventTestingUtilities.BuildStream(ExpectedID); goalComs.SetStream(inputStream); pickupEvent = new PickupEvent(); }
void OnTreasurePickup(PickupEvent evt) { if (evt.Pickup.GetComponent <TreasurePickup>() != null) { CompleteObjective(string.Empty, "1", "Objective complete : " + "lofasz"); } }
public static PickupEvent read(BinaryReader binaryReader) { PickupEvent newObj = new PickupEvent(); newObj.object_id = binaryReader.ReadUInt32(); newObj.timestamps = PhysicsTimestampPack.read(binaryReader); return(newObj); }
public void Awake() { DeathEvent = new DeathEvent(); PickupEvent = new PickupEvent(); HPChangeEvent = new HPChangeEvent(); HPReduceEvent = new HPChangeEvent(); HPRecoverEvent = new HPChangeEvent(); ReviveEvent = new ReviveEvent(); DestroyEvent = new DestroyEvent(); MainPlayerAttack = new MainPlayerAttackEvent(); }
void OnTriggerEnter(Collider other) { PlayerCharacterController pickingPlayer = other.GetComponent <PlayerCharacterController>(); if (pickingPlayer != null) { OnPicked(pickingPlayer); PickupEvent evt = Events.PickupEvent; evt.Pickup = gameObject; EventManager.Broadcast(evt); } }
bool PickupItem(Item item, Hands hand) { if (item == null) { return(false); } if ((item.transform.position - transform.position).magnitude > Range) { return(false); } switch (hand) { case Hands.LEFT: if (Hand1 != null) { return(false); } Hand1 = item; break; case Hands.RIGHT: if (Hand2 != null) { return(false); } Hand2 = item; break; } item.gameObject.SetActive(false); item.transform.parent = transform; item.transform.localPosition = new Vector3(0, 0, item.transform.localPosition.z); if (Hand1 != null && Hand2 != null) { for (int i = 0; i < ItemCombinations.Length; ++i) { ItemCombination combination = ItemCombinations[i]; if (combination.InputA == null || combination.InputB == null || combination.Output == null) { continue; } if ((combination.InputA.name == Hand1.name && combination.InputB.name == Hand2.name) || (combination.InputA.name == Hand2.name && combination.InputB.name == Hand1.name)) { activeCombination = i; break; } } } PickupEvent.Invoke(hand); return(true); }
void OnPickupEvent(PickupEvent evt) { if (IsCompleted || ItemToPickup != evt.Pickup) { return; } // this will trigger the objective completion // it works even if the player can't pickup the item (i.e. objective pickup healthpack while at full heath) CompleteObjective(string.Empty, string.Empty, "Objective complete : " + Title); if (gameObject) { Destroy(gameObject); } }
private void Awake() { if (instance == null) { instance = this; } else { //Panic DestroyImmediate(gameObject); } shootEvent = new ShootEvent(); discardEvent = new DiscardEvent(); pickupEvent = new PickupEvent(); enemyPickupEvent = new EnemyPickupEvent(); levelClear = new UnityEvent(); enemySemaphor = 0; PlayerDamageEvent = new FloatEvent(); PlayerHealEvent = new FloatEvent(); gameStateChangeEvent = new GameStateEvent(); PointEvent = new FloatEvent(); LocationOfInterestEvent = new LOIEvent(); LOIList = new List <Transform>(); LocationOfInterestEvent.AddListener(x => { LOIList.Add(x); }); playerRef = GameObject.FindGameObjectWithTag("Player").transform; highscores = new Dictionary <string, int>(); //Listen for event pickupEvent.AddListener(x => LOIList.Remove(x.transform)); levelClear.AddListener(() => { gameState = GameState.Clear; gameStateChangeEvent.Invoke(gameState); } ); }
public override void OnInteract() { //If the item is pickupable, add it to inventory if (playerInventory.AddToInventory(item)) { if (audioSource) { audioSource.clip = pickupSound; audioSource.Play(); } PickupEvent?.Invoke(); Destroy(gameObject); } else { Debug.Log("Unable to add to inventory!"); } }
public override void OnInteract(GameObject Interactor) { base.OnInteract(Interactor); GameObject playerRef = Interactor; playerInventory = playerRef.GetComponent <InventoryManager>(); playerInteract = playerRef.GetComponent <InteractManager>(); audioSource = playerRef.GetComponent <AudioSource>(); //If the item is pickupable, add it to inventory if (playerInventory.AddToInventory(item)) { if (audioSource) { audioSource.clip = pickupSound; audioSource.Play(); } PickupEvent?.Invoke(Interactor); Destroy(gameObject); } }
public static void PickupBroadcast(Character character, Toteable toteable) { PickupEvent?.Invoke(character, toteable); }
internal void InvokePickup(SOPickupEventArgs ev) => PickupEvent?.Invoke(ev);