Пример #1
0
        public static void StartFlagTest(StartFlag startFlag)
        {
            var instance            = new EditorIniData();
            var changedPropertyList = new List <string>();

            instance.PropertyChanged += (sender, args) => { changedPropertyList.Add(args.PropertyName); };

            var errorOccured = false;

            try
            {
                instance.StartFlag = startFlag;
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーが発生しないこと
            Assert.IsFalse(errorOccured);

            var setValue = instance.StartFlag;

            // セットした値と取得した値が一致すること
            Assert.IsTrue(setValue.Equals(startFlag));

            // 意図したとおりプロパティ変更通知が発火していること
            Assert.AreEqual(changedPropertyList.Count, 1);
            Assert.IsTrue(changedPropertyList[0].Equals(nameof(EditorIniData.StartFlag)));
        }
Пример #2
0
        public static void ToIntTest(int value)
        {
            var instance = new StartFlag(value);

            var intValue = instance.ToInt();

            // セットした値と取得した値が一致すること
            Assert.AreEqual(intValue, value);
        }
        public void Manually_triggered_start_throws_on_missing_dependencies()
        {
            var flag = new StartFlag();

            Startable.Started = false;
            Container.AddFacility <StartableFacility>(f => f.DeferredStart(flag));
            Container.Register(Component.For <Startable>());

            Assert.Throws <HandlerException>(() =>
                                             flag.Signal()
                                             );
        }
        public void Can_manually_trigger_start_only_once()
        {
            var flag = new StartFlag();

            Startable.Started = false;
            Container.AddFacility <StartableFacility>(f => f.DeferredStart(flag));
            Container.Register(Component.For <Startable>().LifestyleTransient(),
                               Component.For <ICustomer>().ImplementedBy <CustomerImpl>());

            flag.Signal();
            Startable.Started = false;
            flag.Signal();
            Assert.IsFalse(Startable.Started);
        }
Пример #5
0
        public static void ConstructorIntTest(int value, bool isError)
        {
            var errorOccured = false;

            try
            {
                var _ = new StartFlag(value);
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーフラグが一致すること
            Assert.AreEqual(errorOccured, isError);
        }
        public void Can_manually_trigger_start_when_using_Install()
        {
            var flag = new StartFlag();

            Startable.Started = false;
            Container.AddFacility <StartableFacility>(f => f.DeferredStart(flag));
            Container.Install(
                new ActionBasedInstaller(c => c.Register(Component.For <Startable>(),
                                                         Component.For <ICustomer>().ImplementedBy <CustomerImpl>()))
                );

            Assert.IsFalse(Startable.Started);

            flag.Signal();

            Assert.IsTrue(Startable.Started);
        }
Пример #7
0
        public void CreateNewGameObject(Transform transform)
        {
            LevelGameObject result = null;

            lock (instanceMutationLock) {
                if (objTypRad_startFlag.Checked)
                {
                    result = new StartFlag(currentLevel, currentLevel.GetNewGameObjectID());
                }
                else if (objTypRad_dynamicLight.Checked)
                {
                    result = new DynamicLight(currentLevel, currentLevel.GetNewGameObjectID());
                }
                else if (objTypRad_introCam.Checked)
                {
                    result = new IntroCameraAttracter(currentLevel, currentLevel.GetNewGameObjectID());
                }
                else if (objTypRad_finishingBell.Checked)
                {
                    result = new FinishingBell(currentLevel, currentLevel.GetNewGameObjectID());
                }
                else if (objTypRad_vultureEgg.Checked)
                {
                    result = new VultureEgg(currentLevel, currentLevel.GetNewGameObjectID());
                }
                else if (objTypRad_lizardCoin.Checked)
                {
                    result = new LizardCoin(currentLevel, currentLevel.GetNewGameObjectID());
                }
                else if (objTypRad_Nothing.Checked)
                {
                    return;
                }

                Assure.NotNull(result);

                result.Transform = transform;
                currentLevel.AddGameObject(result);
                currentLevel.ResetGameObjects();
                UpdateObjectList();
                objectList.SelectedItem = result;
            }
        }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        canSwitchPlayers = true;

        initPlayer             = FindObjectOfType <PlayerController>();
        initPlayer.objectColor = Color.white;

        startFlag = FindObjectOfType <StartFlag>();

        initPlayer.transform.position = startFlag.transform.position;


        Debug.Log("player.objectColor");

        cameraFollow = FindObjectOfType <Camera2DFollow>();

        curPlayer = "Player" + numberOfPlayers;

        initPlayer.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.None;
        initPlayer.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
    }
Пример #9
0
        public static void CastStartFlagToIntTest(int value)
        {
            var castValue = 0;

            var instance = new StartFlag(value);

            var errorOccured = false;

            try
            {
                castValue = instance;
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーが発生しないこと
            Assert.IsFalse(errorOccured);

            // 元の値と一致すること
            Assert.AreEqual(castValue, value);
        }
Пример #10
0
 public static MCACommand Start(StartFlag startFlags, bool trigger1Active, bool trigger2Active,
                             bool trigger3Active, uint startTime)
 {
     // bit 15 : trigger 1 => 0b1000 0000 0000 0000 => 0x8000
     // bit 14 : trigger 2 => 0x4000
     // bit 13 : trigger 3 => 0x2000
     ushort flags = (ushort)((ushort)startFlags | (trigger1Active ? 0x8000 : 0x0000) |
         (trigger2Active ? 0x4000 : 0x0000) | (trigger3Active ? 0x20000 : 0x0000));
     return new MCACommand(CommandName.CMD_START, flags, startTime);
 }
Пример #11
0
 public ProcessBuilder()
 {
     flags   |= CreateProcessFlags.CreateUnicodeEnvironment;
     stf     |= StartFlag.UseStdHandles;
     encoding = Encoding.UTF8;
 }