public IEnumerator OvertimeEffect(BuffReceiver receiver)
 {
     while (true)
     {
         if (receiver.GetComponent <Health>().fireModifier > 0)
         {
             receiver.GetComponent <Health>().DeductHpWhileInvulnerable(damage);
         }
         yield return(new WaitForSeconds(effectInterval));
     }
 }
Пример #2
0
 public IEnumerator OvertimeEffect(BuffReceiver receiver)
 {
     while (true)
     {
         receiver.GetComponent <Health>().AddHp(heal);
         yield return(new WaitForSeconds(effectInterval));
     }
 }
Пример #3
0
    public virtual void OnTriggerEnter2D(Collider2D col)
    {
        BuffReceiver receiver = col.GetComponent <BuffReceiver>();

        if (receiver == null)
        {
            return;
        }
        players.Add(receiver.GetComponent <PlayerController>());
    }
    public override void Activate(BuffReceiver receiver)
    {
        base.Activate(receiver);
        receiver.GetComponent <SpriteRenderer>().color = color;
        ArcherCombat combat = receiver.GetComponent <ArcherCombat>();

        if (isActivated == true)
        {
            if (!receiver.GetComponent <ArcherCombat>())
            {
                return;
            }
            temp             = combat.objPrefab;
            combat.objPrefab = sapphireArrow;
            Debug.Log("Do" + this.name);
        }
        if (isActivated == false)
        {
            combat.objPrefab = temp;
            temp             = null;
            Debug.Log("Undo" + this.name);
        }
    }
Пример #5
0
    public override void Activate(BuffReceiver receiver)
    {
        PlayerController player = receiver.GetComponent <PlayerController>();

        base.Activate(receiver);
        receiver.GetComponent <SpriteRenderer>().color = color;
        if (isActivated == true)
        {
            speed              = player.playerSpeed;
            tempSpeed          = player.playerSpeed * slowModifier;
            player.playerSpeed = tempSpeed;

            tempModifier = player.GetComponent <Health>().fireModifier;
            player.GetComponent <Health>().fireModifier = damageModifier;
            Debug.Log("Do" + this.name);
        }
        if (isActivated == false)
        {
            player.playerSpeed = speed;
            tempSpeed          = 0;
            player.GetComponent <Health>().fireModifier += tempModifier;
            Debug.Log("Undo" + this.name);
        }
    }
Пример #6
0
    public override void Activate(BuffReceiver receiver)
    {
        PlayerController player = receiver.GetComponent <PlayerController>();

        base.Activate(receiver);
        receiver.GetComponent <SpriteRenderer>().color = color;
        if (isActivated == true)
        {
            Vector3 playerPos = player.transform.position;
            if (rubyLight != null)
            {
                tempLight = Instantiate(rubyLight, new Vector3(playerPos.x, playerPos.y, rubyLight.transform.position.z), rubyLight.transform.rotation, player.transform);
                //tempModifier = player.GetComponent<PlayerStats>().globalModifier;
                //player.GetComponent<PlayerStats>().globalModifier = damageModifier;
            }
            Debug.Log("Do" + this.name);
        }
        if (isActivated == false)
        {
            Destroy(tempLight);
            //player.GetComponent<PlayerStats>().globalModifier = tempModifier;
            Debug.Log("Undo" + this.name);
        }
    }
Пример #7
0
    public override void Activate(BuffReceiver receiver)
    {
        PlayerController player = receiver.GetComponent <PlayerController>();

        base.Activate(receiver);
        if (isActivated == true)
        {
            StartCoroutine(OvertimeEffect(receiver));
            StartCoroutine(Duration(receiver));
            Debug.Log("Do" + this.name);
        }
        if (isActivated == false)
        {
            StopCoroutine(OvertimeEffect(receiver));
            StopCoroutine(Duration(receiver));
            receiver.RemoveBuff(this);
            Debug.Log("Undo" + this.name);
        }
    }
Пример #8
0
    public void OnTriggerStay2D(Collider2D col)
    {
        if (buff == null)
        {
            return;
        }
        BuffReceiver receiver = col.gameObject.GetComponent <BuffReceiver>();

        if (receiver == null)
        {
            return;
        }
        if (receiver.GetComponent <PlayerController>().ID == 5)
        {
            return;
        }
        if (receiver.buffs.Any(p => p.ID == buff.ID) == false)
        {
            receiver.AddBuff(buff);
        }
    }
Пример #9
0
 public override void Activate(BuffReceiver receiver)
 {
     base.Activate(receiver);
     receiver.GetComponent <SpriteRenderer>().color = color;
 }