Exemple #1
0
    private PositionEffect InstantiateIcon(Transform canvas, int counter, RectTransform prefab, float ySpawnPosOffset, float effectYTargetOffset)
    {
        RectTransform icon;

        if (counter == 0)
        {
            icon = Instantiate(prefab, canvas.transform);
        }
        else
        {
            icon = Instantiate(prefab, canvas.transform);

            icon.localPosition = new Vector2(0, counter * ySpawnPosOffset);
        }

        PositionEffect effect = icon.GetComponent <PositionEffect>();

        if (effect == null)
        {
            return(null);
        }

        float yPos = icon.localPosition.y;

        effect.SetStartAndTargetValues(new Vector2(0, yPos), new Vector2(0, yPos + effectYTargetOffset));

        effect.PlayEffect();

        return(effect);
    }
        public IEnumerator InitializePositionEffectWithDelay(PositionEffect positionEffect, float delay, string text, Color effectColor, float duration, bool markPosition)
        {
            positionEffect.Initialize("", effectColor, 10f, markPosition);

            yield return(new WaitForSeconds(delay));

            positionEffect.Initialize(text, effectColor, duration, markPosition);
        }
        public PositionEffect ShowStablePositionEffect(Position position, string text, Color?color = null, bool markPosition = false)
        {
            PositionEffect positionEffect = FetchPositionEffectAtPosition(position);

            Color effectColor = color ?? Color.white;
            float duration    = 100000f;

            positionEffect.Initialize(text, effectColor, duration, markPosition);
            return(positionEffect);
        }
Exemple #4
0
    public void DroppedSnowballPopUp(PlayerBase playerBase)
    {
        PositionEffect effect = InstantiateIcon(playerBase.Canvas, playerBaseCanvasIconsCounter, droppedSnowballIconPrefab, -20f, 30f);

        if (effect == null)
        {
            return;
        }

        StartCoroutine(PlayerBaseCanvasIconCo(effect));
    }
Exemple #5
0
    public void PickedUpSnowball(Player player)
    {
        PositionEffect effect = InstantiateIcon(player.PlayerCanvas, playerCanvasIconsCounter, pickedUpSnowballIconPrefab, -4f, 10f);

        if (effect == null)
        {
            return;
        }

        StartCoroutine(PlayerCanvasIconCo(effect));
    }
Exemple #6
0
    public void PowerUpPickedUp(Player player, RectTransform prefab)
    {
        PositionEffect effect = InstantiateIcon(player.PlayerCanvas, playerCanvasIconsCounter, prefab, 0f, 10f);

        if (effect == null)
        {
            return;
        }

        StartCoroutine(PlayerCanvasIconCo(effect));
    }
        private PositionEffect FetchPositionEffectAtPosition(Position position)
        {
            if (_positionEffectPrefab == null)
            {
                _positionEffectPrefab = Resources.Load <PositionEffect>("Prefabs/UI/" + nameof(PositionEffect));
            }
            Vector3        position3            = _unityGridInfoProvider.GetCellCenterWorld(position);
            GameObject     positionEffectObject = PoolingManager.Fetch(PoolingManager.PositionEffect, position3, Quaternion.identity);
            PositionEffect positionEffect       = positionEffectObject.GetComponent <PositionEffect>();

            return(positionEffect);
        }
        public PositionEffect ShowPositionEffect(Position position, string text, Color?color = null, bool markPosition = false, float duration = 2.5f, float delay = 0.0f)
        {
            PositionEffect positionEffect = FetchPositionEffectAtPosition(position);

            Color effectColor = color ?? Color.white;

            if (delay > 0f)
            {
                positionEffect.StartCoroutine(InitializePositionEffectWithDelay(positionEffect, delay, text, effectColor, duration,
                                                                                markPosition));
            }
            else
            {
                positionEffect.Initialize(text, effectColor, duration, markPosition);
            }
            return(positionEffect);
        }
Exemple #9
0
 public void OnUSOptionsOrderEcho(long eventId, long orderId, Side side, long price, int quantity,
                                  PositionEffect positionEffect, string route, USOptionsSymbol symbol)
 {
 }