コード例 #1
0
 private void OnPickupEvent(PickupEvent e)
 {
     if (e.pickupObject == pickup && typeOfCheckpoint == CheckpointType.PickupItem)
     {
         ConditionCompleted();
     }
 }
コード例 #2
0
ファイル: PickupEventTest.cs プロジェクト: boschbc/NaoRobot
 public void Init()
 {
     Logger.Clear();
     inputStream = EventTestingUtilities.BuildStream(ExpectedID);
     goalComs.SetStream(inputStream);
     pickupEvent = new PickupEvent();
 }
コード例 #3
0
 void OnTreasurePickup(PickupEvent evt)
 {
     if (evt.Pickup.GetComponent <TreasurePickup>() != null)
     {
         CompleteObjective(string.Empty, "1", "Objective complete : " + "lofasz");
     }
 }
コード例 #4
0
        public static PickupEvent read(BinaryReader binaryReader)
        {
            PickupEvent newObj = new PickupEvent();

            newObj.object_id  = binaryReader.ReadUInt32();
            newObj.timestamps = PhysicsTimestampPack.read(binaryReader);
            return(newObj);
        }
コード例 #5
0
 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();
 }
コード例 #6
0
ファイル: Pickup.cs プロジェクト: jak4694/671-Final-Project
        void OnTriggerEnter(Collider other)
        {
            PlayerCharacterController pickingPlayer = other.GetComponent <PlayerCharacterController>();

            if (pickingPlayer != null)
            {
                OnPicked(pickingPlayer);

                PickupEvent evt = Events.PickupEvent;
                evt.Pickup = gameObject;
                EventManager.Broadcast(evt);
            }
        }
コード例 #7
0
    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);
    }
コード例 #8
0
ファイル: ObjectivePickupItem.cs プロジェクト: LV9652/Sniper
        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);
            }
        }
コード例 #9
0
        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);
            }
                                   );
        }
コード例 #10
0
    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!");
        }
    }
コード例 #11
0
        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);
            }
        }
コード例 #12
0
 public static void PickupBroadcast(Character character, Toteable toteable)
 {
     PickupEvent?.Invoke(character, toteable);
 }
コード例 #13
0
 internal void InvokePickup(SOPickupEventArgs ev) => PickupEvent?.Invoke(ev);