示例#1
0
        public GameObjectViewModel AddEnemyAtRandomPosition()
        {
            var left  = this.Width;
            var top   = rand.Next(0, (int)this.Height - 150);
            var enemy = new EnemyViewModel(top, left);

            return(enemy);
        }
示例#2
0
        public IActionResult Add()
        {
            EnemyViewModel model = new EnemyViewModel {
                Id   = -1,
                Name = "New Enemy Name"
            };

            return(View(model));
        }
示例#3
0
 /// <summary>
 /// This method loads the combat page and spawns 3 enemy's.
 /// </summary>
 /// <returns></returns>
 public ActionResult Combat()
 {
     if ((EnemyViewModel)Session["evm"] == null)
     {
         _enemyViewModel.EnemyList = new List <Enemy>();
         for (int i = 0; i < 3; i++)
         {
             _enemyViewModel.EnemyList.Add(new Enemy(10, "Goblin", 200, 50, 9, 10));
         }
         Session["evm"] = _enemyViewModel;
     }
     _enemyViewModel = (EnemyViewModel)Session["evm"];
     return(View("Combat", _enemyViewModel));
 }
示例#4
0
        public IActionResult Edit(EnemyViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            _enemyServices.Update(new Enemy {
                Id = model.Id, Name = model.Name
            });
            //GetById(model.Id).Name = model.Name;

            return(RedirectToAction("Index", "Enemy"));
        }
示例#5
0
 public override Enemy GetDataByViewModel(EnemyViewModel model)
 {
     return(new Enemy()
     {
         EnemyId = model.EnemyId,
         AttackMax = model.AttackMax.Value,
         AttackMin = model.AttackMin.Value,
         CharacterTypeId = model.CharacterTypeId.Value,
         InitialX = model.InitialX.Value,
         InitialY = model.InitialY.Value,
         LastMoviment = model.LastMoviment.Value,
         CurrentLife = model.CurrentLife.Value,
         MaxLife = model.MaxLife.Value,
         SpeedRun = model.SpeedRun.Value,
         SpeedWalk = model.SpeedWalk.Value,
     });
 }
示例#6
0
        public IActionResult Edit(int id)
        {
            var model = _enemyServices.GetById(id);

            EnemyViewModel viewModel = new EnemyViewModel
            {
                Id   = model.Id,
                Name = model.Name
            };

            if (model == null)
            {
                return(NotFound());
            }

            return(View(viewModel));
        }
示例#7
0
        public ActionResult Damageunit(int dmg, int id)
        {
            _enemyViewModel = (EnemyViewModel)Session["evm"];
            if (id == 1)
            {
                _enemyViewModel.EnemyList[0].Health = _enemyViewModel.EnemyList[0].Health - 50;
            }
            else if (id == 2)
            {
                _enemyViewModel.EnemyList[1].Health = _enemyViewModel.EnemyList[1].Health - 50;
            }
            else if (id == 3)
            {
                _enemyViewModel.EnemyList[2].Health = _enemyViewModel.EnemyList[2].Health - 50;
            }

            return(View("Combat", _enemyViewModel));
        }
    public override void InitializeEnemy(EnemyViewModel viewModel) {
        base.InitializeEnemy(viewModel);
        // This is called when a EnemyViewModel is created
		viewModel.Physique = 100;
		viewModel.HitPoint = 80;
		viewModel.Dodge = 50;
		viewModel.WeaponProficiency = 90;
		viewModel.Health = 2000;
		viewModel.AttackSpeed  = 4;
		viewModel.InitialMorale =  80;
		viewModel.moraleStandard = 70;
		viewModel.Prestige = 100;
		//viewModel.Weapon = new Weapons {Weight = 2,OtherHit = 50, CriticalHit = 30, FatalHit = 20, Sharpness = 90, IsSharp = true};
		//viewModel.Armor = new Armors {Weight = 2, OtherCover = 30, CriticalCover = 30, FatalCover = 30, Hardness =30};
		//viewModel.Shield = new Shields{Weight = 0 , BlockRate = 0, Hardness =0};
		//viewModel.Formation = new Formations {HitPoint = 10, Dodge = 10, Morale =5};
		//Debug.Log(viewModel.Weapon);
    }
示例#9
0
 public void WalkTowardTo(Transform _transform, ref EnemyViewModel model)
 {
     if (fow.visibleTargets.Contains(target))
     {
         if (target == null)
         {
             return;
         }
         _transform.position = Vector3.MoveTowards(_transform.position, target.transform.position, enemyFunctions.GetModelById(id).SpeedWalk.Value *Time.deltaTime);
         fow.TurnView(target);
         model.LastMoviment = GetDirection(_transform.position, target.position);
         canAttack          = false;
     }
     else
     {
         canAttack = false;
         target    = null;
     }
 }
示例#10
0
        public IActionResult Add(EnemyViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            //var newid = _enemyServices.GetAll().OrderByDescending(e => e.Id).First().Id + 1;

            Enemy newenemy = new Enemy
            {
                //Id = newid,
                Name       = model.Name,
                EnemyItems = new List <EnemyItem>()
            };

            _enemyServices.Add(newenemy);

            return(RedirectToAction("Index", "Enemy"));
        }
示例#11
0
 public void Init(EnemyViewModel enemyViewModel)
 {
     presenter.Init(enemyViewModel);
 }
 public virtual void InitializeEnemy(EnemyViewModel viewModel) {
     // This is called when a EnemyViewModel is created
     EnemyViewModelManager.Add(viewModel);
 }
示例#13
0
 public void Init(EnemyViewModel enemyViewModel)
 {
     this.enemyViewModel = enemyViewModel;
 }