예제 #1
0
 /// <summary>
 /// オブジェクトがレイヤーに登録されたときに実行されるイベントを追加する。
 /// </summary>
 /// <exception cref="ArgumentNullException"></exception>
 public static void AddOnAddedEvent(this asd.Object2D obj, Action action)
 {
     if (action == null)
     {
         throw new ArgumentNullException("action");
     }
     obj.GetObject2DComponent().OnAddedEvent += _ => action();
 }
예제 #2
0
 protected override void OnUpdating()
 {
     if(Time % 2 == 0)
     {
         var temp = obj;
         obj = new asd.TextureObject2D();
         layer.AddObject(obj);
         obj.AddComponent(new VanishingComponent(temp, 3), "v");
     }
 }
예제 #3
0
        protected override void OnStart()
        {
            var scene = new asd.Scene();
            layer = new asd.Layer2D();
            obj = new asd.TextureObject2D();

            asd.Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);
        }
예제 #4
0
 protected override void OnUpdating()
 {
     if (Time % 2 == 0)
     {
         var temp = obj;
         obj = new asd.TextureObject2D();
         layer.AddObject(obj);
         obj.AddComponent(new VanishingComponent(temp, 3), "v");
     }
 }
예제 #5
0
        protected override void OnStart()
        {
            var scene = new asd.Scene();

            layer = new asd.Layer2D();
            obj   = new asd.TextureObject2D();

            asd.Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);
        }
예제 #6
0
        private static Object2DComponent <asd.Object2D> GetObject2DComponent(this asd.Object2D obj)
        {
            var component = (Object2DComponent <asd.Object2D>)obj.GetComponent(ComponentName);

            if (component == null)
            {
                component = new Object2DComponent <asd.Object2D>(ComponentName);
                component.Attach(obj);
            }

            return(component);
        }
예제 #7
0
        /// <summary>
        /// コルーチンを管理するクラスを取得する。
        /// </summary>
        public static CoroutineManager CoroutineManager(this asd.Object2D obj)
        {
            var component = (CoroutineComponent)obj.GetComponent(CoroutineComponentName);

            if (component == null)
            {
                component = new CoroutineComponent();
                obj.AddComponent(component, CoroutineComponentName);
            }

            return(component.Coroutine);
        }
예제 #8
0
 /// <summary>
 /// Object2Dコレクションの変更
 /// </summary>
 /// <param name="layer">Object2Dをもつレイヤー</param>
 /// <param name="object2D">Object2D</param>
 /// <param name="isAdd">加えたか</param>
 public static void ChangeObject2D(asd.Layer2D layer, asd.Object2D object2D, bool isAdd)
 {
     if (!Enable)
     {
         return;
     }
     if (isAction)
     {
         isAction = false;
         return;
     }
     UndoStack.Push(new Object2DChangedCommand(layer, object2D, isAdd));
     RedoStack.Clear();
     OnUpdateData();
 }
예제 #9
0
        //衝突判定
        public void ColligeWith(asd.Object2D obj)
        {
            if (obj == null)
            {
                return;
            }

            if (obj is Wall)
            {
                if (ShapeOfCollige.GetIsCollidedWith(((Wall)obj).ShapeOfCollige))
                {
                    HP = 0;
                }
            }
            else if (obj is Cloud)
            {
                if (ShapeOfCollige.GetIsCollidedWith(((Cloud)obj).ShapeOfCollige))
                {
                    HP += -1;
                }
            }
            else if (obj is Rain)
            {
                if (ShapeOfCollige.GetIsCollidedWith(((Rain)obj).ShapeOfCollige))
                {
                    HP += -1;
                    obj.Dispose();
                }
            }
            else if (obj is Healer)
            {
                if (ShapeOfCollige.GetIsCollidedWith(((Healer)obj).ShapeOfCollige))
                {
                    HP += 10;
                    obj.Dispose();
                }
            }
            else if (obj is Wind)
            {
                if (ShapeOfCollige.GetIsCollidedWith(((Wind)obj).ShapeOfCollige))
                {
                    WindCount += 20;
                    obj.Dispose();
                }
            }
        }
예제 #10
0
 public bool NeedToDelete(asd.Object2D o)
 {
     if (o is Obstacle_Fever)
     {
         if (o.IsAlive && isFever == false)
         {
             return(true);
         }
     }
     else if (o is StraightObstacles)
     {
         if (o.IsAlive && isFever == true)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #11
0
        protected override void OnUpdated()
        {
            //-----playerやられたらgameover
            if (!isSceneChangeing && !player.IsAlive)
            {
                asd.Engine.ChangeSceneWithTransition(new GameOverScene(score), new asd.TransitionFade(1.0f, 1.0f));
                isSceneChangeing = true;
            }
            else
            {
                count++; // countを上げる。

                //-----Fevermodeの時に仕様をごっそり変える。
                if (isFever)
                {
                    FeverMode();
                }
                else
                {
                    NormalMode();
                }

                //-----スコア表示
                score = asd.MathHelper.Clamp(score, 999999999, 0);
                scoreWindow.point.Text = score.ToString("D9");
                //            scoreWindow.point.Text = String.Format("{0:D9}",score);  //---先輩にいろいろ書き方を教わったよ!---
                //            scoreWindow.point.Text = $"{score:D9}";
            }

            foreach (var obj in layer.Objects)
            {
                if (NeedToDelete(obj))
                {
                    emptyObj = obj;
                }
            }

            if (emptyObj != null)
            {
                emptyObj.Dispose();
            }
        }
예제 #12
0
 public Object2DChangedCommand(asd.Layer2D layer, asd.Object2D object2D, bool isAdd)
 {
     Layer    = layer;
     Object2D = object2D;
     IsAdd    = isAdd;
 }
예제 #13
0
 public VanishingComponent(asd.Object2D vanishedObject, int etime)
 {
     this.vanishedObject = vanishedObject;
     this.etime = etime;
 }
예제 #14
0
 public VanishingComponent(asd.Object2D vanishedObject, int etime)
 {
     this.vanishedObject = vanishedObject;
     this.etime          = etime;
 }