Beispiel #1
0
        /// <summary>
        /// 技能生效
        /// </summary>
        public override void DoBeforeAction()
        {
            switch (Status)
            {
                case SkillStatus.Enabled:
                    {
                        if (Owner == null)
                        {
                            Break();
                            return;
                        }

                        double angle = Function.GetAngle(0, 0, Owner.MoveObject.MoveX, Owner.MoveObject.MoveY);
                        _OwnerSpeed = Owner.MoveObject.Speed;
                        _OwnerTarget = Owner.MoveObject.Target.Object;

                        Owner.MoveObject.Target.ClearObject();
                        //Owner.MoveObject.Target.SetOffsetByAngle(angle, 100);
                        Owner.MoveObject.Speed = 20;

                        Status = SkillStatus.Channeled;
                        Cursor.Position = Scene.PointToScreen(new Point((int)Owner.Layout.CenterX, (int)Owner.Layout.CenterY));
                    }
                    break;
            }
            base.DoBeforeAction();
        }
Beispiel #2
0
 /// <summary>
 /// 發生於目標變更
 /// </summary>
 protected void OnTargetObjectChanged(ITargetability oldValue, ITargetability newValue)
 {
     if (TargetObjectChanged != null)
     {
         TargetObjectChanged(this, oldValue, newValue);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 發生於依附目標變更
 /// </summary>
 protected virtual void OnDependObjectChanged(ITargetability oldValue, ITargetability newValue)
 {
     if (DependObjectChanged != null)
     {
         DependObjectChanged(this, oldValue, newValue);
     }
 }
Beispiel #4
0
 protected override void OnTargetObjectChanged(ITargetability oldValue, ITargetability newValue)
 {
     if (Target.TargetType != TargetType.GameObejct)
     {
         Target.ClearObject();
     }
     base.OnTargetObjectChanged(oldValue, newValue);
 }
Beispiel #5
0
 /// <summary>
 /// 基本移動物件建構式
 /// </summary>
 /// <param name="Target">追蹤目標</param>
 /// <param name="weight">阻力,最終移動速度會受到此值影響(finalSpeed = speeed/Weight)</param>
 /// <param name="speed">總體移動速度最大值(排除阻力影響)</param>
 /// <param name="offsetsLimit">移動調整值列表最大數量</param>
 public MoveBase(ITargetability target, float weight, float speed, int offsetsLimit)
 {
     Offsets               = new List <PointF>();
     OffsetsLimit          = offsetsLimit;
     Resistance            = weight;
     Speed                 = speed;
     Target                = new TargetSet(target);
     Target.ObjectChanged += (s, o, n) => { OnTargetObjectChanged(o, n); };
 }
Beispiel #6
0
        /// <summary>
        /// 發生於技能施放時
        /// </summary>
        /// <param name="target">技能目標</param>
        protected virtual void OnStart(ITargetability target)
        {
            Status = SkillStatus.Enabled;
            Target.SetObject(target);

            if (Start != null)
            {
                Start(this, new EventArgs());
            }
        }
 /// <summary>
 /// 新增陰影特性,物件下方產生陰影
 /// </summary>
 /// <param name="target">光源目標</param>
 /// <param name="offsetRatioX">陰影位置X軸偏移比例</param>
 /// <param name="offsetRatioY">陰影位置Y軸偏移比例</param>
 /// <param name="scaleX">陰影寬度縮放</param>
 /// <param name="scaleY">陰影高度縮放</param>
 /// <param name="opacity">陰影不透明度</param>
 public PropertyShadowReflected(ITargetability target, float offsetRatioX, float offsetRatioY, float scaleX = 1, float scaleY = 1, float opacity = 0.2F)
 {
     OffsetRatioX = offsetRatioX;
     OffsetRatioY = offsetRatioY;
     ScaleX       = scaleX;
     ScaleY       = scaleY;
     Opacity      = opacity;
     RFix         = -1;
     GFix         = -1;
     BFix         = -1;
     Target.SetObject(target);
     BreakAfterDead = false;
 }
Beispiel #8
0
        /// <summary>
        /// 使用技能
        /// </summary>
        /// <param name="target">技能目標</param>
        public virtual void Cast(ITargetability target)
        {
            if (Owner == null)
            {
                return;
            }

            switch (Status)
            {
            case SkillStatus.Channeled:
                Recast(target);
                break;

            case SkillStatus.Disabled:
                if (Owner.Status == ObjectStatus.Alive && Owner.Energy.Value > CostEnergy)
                {
                    Owner.Energy.Value -= CostEnergy;
                    OnStart(target);
                }
                break;
            }
        }
Beispiel #9
0
 public override void Release(ITargetability target)
 {
     if (Status == SkillStatus.Channeled)
     {
         PointF targetPoint = Scene.GetTargetPoint(DirectionType.Center);
         double angle = Function.GetAngle(Owner.Layout.CenterX, Owner.Layout.CenterY, targetPoint.X, targetPoint.Y);
         float partAngle = Radiation / (float)BulletCount;
         float shotAngle = (float)angle - (partAngle * BulletCount / 2);
         for (int i = 0; i < BulletCount; i++)
         {
             MoveStraight bulletMove = new MoveStraight(null, 1, 600, 1, 0, 1);
             ObjectActive bullet = new ObjectActive(Owner.Layout.CenterX, Owner.Layout.CenterY, 5, 5, Scene.Sec(0.5F), Owner.League, ShapeType.Ellipse, new DrawBrush(Owner.DrawObject.MainColor, ShapeType.Ellipse), bulletMove);
             bullet.Propertys.Add(new PropertyCollision(AttackPower));
             bullet.Propertys.Add(new PropertyDeadBroken(5, 2, 2, ObjectDeadType.All, 360, 40, 100, Scene.Sec(0.2F), Scene.Sec(0.3F)));
             bulletMove.Target.SetOffsetByAngle(shotAngle, 1000);
             bulletMove.Target.SetObject(bullet);
             bullet.Dead += (s, k, t) =>
             {
                 if (t == ObjectDeadType.Collision)
                 {
                     SceneGaming scene = Scene as SceneGaming;
                     if (scene != null)
                     {
                         scene.AddScoreToPlayer("擊中", 150);
                     }
                 }
             };
             Owner.Container.Add(bullet);
             shotAngle += partAngle;
         }
         Owner.MoveObject.AddToNextOffset(Function.GetOffsetPoint(0, 0, angle + 180, 500));
         Cursor.Position = Scene.PointToScreen(new Point((int)Owner.Layout.CenterX, (int)Owner.Layout.CenterY));
         Status = SkillStatus.Cooldown;
         OnEnd(SkillEndType.Finish);
     }
     base.Release(target);
 }
Beispiel #10
0
 /// <summary>
 /// 設定追蹤物件為指定物件
 /// </summary>
 /// <param name="point">指定物件</param>
 public void SetObject(ITargetability target)
 {
     if (target is SceneBase)
     {
         TargetType = TargetType.Scene;
     }
     else if (target is ObjectBase)
     {
         TargetType = TargetType.GameObejct;
     }
     else if (target is LayoutSet)
     {
         TargetType = TargetType.Layout;
     }
     else if (target is PointObject)
     {
         TargetType = TargetType.Point;
     }
     else
     {
         TargetType = TargetType.None;
     }
     Object = target;
 }
Beispiel #11
0
 public override void Recast(ITargetability target)
 {
     Break();
     base.Recast(target);
 }
Beispiel #12
0
 /// <summary>
 /// 建立蛙行移動物件,依規律時間移動
 /// </summary>
 /// <param name="target">追蹤目標</param>
 /// <param name="weight">阻力,最終移動速度會受到此值影響(finalSpeed = speeed/Weight)</param>
 /// <param name="speed">移動速度,決定每個移動調整值的最大距離</param>
 /// <param name="offsetsLimit">移動調整值列表最大數量</param>
 public MoveFrog(ITargetability target, float weight, float speed, int offsetsLimit, int moveTime)
     : base(target, weight, speed, offsetsLimit)
 {
     _MoveTime = new CounterObject(moveTime);
 }
Beispiel #13
0
 /// <summary>
 /// 當技能生效時又使用技能時的動作
 /// </summary>
 public virtual void Recast(ITargetability target)
 {
 }
Beispiel #14
0
 /// <summary>
 /// 停止使用技能時的動作(放開)
 /// </summary>
 public virtual void Release(ITargetability target)
 {
 }
Beispiel #15
0
 /// <summary>
 /// 建立玩家專屬移動物件
 /// </summary>
 /// <param name="target">追蹤目標</param>
 /// <param name="weight">阻力,最終移動速度會受到此值影響(finalSpeed = speeed/Weight)</param>
 /// <param name="speed">移動速度,決定每個移動調整值的最大距離</param>
 /// <param name="offsetsLimit">移動調整值列表最大數量</param>
 public MovePlayer(ITargetability target, float weight, float speed, int offsetsLimit)
     : base(target, weight, speed, offsetsLimit)
 {
 }
Beispiel #16
0
 /// <summary>
 /// 新增指定目標的目標管理物件
 /// </summary>
 /// <param name="targetObject">目標物件</param>
 public TargetSet(ITargetability targetObject)
 {
     SetObject(targetObject);
 }
Beispiel #17
0
 /// <summary>
 /// 建立直行移動物件,靠近目標後會依距離減緩速度
 /// </summary>
 /// <param name="target">追蹤目標</param>
 /// <param name="weight">阻力,最終移動速度會受到此值影響(finalSpeed = speeed/Weight)</param>
 /// <param name="speed">移動速度,決定每個移動調整值的最大距離</param>
 /// <param name="offsetsLimit">移動調整值列表最大數量</param>
 /// <param name="closeRange">定義鄰近距離,與目標距離小於此值會開始減速</param>
 /// <param name="closeSpeedSlow">進入鄰近範圍後,移動速度降低比例最大值,速度比例=1-(CloseSpeedSlow * (CloseRange-Distance)/CloseRange)</param>
 public MoveStraight(ITargetability target, float weight, float speed, int offsetsLimit, float closeRange, float closeSpeedSlow)
     : base(target, weight, speed, offsetsLimit)
 {
     CloseRange     = closeRange;
     CloseSpeedSlow = closeSpeedSlow;
 }