Exemplo n.º 1
0
    private void CreateItemSelect(Vector2 position, float deltaLayer)
    {
        if (select != null)
        {
            select.Destroy();
        }

        select = new GUIImage("Textures/Upgrades/Select", -4.8f - deltaLayer, position, new Vector2(-1, -1) * Settings.FhdToHD, false);
    }
 private void Destroy()
 {
     top.Destroy();
     bottom.Destroy();
     circle.Destroy();
 }
Exemplo n.º 3
0
    public void Update(float deltaTime)
    {
        if (isKilling)
        {
            return;
        }
        if (!(effects [Effect.Stun] > 0 || effects [Effect.Root] > 0))
        {
            if (Vector2.Distance(targetPosition, mapPosition) > 0.1f)
            {
                Vector2 _direction = (targetPosition - mapPosition);
                _direction.Normalize();

                gameObject.transform.localScale = new Vector3((_direction.x > 0 ? -1 : 1) * Mathf.Abs(size.x), size.y, 1);
                direction    = (_direction.x > 0 ? -1 : 1);
                mapPosition += _direction * deltaTime * speed * Settings.FhdToHD;
            }
            else
            {
                roadIndex++;

                if (roadIndex == (color == TeamColor.Red ? GameController.RoadRed : GameController.RoadBlue) [roadNumber].Count)
                {
                    Kill();
                    healthBar.Destroy();
                    GameController.ReduceHealth(color == TeamColor.Red ? TeamColor.Blue : TeamColor.Red, (int)damage);
                    GameController.DamageAnimation();
                }
                else
                {
                    Vector3 _targetPosition = (color == TeamColor.Red ? GameController.RoadRed : GameController.RoadBlue) [roadNumber] [roadIndex];
                    layer          = _targetPosition.z;
                    targetPosition = GetTruePosition(_targetPosition);
                }

                BombsController.Update(this);
            }
        }

        if (effects [Effect.Stun] > 0)
        {
            effects [Effect.Stun] -= deltaTime;
            effects [Effect.Stun]  = effects [Effect.Stun] < 0?0:effects [Effect.Stun];
        }

        if (effects [Effect.Visible] > 0)
        {
            effects [Effect.Visible] -= deltaTime;
            effects [Effect.Visible]  = effects [Effect.Visible] < 0?0:effects [Effect.Visible];
        }

        if (effects [Effect.Slow] > 0)
        {
            effects [Effect.Slow] -= deltaTime;
            effects [Effect.Slow]  = effects [Effect.Slow] < 0?0:effects [Effect.Slow];
            speed = BalanceSettings.speed [type] * 0.5f;
        }
        else
        {
            speed = BalanceSettings.speed [type];
        }

        if (effects [Effect.Root] > 0)
        {
            if (rootImage == null)
            {
                rootImage = new GUIImage("UserInterface/Freeze", layer - GUIController.layer + 0.1f, mapPosition, new Vector2(1, 1), false);
            }
            else
            {
                rootImage.positionInMeters = mapPosition;
                rootImage.layer            = layer - GUIController.layer + 0.1f;
            }

            effects [Effect.Root] -= deltaTime;
            effects [Effect.Root]  = effects [Effect.Root] < 0?0:effects [Effect.Root];
        }
        else
        {
            if (rootImage != null)
            {
                rootImage.Destroy();
                rootImage = null;
            }
        }

        if (effects [Effect.Heal] > 0)
        {
            effects [Effect.Heal] -= deltaTime;
            effects [Effect.Heal]  = effects [Effect.Heal] < 0?0:effects [Effect.Heal];
            health += healthMax * 0.15f * deltaTime;
        }
    }