示例#1
0
    void Update()
    {
        if (messagesTime > 0f)
        {
            messagesTime -= Time.unscaledDeltaTime;
        }

        if (messagesTime <= 0f)
        {
            if (Pending.Count > 0)
            {
                messagesTime = PendingTime;

                GameObject message = Instantiate(LootMessagePrefab);

                LootMessage l = message.GetComponentInChildren <LootMessage>();
                l?.SetItemInfo(Pending[0]);
                Pending.RemoveAt(0);

                FloatingMessage f = message.AddComponent <FloatingMessage>();
                f.riseSpeed = MessageRiseSpeed;
                f.cooldown  = MessageCooldown;
                f.fadeout   = MessageFadeout;

                message.transform.SetParent(transform);
                message.transform.localPosition            = Vector3.zero;
                (message.transform as RectTransform).pivot = new Vector2(1f, 1f);
            }
        }
    }
 public ENLootProcessorTest()
 {
     _kapturePlugin = new KapturePluginMock();
     _lootMessage   = new LootMessage
     {
         ItemName = "ItemName",
     };
 }
 public void Setup()
 {
     _kapturePlugin = new MockKapturePlugin(2);
     _lootMessage   = new LootMessage
     {
         ItemName = "ItemName"
     };
 }
示例#4
0
    internal void Yield()
    {
        AddCredits();
        AddSchema();
        if (isMissionObjective)
        {
            MissionStatus.instance.CollectMissionObjective();
        }
        LootMessage message = Instantiate(pickupMessage, gameObject.transform.position + Vector3.up, FindObjectOfType <Camera>().transform.rotation).GetComponent <LootMessage>();

        message.SetText(GetPickupMessage());
        if (pickupClip)
        {
            AudioSource.PlayClipAtPoint(pickupClip, FindObjectOfType <Camera>().transform.position, PlayerPrefs.GetFloat(Options.sfxVolumeKey));
        }
        Destroy(gameObject);
    }
        private void OnTriggerEnter(Collider other)
        {
            var pickup = other.gameObject.GetComponent <PickupController>();

            if (pickup != null)
            {
                var lootMessage = new LootMessage();
                lootMessage.loot.blue   = pickup.TotalBlue;
                lootMessage.loot.green  = pickup.TotalGreen;
                lootMessage.loot.red    = pickup.TotalRed;
                lootMessage.loot.yellow = pickup.TotalYellow;
                lootMessage.eventType   = "loot";
                lootMessage.username    = player.name;
                lootMessage.playerId    = player.id;

                colyseusManager.Send(lootMessage);

                Debug.Log("Pickup complete!");

                audioManager.PlaySoundEffect(SoundEffectType.PickupSound);

                Destroy(other.gameObject);

                return;
            }

            var battery = other.gameObject.GetComponent <BatteryController>();

            if (battery != null)
            {
                Debug.Log($"Player: " + player.name + " approached the " + battery.batteryColor + " battery.");

                nearbyBattery = battery.batteryColor;

                var inRangeMessage = new InRangeMessage();
                inRangeMessage.color     = nearbyBattery;
                inRangeMessage.username  = player.name;
                inRangeMessage.playerId  = player.id;
                inRangeMessage.eventType = "inRange";

                colyseusManager.Send(inRangeMessage);
            }
        }