Example #1
0
    public void Burn(Burning source)
    {
        var burning = GetComponent <Burning>();

        if (burning != null)
        {
            burning.stacks++;
            float factor = 1f / burning.stacks;
            burning.spreadChance = Mathf.Lerp(burning.spreadChance, source.spreadChance, factor);
            burning.enabled      = true;
        }
        else
        {
            burning = gameObject.AddComponent <Burning>();

            burning.visualScaleMax  = source.visualScaleMax;
            burning.scaleMultiplier = scaleMultiplier;
            burning.maxStacks       = source.maxStacks;
            burning.stackDuration   = source.stackDuration;
            burning.visualPrefab    = source.visualPrefab;

            burning.spreadRange  = source.spreadRange;
            burning.spreadChance = source.spreadChance * source.spreadLowering;
            burning.stacks       = 1f;
        }
    }
Example #2
0
 public void TempUp()
 {
     CurrentTemp += 100;
     if (CurrentTemp >= MaxTemp)
     {
         Burning?.Invoke(Name);
     }
 }
Example #3
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Burning burnable = collider.gameObject.GetComponentInChildren <Burning>();

        if (burnable)
        {
            burnable.enabled = true;
        }
    }
Example #4
0
    public void Burn()
    {
        float   xPos = (isRight) ? 0.75f : -0.75f;
        Burning b    = Instantiate(burningPrefab, new Vector3(transform.position.x + xPos, transform.position.y + 0.2f, transform.position.z), Quaternion.identity, transform).GetComponent <Burning>();

        b.player = this;
        GameManager.instance.playerEnergy -= 10;
        isBurning = true;
        BurnSFX();
    }
 protected override void OnActivate(Vector3 start, Vector3 direction, PlayerController targetController = null)
 {
     if (targetController != null)
     {
         // if (targetController.player)
         // Debug.Log(start+direction);
         // Debug.Log(targetController.gameObject.transform.position);
         Burning b = GameObject.Instantiate(data.burningPrefab, targetController.gameObject.transform.position, Quaternion.identity).GetComponent <Burning>();
         b.OnHit.AddListener((Vector3 origin, Vector3 contactPoint, GameObject target) => { Hit(origin, contactPoint, target, null, false); });
     }
 }
Example #6
0
    void OnGUI()
    {
        _burning = EditorGUILayout.ObjectField("Burning", _burning, typeof(Burning), false);
        _target  = EditorGUILayout.ObjectField("Object to split", _target, typeof(MeshRenderer), true);

        if (GUILayout.Button("Split"))
        {
            Burning burning = (Burning)_burning;
            float   size    = burning.spreadRange * burning.scaleMultiplier;

            MeshRenderer renderer = (MeshRenderer)_target;
            var          bounds   = renderer.bounds;
        }
    }
Example #7
0
    // Start is called before the first frame update
    void Start()
    {
        sr      = GetComponentInChildren <SpriteRenderer>();
        burning = GetComponent <Burning>();
        if (isBurning)
        {
            sr.color         = BURNING_COLOUR;
            burning.enabled  = true;
            gameObject.layer = Utils.burningLayer;

            if (burningTime != -1)
            {
                StartCoroutine(BurnToAshes());
            }
        }
    }
Example #8
0
        public static async Task ApplyEffects(ShardedCommandContext context, ulong user1, ulong user2)
        {
            var choms = ActiveChomusuke.GetActiveChomusuke(user1, user2);
            var chom1 = choms.Item1;
            var chom2 = choms.Item2;

            foreach (var effect in chom1.Effects)
            {
                switch (effect)
                {
                //TODO: Add effects and their results
                case Effect.Binded:
                    break;

                case Effect.Blocking:
                    break;

                case Effect.Burned:
                    await Burning.Burned(context);

                    break;

                case Effect.Confused:
                    break;

                case Effect.Decay:
                    break;

                case Effect.Deflecting:
                    break;

                case Effect.Frozen:
                    break;

                case Effect.Meditating:
                    break;

                case Effect.Restricted:
                    break;

                case Effect.Stunned:
                    break;
                }
            }
        }
Example #9
0
 protected override void InstantEffect()
 {
     base.InstantEffect();
     if (NPCinfo.target)
     {
         GameObject  newArrow    = Instantiate(arrowPrefab, transform.position, Quaternion.identity);
         HomingArrow homingArrow = newArrow.GetComponent <HomingArrow>();
         homingArrow.destination = NPCinfo.target.transform;
         homingArrow.grounded   += delegate
         {
             if (NPCinfo.target)
             {
                 NPCinfo.DealDmg2Target(AADmg);
                 Burning burning = NPCinfo.target.gameObject.AddComponent <Burning>();
                 burning.duration = FireDuration;
                 burning.dps      = FireDPS;
             }
         };
     }
 }
Example #10
0
        IEnumerator Burn(RagdollPart ragdollPart, CollisionStruct collisionStruct)
        {
            Burning burning = ragdollPart.gameObject.AddComponent <Burning>();

            Creature   creature         = ragdollPart.ragdoll.creature;
            float      duration         = UnityEngine.Random.Range(burnDuration.x, burnDuration.y);
            float      startTime        = Time.time;
            GameObject burningParticles = GameObject.Instantiate(onFireFX, ragdollPart.transform);

            burningParticles.transform.localPosition = new Vector3(0, 0, 0);

            FXPlayer.StartAllFxOnObject(burningParticles);



            int i = 0;

            while ((Time.time - startTime) < duration)
            {
                if (i >= 4)
                {
                    i = 0;
                }
                CollisionStruct collisionStruct1 = new CollisionStruct(new DamageStruct(Damager.DamageType.Poison, fireDamage), null, null, null, null, null, null, null);
                creature.health.Damage(ref collisionStruct1);
                i++;
                yield return(new WaitForSeconds(0.5f));
            }

            FXPlayer.StopAllFxOnObject(burningParticles);

            yield return(new WaitUntil(() => !burningParticles.GetComponentInChildren <ParticleSystem>().isPlaying));

            Destroy(burning);
            Destroy(burningParticles);
        }
