Beispiel #1
0
        protected override void OnAfterAction()
        {
            if (_PlayerName != GlobalPlayer.PlayerName)
            {
                if (_PlayerName != null)
                {
                    LayoutSet layout = new LayoutSet()
                    {
                        Anchor = DirectionType.TopLeft,
                        X      = Layout.Rectangle.Left + 5,
                        Y      = Layout.Rectangle.Top + 18,
                        Width  = Layout.Width - 10,
                        Height = 24
                    };

                    DrawUIText drawObject = new DrawUIText(Color.Maroon, Color.Gray, Color.Empty, Color.Empty, 0, 0, _PlayerName, new Font("標楷體", 16), GlobalFormat.MiddleCenter)
                    {
                        TextPadding = new Padding(0, 0, 0, 0)
                    };
                    ObjectBase oldName = new ObjectActive(layout, 0, LeagueType.None, drawObject, MoveNull.Value);
                    oldName.Propertys.Add(new PropertyDeadBrokenShaping(_PlayerName.Length * 50, 2, 2, ObjectDeadType.All, 360, 10, 20, Scene.Sec(0.3F), Scene.Sec(0.5F)));

                    _DrawNameAlpha = 0;
                    Container.Add(oldName);
                }
                _PlayerName = GlobalPlayer.PlayerName;
            }

            base.OnAfterAction();
        }
Beispiel #2
0
 /// <summary>
 /// 使用繪製物件和移動物件建立基本活動物件
 /// </summary>
 /// <param name="drawObject">繪製物件</param>
 /// <param name="moveObject">移動物件</param>
 public ObjectBase(DrawBase drawObject, MoveBase moveObject)
 {
     Layout     = new LayoutSet();
     Status     = ObjectStatus.Alive;
     League     = LeagueType.None;
     Life       = new CounterObject(-1);
     Propertys  = new PropertyCollection();
     DrawObject = drawObject;
     MoveObject = moveObject;
 }
Beispiel #3
0
 /// <summary>
 /// 使用指定的配置建立互動性活動物件
 /// </summary>
 /// <param name="layout">配置資訊</param>
 /// <param name="life">存活時間,小於0為永久</param>
 /// <param name="leage">物件所屬陣營,供技能或特性判定</param>
 /// <param name="drawObject">繪製物件</param>
 /// <param name="moveObject">移動物件</param>
 public ObjectActive(LayoutSet layout, int life, LeagueType leage, DrawBase drawObject, MoveBase moveObject)
     : this(drawObject, moveObject)
 {
     Layout.CollisonShape = layout.CollisonShape;
     Layout.Anchor        = layout.Anchor;
     Layout.X             = layout.X;
     Layout.Y             = layout.Y;
     Layout.Width         = layout.Width;
     Layout.Height        = layout.Height;
     League     = leage;
     Life.Limit = life;
 }
Beispiel #4
0
 /// <summary>
 /// 設定追蹤物件為指定位置配置物件
 /// </summary>
 /// <param name="layout">位置配置物件</param>
 public void SetObject(LayoutSet layout)
 {
     if (layout == null)
     {
         TargetType = TargetType.None;
         Object     = null;
     }
     else
     {
         TargetType = TargetType.Layout;
         Object     = layout;
     }
 }
Beispiel #5
0
        /// <summary>
        /// 發生於配置物件變更
        /// </summary>
        protected virtual void OnLayoutObjectChanged(LayoutSet oldValue, LayoutSet newValue)
        {
            if (oldValue != null)
            {
                oldValue.BindingUnlock();
                oldValue.Binding(Scene);
            }

            if (newValue != null)
            {
                newValue.Binding(this, true);
            }

            if (LayoutObjectChanged != null)
            {
                LayoutObjectChanged(this, oldValue, newValue);
            }
        }
 /// <summary>
 /// 取得物件AB是否碰撞
 /// </summary>
 /// <param name="layou1">物件配置A</param>
 /// <param name="layout2">物件配置B</param>
 /// <returns>是否碰撞</returns>
 public static bool IsCollison(LayoutSet layou1, LayoutSet layout2)
 {
     return(IsCollison(layou1.CollisonShape, layou1.Rectangle, layout2.CollisonShape, layout2.Rectangle));
 }
