Esempio n. 1
0
        public void OnAwake()
        {
            _canvas = SceneObject.Instantiate <Canvas>(null);

            _levelManager = new LevelManager(_canvas);
            _levelManager.Add <EntitiesLevel>(EntitiesLevel);
            _levelManager.Add <ParticlesLevel>(ParticlesLevel);
            _levelManager.Add <EarthquakeLevel>(EarthquakeLevel);
            _levelManager.Add <RaycastLevel>(RaycastLevel);

            var changeLevelPrompt = SceneObject.Instantiate <TextElement>(_canvas);

            changeLevelPrompt.RectTransform.Size      = new Point(Screen.Width, 40f);
            changeLevelPrompt.RectTransform.Padding   = new Padding(-40f, -20f);
            changeLevelPrompt.RectTransform.Alignment = Alignment.BottomHStretch;
            changeLevelPrompt.Text.Alignment          = Alignment.Right;
            changeLevelPrompt.Text.Height             = 20;
            changeLevelPrompt.Text.Content            = string.Format("Press {0} to change level.", _changeLevelKey.ToString().Substring(4));

            if (!Env.IsSandbox)
            {
                Input.OnKey += Input_OnKey;
                _levelManager.LoadLevel(_defaultLevel);
            }
        }
        public void Setup()
        {
            LevelManager.Clear();
            int id = LevelManager.Add("level_test", "XEX\nXOX\nXSX", new Block[] { Block.Move });

            LevelManager.Load(id);
        }
Esempio n. 3
0
        public void AddingLevelAndRetrievingDataIsExpectedValue_ReturnsTrue()
        {
            string name = "test";
            int    id   = LevelManager.Add(name, "XEX\nXOX\nXSX", new Block[] { Block.Move });

            Assert.IsTrue(name == LevelManager.GetNameForID(id));
        }
Esempio n. 4
0
        public void TestAddingACustomLevelAndLoadingIt_ReturnsTrue()
        {
            string name = "test";
            int    id   = LevelManager.Add(name, "XEX\nXOX\nXSX", new Block[] { Block.Move });

            LevelManager.Load(id);
            Assert.IsTrue(LevelManager.GetName() == LevelManager.GetNameForID(id));
        }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     if (healthscript.health <= 0)
     {
         if (isTower)
         {
             Destroy(gameObject);
             tiletakenscript.TileTakensSetFalse();
         }
         else
         {
             moneyscript.money += enemyscript.worth;
             Destroy(gameObject);
             levelmanmagerscript.Add(100);
         }
     }
 }
Esempio n. 6
0
        public ActionResult CreateEntity(LevelInfo model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(
                           new OperateResult
                {
                    content = Model.Utility.GetModelStateErrors(ModelState),
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }


            OperateResult or = LevelManager.Add(model);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public bool LevelAddStub()
        {
            for (var i = 0; i < LevelStubSize; i++)
            {
                LevelInfo e = new LevelInfo();

                e.name                  = "LevelInfo-" + i;
                e.code                  = "Level-" + i;
                e.levelSalary           = 2000 + i * 500;
                e.fullAttendanceRewards = 100 + i * 50;
                e.seniorityRewardsBase  = 200;

                OperateResult or = LevelManager.Add(e);
                if (or.status == OperateStatus.Error)
                {
                    StackTrace st  = new StackTrace(new StackFrame(true));
                    string     msg = $"App Trace >>> in file: {st.GetFrame(0).GetFileName()} " +
                                     $"line {st.GetFrame(0).GetFileLineNumber()} message: {or.content}";
                    Trace.WriteLine(msg);
                    return(false);
                }
            }
            return(true);
        }
 public void Setup()
 {
     world = new World();
     manager = new LevelManager(world);
     manager.Add(levels[0]);
 }