Ejemplo n.º 1
0
        public void ItemSpawnerCollision(ItemSpawner itemSpawner, Character character)
        {
            if (!itemSpawner.photonView.IsMine)
            {
                return;
            }

            itemSpawner.TakeItem();

            switch (itemSpawner.ItemConfig)
            {
            case WeaponConfig weaponConfig:
                var wcontent = new int[]
                {
                    character.photonView.ViewID,
                    weaponConfig.id
                };
                PhotonNetwork.RaiseEvent(PickupWeaponCode, wcontent, raiseEventOptions, sendOptions);
                break;

            case HealthPackConfig healthPackConfig:
                var hcontent = new int[]
                {
                    character.photonView.ViewID,
                    healthPackConfig.id
                };
                PhotonNetwork.RaiseEvent(PickupHealthPackCode, hcontent, raiseEventOptions, sendOptions);
                break;

            case AmmoPackConfig ammoPackConfig:
                var acontent = new int[]
                {
                    character.photonView.ViewID,
                    ammoPackConfig.id
                };
                PhotonNetwork.RaiseEvent(PickupAmmoPackCode, acontent, raiseEventOptions, sendOptions);
                break;
            }
        }