Ejemplo n.º 1
0
    public void SetPickUp(PickUp inPickUp)
    {
        abilitySub?.Dispose();
        activeAbilityGO?.SetActive(false);

        pickUp = inPickUp;
        String type = pickUp.GetType().ToString();

        abilityStartTime = Time.time;

        switch (type)
        {
        case "Magnet":
            abilitySub = this.UpdateAsObservable()
                         .Subscribe(_ =>
            {
                magnetAttractor.gameObject.SetActive(true);
                Magnet(pickUp.ActiveTime);
                activeAbilityGO = magnetAttractor.gameObject;
            });
            break;

        case "Laser":
            abilitySub = this.UpdateAsObservable()
                         .Subscribe(_ =>
            {
                laserGun.gameObject.SetActive(true);
                Laser(pickUp.ActiveTime);
                activeAbilityGO = laserGun.gameObject;
            });
            break;
        }
    }