Ejemplo n.º 1
0
        public void Test_ChangeLocation()
        {
            var        model    = new MockRoyalGameModel();
            GameObject zone     = new GameObject(model, TypesGameObject.DeathZone, TypesBehaveObjects.Passive);
            BodyZone   bodyZone = new BodyZone(zone, 500);

            zone.Components.Add(bodyZone);
            zone.Setup();

            PointF startLocation = bodyZone.Location;
            float  radius        = bodyZone.Radius;

            zone.Update(new TimeQuantPassed(30001));

            Assert.AreEqual(model.outgoingMessages.Count, 2);
            Assert.AreNotEqual(startLocation, bodyZone.Location);
            Assert.AreEqual(250, bodyZone.Radius);


            startLocation = bodyZone.Location;
            radius        = bodyZone.Radius;
            zone.Update(new TimeQuantPassed(30001));
            Assert.AreEqual(model.outgoingMessages.Count, 4);
            Assert.AreNotEqual(startLocation, bodyZone.Location);
            Assert.AreEqual(radius * 0.6f, bodyZone.Radius);
        }
Ejemplo n.º 2
0
 public static BodyZoneDto ToBodyZoneDto(BodyZone entity)
 {
     return(new BodyZoneDto
     {
         Id = entity.Id,
         Name = entity.Name,
         Description = entity.Description,
         ImgPath = entity.ImgPath
     });
 }
Ejemplo n.º 3
0
        public void Test_SendMessage()
        {
            var        model    = new MockRoyalGameModel();
            GameObject zone     = new GameObject(model, TypesGameObject.DeathZone, TypesBehaveObjects.Passive);
            BodyZone   bodyZone = new BodyZone(zone, 400);

            zone.Components.Add(bodyZone);
            zone.Setup();
            //model.AddOrUpdateGameObject(zone);

            PointF startLocation = bodyZone.Location;
            float  radius        = bodyZone.Radius;

            zone.Update(new TimeQuantPassed(100));

            Assert.AreEqual(1, model.outgoingMessages.Count);
            Assert.AreEqual(startLocation, bodyZone.Location);
            Assert.AreEqual(radius, bodyZone.Radius);
        }
Ejemplo n.º 4
0
    private void OnGUI()
    {
        TogglePulse(GUILayout.Toggle(IsPulse, "Pulse"));

        foreach (var enumVal in debug_EnumVals)
        {
            BodyZone cur = (BodyZone)enumVal;

            if (cur == m_selectedZone)
            {
                GUI.color = Color.green;
            }
            if (GUILayout.Button($"Select {enumVal.ToString()}"))
            {
                HighlightBodyZone(cur);
            }
            GUI.color = Color.white;
        }
    }
Ejemplo n.º 5
0
        public BodyZoneDto Create(BodyZoneDto dto)
        {
            BodyZone entity = new BodyZone();

            entity.Name        = dto.Name;
            entity.Description = dto.Description;
            entity.ImgPath     = dto.ImgPath;

            string id = _uow.BodyZones.Add(entity);

            if (string.IsNullOrEmpty(id))
            {
                _uow.RollbackChanges();
            }
            else
            {
                _uow.Commit();
            }

            return(ToBodyZoneDto(entity));
        }
Ejemplo n.º 6
0
    public void HighlightBodyZone(BodyZone bodyZone)
    {
        m_selectedZone = bodyZone;

        HighlightZone(m_zoneVals[(int)bodyZone]);
    }