public void setColor(EBulletEffect type)
 {
     Color[] colors = PlayConfig.getColorEffectPanel(type);
     nameForeground.color = colors[0];
     nameOutline.color = colors[1];
     nameLabel.gradientTop = colors[2];
     nameLabel.gradientBottom = colors[3];
     nameLabel.effectColor = colors[4];
 }
 public void setColor(EBulletEffect type)
 {
     Color[] colors = PlayConfig.getColorEffectPanel(type);
     nameForeground.color     = colors[0];
     nameOutline.color        = colors[1];
     nameLabel.gradientTop    = colors[2];
     nameLabel.gradientBottom = colors[3];
     nameLabel.effectColor    = colors[4];
 }
Example #3
0
    public static void initEffect(EBulletEffect type, GameObject enemy, string objectID, params object[] obj)
    {
        object[] newList = new object[obj.Length + 1];
        newList[0] = objectID;

        for (int i = 0; i < obj.Length; i++)
        {
            newList[i + 1] = obj[i];
        }

        BulletEffectManager.Instance.initEffect(type, enemy, newList);
    }
    public static Color[] getColorEffectPanel(EBulletEffect type)
    {
        Color[] colors = new Color[5];
        switch (type)
        {
        case EBulletEffect.SLOW:
            colors[0] = ColorEffectPanelSlowForeground;
            colors[1] = ColorEffectPanelSlowOutline;
            colors[2] = ColorEffectPanelSlowNameGradientTop;
            colors[3] = ColorEffectPanelSlowNameGradientBottom;
            colors[4] = ColorEffectPanelSlowNameGradientOutline;
            break;

        case EBulletEffect.BURN:
            colors[0] = ColorEffectPanelBurnForeground;
            colors[1] = ColorEffectPanelBurnOutline;
            colors[2] = ColorEffectPanelBurnNameGradientTop;
            colors[3] = ColorEffectPanelBurnNameGradientBottom;
            colors[4] = ColorEffectPanelBurnNameGradientOutline;
            break;
        }
        return(colors);
    }
