コード例 #1
0
        void beacon()
        {
            BeaconTurretBuff turretBuff = new BeaconTurretBuff(beaconID, 1f, beaconTurretFireRate.get(),
                                                               beaconTurretRange.get(), beaconTurretDamage.get(), beaconTurretLaserDOT.get(), beaconTurretFireDOT.get());

            BeaconMinionBuff minionBuff = new BeaconMinionBuff(beaconID, 3f, beaconMinionDamage.get(), beaconMinionMovespeed.get());

            Collider[] cols = Physics.OverlapSphere(this.transform.position, range.get());
            foreach (Collider col in cols)
            {
                if (col.tag.Equals(beaconTurretTag) && col.gameObject != this.gameObject)
                {
                    if (col.GetComponent <Turret>().towerType != Turret.TowerType.Beacon)
                    {
                        turretBuff.copy().apply(col.transform);
                    }
                }
                if (col.tag.Equals(beaconMinionTag) && col.gameObject != this.gameObject)
                {
                    minionBuff.copy().apply(col.transform);
                    Minion m = col.GetComponent <Minion>();
                    m.takeDamage(-beaconMinionHeal.get() / 100f * m.health.getMissing() / .5f, this.gameObject, true);
                }
                if (col.tag.Equals("Player") && isPlayer)
                {
                    col.GetComponent <Damageable>().takeDamage(-beaconPlayerHeal.get() / 100f * col.GetComponent <Player>().health.getMissing() / .5f, this.gameObject, true);
                }
            }
        }
コード例 #2
0
        public void apply(Component target)
        {
            startTime = Time.time;
            minion    = target.GetComponent <Minion>();

            List <Buff> buffsToRemove = new List <Buff>();

            foreach (Buff b in minion.buffs)
            {
                if (b is BeaconMinionBuff)
                {
                    BeaconMinionBuff sb = (BeaconMinionBuff)b;
                    if (this.id == sb.id)
                    {
                        buffsToRemove.Add(sb);
                    }
                }
            }

            buffsToRemove.ForEach(buff => buff.finish());

            minion.addBuff(this);
        }