Beispiel #7
0
 /// <summary>
 /// 使用指定的配置新增虛擬物件,會逐漸縮小(放大)並淡出後消失
 /// </summary>
 /// <param name="layout">配置資訊</param>
 /// <param name="fadeTime">淡出時間(毫秒),小於0為永久</param>
 /// <param name="finelScale">計時器結束時大小比例</param>
 /// <param name="finelOpacity">計時器結束時透明度</param>
 /// <param name="drawObject">繪製物件</param>
 /// <param name="moveObject">移動物件</param>
 public ObjectSmoke(LayoutSet layout, int fadeTime, float finelScale, float finelOpacity, DrawBase drawObject, MoveBase moveObject)
     : this(layout.CenterX, layout.CenterY, layout.RectWidth, layout.RectHeight, fadeTime, finelScale, finelOpacity, drawObject, moveObject)
 {
 }
Beispiel #8
0
 /// <summary>
 /// 新增指定位置配置物件的目標管理物件
 /// </summary>
 /// <param name="layout">位置配置物件</param>
 public TargetSet(LayoutSet layout)
 {
     SetObject(layout);
 }
Beispiel #9
0
 /// <summary>
 /// 使用指定的配置新增虛擬物件,會逐漸縮小直到消失
 /// </summary>
 /// <param name="layout">配置資訊</param>
 /// <param name="diffusionWidth">擴散寬度</param>
 /// <param name="diffusionHeight">擴散高度</param>
 /// <param name="diffusionTime">擴散時間(毫秒)</param>
 /// <param name="fadeTime">消失時間(毫秒)</param>
 /// <param name="drawObject">繪製物件</param>
 /// <param name="moveObject">移動物件</param>
 public ObjectWave(LayoutSet layout, int diffusionWidth, int diffusionHeight, int diffusionTime, int fadeTime, DrawBase drawObject, MoveBase moveObject)
     : this(layout.CenterX, layout.CenterY, layout.RectWidth, layout.RectHeight, diffusionWidth, diffusionHeight, diffusionTime, fadeTime, drawObject, moveObject)
 {
 }
Beispiel #10
0
        public override void DoBeforeActionMove()
        {
            switch (Status)
            {
            case SkillStatus.Enabled:
            {
                if (Owner == null)
                {
                    Break();
                    return;
                }
                Status   = SkillStatus.Channeled;
                _MiniBar = new PropertyUI(-1, new Size(30, 6), new DrawUICounterBar(Color.FromArgb(160, 210, 100), Color.Black, Color.White, 1, true, Channeled));
                Owner.Propertys.Add(_MiniBar);
                PushSycle.Value = Scene.SceneIntervalOfRound;
                break;
            }

            case SkillStatus.Channeled:
                if (PushSycle.IsFull)
                {
                    LayoutSet checkRange = new LayoutSet()
                    {
                        CollisonShape = ShapeType.Ellipse,
                        Anchor        = DirectionType.Center,
                        X             = Owner.Layout.X,
                        Y             = Owner.Layout.Y,
                        Width         = Range,
                        Height        = Range
                    };

                    int hitCount = 0;
                    for (int i = 0; i < Owner.Container.Count; i++)
                    {
                        ObjectBase objectActive = Owner.Container[i];
                        if (objectActive == Owner)
                        {
                            continue;
                        }

                        // 範圍判定
                        if (!Function.IsCollison(objectActive.Layout, checkRange))
                        {
                            continue;
                        }

                        double angle     = Function.GetAngle(checkRange.CenterX, checkRange.CenterY, objectActive.Layout.CenterX, objectActive.Layout.CenterY);
                        double pushPower = PushPower * Function.GetDistance(checkRange.CenterX, checkRange.CenterY, objectActive.Layout.CenterX, objectActive.Layout.CenterY) / Range;
                        objectActive.MoveObject.AddToNextOffset(objectActive.MoveObject.GetOffsetByAngle(angle, PushPower));
                        hitCount++;
                    }

                    if (hitCount > 0)
                    {
                        if (hitCount > 4)
                        {
                            hitCount = 4;
                        }
                        SceneGaming scene = Scene as SceneGaming;
                        if (scene != null)
                        {
                            scene.AddScoreToPlayer("震盪衝擊", hitCount * 15);
                        }
                    }

                    Color      waveColor = Color.FromArgb(150, Owner.DrawObject.MainColor);
                    ObjectWave wave      = new ObjectWave(0, 0, 0, 0, Range, Range, Scene.Sec(0.15F), Scene.Sec(0.1F), new DrawPen(waveColor, ShapeType.Ellipse, 1), MoveNull.Value);
                    wave.Layout.Depend.SetObject(Owner);
                    wave.DiffusionOpacity = 0.1F;
                    wave.FadeOpacity      = 0.5F;
                    Owner.Container.Add(wave);
                    PushSycle.Value = 0;
                }
                else
                {
                    PushSycle.Value += Scene.SceneIntervalOfRound;
                }
                break;
            }

            base.DoBeforeActionMove();
        }