Exemplo n.º 1
0
    public override void ApplyPlacement(Player player, GridBlock block, Vector3 worldPos)
    {
        spawnedObject.transform.position = block.GridPosition.WorldPosition;
        spawnedObject.SetupObject(block);

        spawnedObject.transform.SetParent(PlaceableParent.Reference);
        WorldObjectList.Add(spawnedObject);

        spawnedObject = null;
    }
Exemplo n.º 2
0
        public static WorldObject CreateProjectile(this WorldObjectList worldObjectList, Vector2 position, Vector2 direction, float speed, params string[] ignoreTags)
        {
            var proj         = worldObjectList.Create(Definition(), position);
            var projBehavior = proj.Behaviors.Get <ProjectileBehavior>();

            projBehavior.Direction  = direction;
            projBehavior.Speed      = speed;
            projBehavior.IgnoreTags = ignoreTags;
            return(proj);
        }
Exemplo n.º 3
0
 public Creature(string name, PositiveInt hitpoint, int power, int defensePower, ITrace iTrace, Position cPosition)
 {
     _name            = name;
     _iTrace          = iTrace;
     Hitpoint         = hitpoint;
     _power           = power;
     _defensePower    = defensePower;
     CPosition        = cPosition;
     _worldObjectList = new WorldObjectList();
 }
        public void CanCountTheAmountOfWorldObjects()
        {
            var list        = new WorldObjectList <IWorldObject>();
            var mockObjects = new List <IWorldObject>();

            mockObjects.Add(new Mock <IWorldObject>().Object);
            mockObjects.Add(new Mock <IWorldObject>().Object);

            list.AddRange(mockObjects);
            Assert.AreEqual(2, list.Count);
        }
        public void WorldObjectIsEnumerable()
        {
            var list        = new WorldObjectList <IWorldObject>();
            var mockObjects = new List <IWorldObject>();

            mockObjects.Add(new Mock <IWorldObject>().Object);
            mockObjects.Add(new Mock <IWorldObject>().Object);
            list.AddRange(mockObjects);

            Assert.AreEqual(2, list.Count());
        }
        public void CanAddWorldObjectToList()
        {
            var list        = new WorldObjectList <IWorldObject>();
            var mockObjects = new List <IWorldObject>();

            mockObjects.Add(new Mock <IWorldObject>().Object);
            mockObjects.Add(new Mock <IWorldObject>().Object);

            list.AddRange(mockObjects);
            Assert.AreEqual(mockObjects[0], list[0]);
            Assert.AreEqual(mockObjects[1], list[1]);
        }
 public WorldObjectManager()
 {
     mAccount    = new WorldObjectList();
     mCharacter  = new WorldObjectList();
     mGuild      = new WorldObjectList();
     mHomonculus = new WorldObjectList();
     mItem       = new WorldObjectList();
     mMonster    = new WorldObjectList();
     mNpc        = new WorldObjectList();
     mParty      = new WorldObjectList();
     mPet        = new WorldObjectList();
     mSkill      = new WorldObjectList();
 }
Exemplo n.º 8
0
 public DropDownList(
     int selectedIndex,
     Vector2 position,
     Vector2 scale,
     Vector2 direction,
     IList <IFactory <IWorldObject> > itemFactories)
 {
     this.selectedIndex = selectedIndex;
     this.position      = position;
     this.scale         = scale;
     this.Direction     = direction;
     this.itemFactories = itemFactories;
     expandedItems      = new WorldObjectList <IWorldObject>();
     CreateSelectedObject();
 }
Exemplo n.º 9
0
    public override void ApplyPlacement(Player player, GridBlock block, Vector3 worldPos)
    {
        if (Reference.Reference != null)
        {
            return;
        }
        spawnedObject.transform.position = block.GridPosition.WorldPosition;
        Reference.Reference = spawnedObject;

        spawnedObject.SetupObject(block);
        spawnedObject.transform.SetParent(PlaceableParent.Reference);
        WorldObjectList.Add(spawnedObject);

        HasReference.Value = true;
        spawnedObject      = null;
    }
        public void WorldObjectDeletesWhenRemovedByClearingFromList()
        {
            var list        = new WorldObjectList <IWorldObject>();
            var mockObjects = new List <IWorldObject>();
            var mockObject1 = new Mock <IWorldObject>();
            var mockObject2 = new Mock <IWorldObject>();

            mockObjects.Add(mockObject1.Object);
            mockObjects.Add(mockObject2.Object);

            list.AddRange(mockObjects);
            list.Clear();

            mockObject1.Verify(mock => mock.Delete(), Times.Once());
            mockObject2.Verify(mock => mock.Delete(), Times.Once());
        }
Exemplo n.º 11
0
		public WorldObjectManager() {
			mAccount = new WorldObjectList();
			mCharacter = new WorldObjectList();
			mGuild = new WorldObjectList();
			mHomonculus = new WorldObjectList();
			mItem = new WorldObjectList();
			mMonster = new WorldObjectList();
			mNpc = new WorldObjectList();
			mParty = new WorldObjectList();
			mPet = new WorldObjectList();
			mSkill = new WorldObjectList();
		}