Esempio n. 1
0
 public AoeField(UnitBase caster, AoeRegion region, float duration, float interval, List <BuffEmitter> emitters)
 {
     Caster      = caster;
     mRegion     = region;
     Interval    = interval;
     Duration    = duration;
     mElapseTime = 0;
     mCdTime     = 0;
     for (int i = 0; i < emitters.Count; ++i)
     {
         emitters[i].Caster = caster;
     }
     BuffEmitters = emitters;
 }
Esempio n. 2
0
        public override bool Execute(float dt)
        {
            float x, y;

            if (userInput)
            {
                if (mSkill.inputX > 0 || mSkill.inputY > 0)
                {
                    x = mSkill.inputX;
                    y = mSkill.inputY;
                }
                else
                {
                    if (mSkill.target == null)
                    {
                        return(true);
                    }
                    x = mSkill.target.position.x;
                    y = mSkill.target.position.y;
                }
            }
            else
            {
                if (mSkill.target == null)
                {
                    return(true);
                }
                x = mSkill.target.position.x;
                y = mSkill.target.position.y;
            }
            AoeRegion region = null;

            switch (type)
            {
            case RegionType.kCircle:
            {
                region = new CircleRegion(BattleInterface.Instance.world, x, y, radius);
            }
            break;

            case RegionType.kRect:
            {
                var dx = x - mSkill.Owner.position.x;
                var dy = y - mSkill.Owner.position.y;
                region = new RectRegion(BattleInterface.Instance.world, mSkill.Owner.position.x, mSkill.Owner.position.y, dx, dy, width, height);
            }
            break;

            case RegionType.kSector:
            {
                var dx = x - mSkill.Owner.position.x;
                var dy = y - mSkill.Owner.position.y;
                region = new SectorRegion(BattleInterface.Instance.world, mSkill.Owner.position.x, mSkill.Owner.position.y, dx, dy, radius, theta);
            }
            break;
            }
            AoeField aoe = new AoeField(mSkill.Owner, region, duration, interval, emitters);

#if DEBUG
            Debug.LogFormat("unit {0} skill {1} AddAoeField at {2},{3}", mSkill.Owner.ID, mSkill.TemplateID, x, y);
#endif
            BattleInterface.Instance.AddAoeField(aoe);
            return(true);
        }