Esempio n. 1
0
 public Effect(effectType _type, soundType _s_type, explosionType _e_type, int _x, int _y)
 {
     type   = _type;
     s_type = _s_type;
     e_type = _e_type;
     x      = _x;
     y      = _y;
 }
 public Effect(effectType _type, soundType _s_type, explosionType _e_type, int _x, int _y)
 {
     type = _type;
     s_type = _s_type;
     e_type = _e_type;
     x = _x;
     y = _y;
 }
Esempio n. 3
0
    private void Update()
    {
        if (isDodging)
        {
            if (dodgeVect != Vector3.zero)
            {
                if (Mathf.Abs(Vector3.Distance(transform.position, dodgePos)) > dodgeDistance)
                {
                    isDodging = false;
                    dodgePos  = Vector3.zero;
                }
                else
                {
                    transform.position += dodgeVect * Time.deltaTime * dodgeSpeed;
                }
            }
            else
            {
                isDodging = false;
                dodgePos  = Vector3.zero;
            }
        }
        switch (currentEffect)
        {
        case effectType.bleeding:
            break;

        case effectType.instaKill:
            break;

        case effectType.poison:
            break;

        case effectType.slowed:
            break;

        case effectType.staggered:
            if (staggerTimer >= baseStaggerRecoveryTime)
            {
                FreeCombat = true;
                animator.SetBool("Stagger", false);

                currentEffect = effectType.nothing;
                staggerTimer  = 0.0f;
            }
            else
            {
                staggerTimer += Time.deltaTime;
            }
            break;
        }
    }
Esempio n. 4
0
    private void Stagger()
    {
        if (currentEffect != effectType.staggered)
        {
            currentEffect = effectType.staggered;
            staggerTimer  = 0.0f;
            FreeCombat    = false;

            animator.SetBool("ReadyAttack", false);

            animator.SetBool("Stagger", true);
        }
    }
Esempio n. 5
0
 public CombatEffect(effectType type, int turnsRemaining, CombatAbility ability = null, string damageType = "", float modifier = 0f)
 {
     this.turnsRemaining = turnsRemaining;
     this.type           = type;
     if (type == effectType.abilityPerTurn)
     {
         this.ability = ability;
     }
     if (type == effectType.damageDealtModifier || type == effectType.damageTakenModifier)
     {
         this.damageType = damageType;
         this.modifier   = modifier;
     }
 }
Esempio n. 6
0
    public static float playSprite(effectType et)
    {
        int i    = (int)et;
        var cg   = effectsManager.effects[i];
        int j    = Random.Range(0, cg.clips.Length);
        var clip = cg.clips[j];

        AudioSource source = effectsManager.sourcePool.Find(a => !a.isPlaying);

        if (source == null)
        {
            source = effectsManager.gameObject.AddComponent <AudioSource>();
            effectsManager.sourcePool.Add(source);
        }

        source.clip   = clip;
        source.volume = cg.volume;
        source.loop   = cg.Loop;
        source.Play();
        Debug.Log("play " + clip.name);

        return(clip.length);
    }
 public Effect(effectType _type, int _rumble_dur)
 {
     type       = _type;
     rumble_dur = _rumble_dur;
 }
        private void addStatModifier(Item item, effectType effect)
        {
            if (item == null)
            {
                throw new Exception("Cannot work with null item!");
            }
            if (item.Stats == null)
            {
                throw new Exception("This item does not have a base stat!");
            }

            switch (effect)
            {
                case effectType.Fire:
                    item.Name = "Fire " + item.Name;
                    item.Stats = new StatModifier(0, 3, 0, null, item.Stats);
                    break;
                case effectType.Super:
                    item.Name = "Super " + item.Name;
                    item.Stats = new StatModifier(3, 5, 3, null, item.Stats);
                    break;
                case effectType.Curesd:
                    item.Name = "Cursed " + item.Name;
                    item.Stats = new StatModifier(-1, -3, -2, null, item.Stats);
                    break;
                default:
                    item.Name = "Extra HP " + item.Name;
                    item.Stats = new StatModifier(5, 0, 0, null, item.Stats);
                    break;
            }
        }
Esempio n. 9
0
			public static string effectName(effectType effType);
Esempio n. 10
0
			public effect(effectType theType);
 public Effect(effectType _type, int _rumble_dur)
 {
     type = _type;
     rumble_dur = _rumble_dur;
 }
Esempio n. 12
0
    //creates a new line of text for each stat alteration and includes a value based on number of times the stat is increased.
    private void WriteEffectLines(List<string> statName, List<int> value, bool isPositive, effectType type)
    {
        for(int i = 0; i < statName.Count; i++){
            Vector3 startPos = new Vector3(xOffset, (textOffset));

            GameObject effectItem = Instantiate(effectPrefab, startPos, Quaternion.identity) as GameObject;
            effectItem.transform.SetParent(elements[2].transform, false);
            effectItem.transform.localScale = new Vector3(1.4f, 1.4f, 1.4f);

            Text text = effectItem.GetComponentInChildren<Text>();
            Image image = effectItem.GetComponentsInChildren<Image>()[1];

            if (value[i] > 0){
                if(isPositive){
                    text.color = positiveColor;
                    text.text = " +" + value[i];
                }
                else {
                    text.color = negativeColor;
                    text.text = " -" + value[i];
                }
            }
            else {
                if(isPositive){
                    text.color = specialColor;
                    text.text = "";
                    effectItem.transform.SetParent(elements[3].transform, false);
                }
                else{
                    text.color = new Color32(255, 50, 35, 255);
                    text.text = "";
                    effectItem.transform.SetParent(elements[3].transform, false);
                }
                if (type == effectType.MULTI)
                {
                    text.text = "+20%";
                    type = effectType.STAT;
                }
            }

            image.sprite = IconController.DetermineStatSprite(statName[i], type, isPositive);
            image.color = IconController.DetermineStatColor(statName[i], type);

            if (type == effectType.RESTRICT)
            {
                Vector3 lockpos = new Vector3(8, -8, 0);

                GameObject lockItem = Instantiate(LockPrefab, lockpos, Quaternion.identity) as GameObject;
                lockItem.transform.SetParent(image.transform, false);
                lockItem.transform.localScale = new Vector3(1.4f, 1.4f, 1.4f);
            }

            EffectItem itemScript = effectItem.GetComponent<EffectItem>();
            itemScript.SetHintType(statName[i]);

            effectLines.Add(effectItem);

            textOffset -= 60;
        }

        statName.Clear();
        value.Clear();
    }