Example #11
0
    // Update is called once per frame
    void Update()
    {
        if (CurrentHealth < MaximumHealth)
        {
            CurrentHealth += Time.deltaTime * 5;
            if (CurrentHealth <= 0)
            {
                Anim.SetBool("Dead", true);
                CharacterController CharCtrler = GetComponent <CharacterController>();
                CharCtrler.height = .3f;
                CharCtrler.center = new Vector3(0, .3f, 0);
                CapsuleCollider CapColl = GetComponent <CapsuleCollider>();
                CapColl.height = .3f;
                CapColl.center = new Vector3(0, .3f, 0);
                GetComponent <BaseControl>().Controllable = false;
            }
        }
        else
        {
            CurrentHealth = MaximumHealth;
        }

        if (CurrentMana < MaximumMana)
        {
            CurrentMana += Time.deltaTime;
        }
        else
        {
            CurrentMana = MaximumMana;
        }

        if (CurrentStats > 0)
        {
            for (short StatusCheck = 1; StatusCheck <= 8; StatusCheck = (short)(StatusCheck << 1))
            {
                switch (CurrentStats & StatusCheck)
                {
                case 1:
                    if (Anim.GetCurrentAnimatorClipInfo(2).Length > 0 && Anim.GetCurrentAnimatorStateInfo(2).normalizedTime <= 1.0f)
                    {
                        if (charController != null)
                        {
                            charController.Controllable = false;
                        }
                        StartAnimation = true;
                    }
                    else if (StartAnimation)
                    {
                        if (charController != null)
                        {
                            charController.Controllable = true;
                        }
                        CurrentStats  &= 14;
                        StartAnimation = false;
                    }
                    break;

                case 2:
                    CurrentFireDuration -= Time.deltaTime;
                    int     burnIntensity = (int)(CurrentFireDuration / 2.5);
                    Burning burn          = GetComponentInChildren <Burning>();
                    if (burn != null)
                    {
                        burn.ChangeIntensity(burnIntensity);
                    }
                    CurrentHealth -= CurrentFireDuration * FireDamageOverTime * Time.deltaTime;
                    if (CurrentFireDuration <= 0)
                    {
                        CurrentFireDuration = 0;
                        CurrentStats       &= 13;
                    }
                    CurrentSlowedDuration = CurrentSlowedDuration >= 0 ? CurrentSlowedDuration - Time.deltaTime : 0;
                    break;

                case 4:
                    CurrentSlowedDuration -= Time.deltaTime;
                    if (MaxSlowedDuration < CurrentSlowedDuration)
                    {
                        CurrentSlowedDuration = MaxSlowedDuration;
                    }
                    float ChilledIntensity = CurrentSlowedDuration / MaxSlowedDuration;
                    movements.SetAnimationSpeed(1 - ChilledIntensity);
                    Chilled chilled = GetComponentInChildren <Chilled>();
                    if (chilled != null)
                    {
                        chilled.ChangeIntensity(ChilledIntensity);
                    }
                    if (CurrentSlowedDuration <= 0 && chilled != null)
                    {
                        CurrentSlowedDuration = 0;
                        chilled.Unchill       = true;
                        movements.SetAnimationSpeed(1);
                        CurrentStats &= 11;
                    }
                    break;

                case 8:
                    break;
                }
            }
        }
    }
Example #12
0
    /*
     * Updates the counters for the effects currently on the player.
     * Called in Character.cs's NewEffect(), an override of a method in Unit.cs.
     */
    public void updateEffectTimers(Effect effect)
    {
        Debug.Log("Called updateEffectTimers. effect name is " + effect.effectName);
        switch (effect.effectName)
        {
        case "Empowered":
        {
            if (effect.isLongest)
            {
                longestEmp = (Empowered)effect;
            }
            Debug.Log("Setting longestEmp.");
            break;
        }

        case "Regeneration":
        {
            if (effect.isLongest)
            {
                longestReg = (Regeneration)effect;
            }
            Debug.Log("Setting longestReg.");
            break;
        }

        case "Degeneration":
        {
            if (effect.isLongest)
            {
                longestDegen = (Degeneration)effect;
            }
            Debug.Log("Setting longestDegen.");
            break;
        }

        case "Burning":
        {
            if (effect.isLongest)
            {
                longestBurn = (Burning)effect;
            }
            Debug.Log("Setting longestBurn.");
            break;
        }

        case "Armored":
        {
            if (effect.isLongest)
            {
                longestArmor = (Armored)effect;
            }
            Debug.Log("Setting longestArmor.");
            break;
        }

        case "Focused":
        {
            if (effect.isLongest)
            {
                longestFocus = (Focused)effect;
            }
            Debug.Log("Setting longestFocus.");
            break;
        }

        case "Hasted":
        {
            if (effect.isLongest)
            {
                longestHaste = (Hasted)effect;
            }
            Debug.Log("Setting longestHaste.");
            break;
        }

        case "Swiftness":
        {
            if (effect.isLongest)
            {
                longestSwift = (Swiftness)effect;
            }
            Debug.Log("Setting longestSwift.");
            break;
        }

        case "Crippled":
        {
            if (effect.isLongest)
            {
                longestCrip = (Crippled)effect;
            }
            Debug.Log("Setting longestCrip.");
            break;
        }

        default:
        {
            Debug.Log("Invalid effect.");
            break;
        }
        }
    }