Example #5
0
    public void initEffect(EBulletEffect type, GameObject enemy, params object[] obj)
    {
        switch (type)
        {
            #region SLOW
        case EBulletEffect.SLOW:
            float slowValue = (float)obj[0];
            //Set animation
            float timeFrame = enemy.transform.GetChild(0).gameObject.GetComponent <AnimationFrames>().timeFrame;

            enemy.transform.GetChild(0).gameObject.GetComponent <AnimationFrames>().timeFrame = timeFrame * (1 + slowValue);
            //Set enemy speed
            float moveSpeed = enemy.GetComponent <EnemyController>().speed;

            enemy.GetComponent <EnemyController>().speed *= (1 - slowValue);
            //Set enemy color
            enemy.GetComponentInChildren <SpriteRenderer>().color = PlayConfig.ColorSlowEffect;
            enemy.GetComponent <EnemyController>().listEffected.Add(EBulletEffect.SLOW);
            enemy.AddComponent <BulletEffectController>();
            StartCoroutine(slow(enemy, slowValue, (float)obj[1]));
            break;

            #endregion
            #region BURN
        case EBulletEffect.BURN:
            GameObject burning = Instantiate(Resources.Load <GameObject>("Prefab/Effect/Effect Burning")) as GameObject;
            burning.transform.parent     = enemy.transform;
            burning.transform.localScale = Vector3.one;
            burning.GetComponent <UIAnchor>().container = enemy;
            burning.GetComponentInChildren <SpriteRenderer>().material.renderQueue = GameConfig.RenderQueueBulletEffect - WaveController.Instance.countEnemy;
            burning.name = PlayNameHashIDs.BulletEffectBurning;

            enemy.GetComponent <EnemyController>().listEffected.Add(EBulletEffect.BURN);

            StartCoroutine(burn(burning, enemy, (float)obj[0], (int)obj[1], (float)obj[2]));
            break;

            #endregion
            #region POISON
        case EBulletEffect.POISON:
            GameObject poisoning = Instantiate(Resources.Load <GameObject>("Prefab/Effect/Effect Poisoning")) as GameObject;
            GameObject bgHealth  = enemy.transform.GetChild(1).transform.GetChild(1).gameObject;

            poisoning.transform.parent     = enemy.transform;
            poisoning.transform.localScale = Vector3.one;
            poisoning.GetComponent <UIAnchor>().container  = bgHealth;
            poisoning.GetComponent <UIStretch>().container = bgHealth;
            poisoning.GetComponentInChildren <SpriteRenderer>().material.renderQueue = GameConfig.RenderQueueBulletEffect - WaveController.Instance.countEnemy;
            poisoning.name = PlayNameHashIDs.BulletEffeftPoisoning;

            enemy.GetComponent <EnemyController>().listEffected.Add(EBulletEffect.POISON);

            StartCoroutine(poison(poisoning, enemy, (float)obj[0], (int)obj[1], (float)obj[2]));
            break;

            #endregion
            #region STUN
        case EBulletEffect.STUN:
            GameObject stunning = Instantiate(Resources.Load <GameObject>("Prefab/Object/Object")) as GameObject;
            stunning.name                    = "Stun Effect";
            stunning.transform.parent        = enemy.transform;
            stunning.transform.localScale    = Vector3.one;
            stunning.transform.localPosition = Vector3.one;
            stunning.GetComponentInChildren <SpriteRenderer>().material.renderQueue = GameConfig.RenderQueueBulletEffect - WaveController.Instance.countEnemy;

            ObjectController objectController = stunning.GetComponent <ObjectController>();
            objectController.initalize(obj[0].ToString());     //ID

            enemy.GetComponent <EnemyController>().listEffected.Add(EBulletEffect.STUN);
            enemy.AddComponent <BulletEffectController>();

            StartCoroutine(stun(stunning, enemy, float.Parse(obj[1].ToString())));
            break;

            #endregion
            #region THUNDER
        case EBulletEffect.THUNDER:
            GameObject thundering = Instantiate(Resources.Load <GameObject>("Prefab/Object/Object")) as GameObject;
            thundering.name                    = "Thunder Effect";
            thundering.transform.parent        = enemy.transform;
            thundering.transform.localScale    = Vector3.one;
            thundering.transform.localPosition = Vector3.one;
            thundering.GetComponentInChildren <SpriteRenderer>().material.renderQueue = GameConfig.RenderQueueBulletEffect - WaveController.Instance.countEnemy;

            objectController = thundering.GetComponent <ObjectController>();
            objectController.initalize(obj[0].ToString());     //ID

            StartCoroutine(thunder(thundering, enemy, objectController.objectAnimation.getDuration(), 10));
            //enemy.GetComponent<EnemyController>().listEffected.Add(EBulletEffect.THUNDER);
            //enemy.AddComponent<BulletEffectController>();
            break;
            #endregion
        }
    }
	public static Color[] getColorEffectPanel(EBulletEffect type)
	{
		Color[] colors = new Color[5];
		switch (type)
		{
			case EBulletEffect.SLOW:
				colors[0] = ColorEffectPanelSlowForeground;
				colors[1] = ColorEffectPanelSlowOutline;
				colors[2] = ColorEffectPanelSlowNameGradientTop;
				colors[3] = ColorEffectPanelSlowNameGradientBottom;
				colors[4] = ColorEffectPanelSlowNameGradientOutline;
				break;
			case EBulletEffect.BURN:
				colors[0] = ColorEffectPanelBurnForeground;
				colors[1] = ColorEffectPanelBurnOutline;
				colors[2] = ColorEffectPanelBurnNameGradientTop;
				colors[3] = ColorEffectPanelBurnNameGradientBottom;
				colors[4] = ColorEffectPanelBurnNameGradientOutline;
				break;
		}
		return colors;
	}