private void btn_Ok_Click(object sender, EventArgs e)
        {
            if (txtBox_ObjectName.Text == "")
            {
                MessageBox.Show("Name cannot be blank");
                return;
            }
            if (names.Contains(txtBox_ObjectName.Text))
            {
                MessageBox.Show("The name " + txtBox_ObjectName.Text + " already exists");
                return;
            }
            ObjectType type = GetObjectType();

            switch (type)
            {
            case ObjectType.Player:
                Player player = new Player(txtBox_ObjectName.Text);
                ReturnObject = player;
                break;

            default:
                MessageBox.Show(type.ToString() + " has not been implemented yet");
                return;
            }
            DialogResult = DialogResult.OK;
            Close();
        }
 private void btn_Ok_Click(object sender, EventArgs e)
 {
     if (txtBox_ObjectName.Text == "")
     {
         MessageBox.Show("Name cannot be blank");
         return;
     }
     if (names.Contains(txtBox_ObjectName.Text))
     {
         MessageBox.Show("The name " + txtBox_ObjectName.Text + " already exists");
         return;
     }
     ObjectType type = GetObjectType();
     switch (type)
     {
         case ObjectType.Player:
             Player player = new Player(txtBox_ObjectName.Text);
             ReturnObject = player;
             break;
         default:
             MessageBox.Show(type.ToString() + " has not been implemented yet");
             return;
     }
     DialogResult = DialogResult.OK;
     Close();
 }
Exemplo n.º 3
0
 public bool AddObject(IAncibleObject ancibleObject)
 {
     if (ancibleObjects.ContainsKey(ancibleObject.Name)) return false;
     ancibleObjects.Add(ancibleObject.Name, ancibleObject);
     if (ancibleObject is IAnimated) animatedObjects.Add(ancibleObject.Name);
     if (ancibleObject is IMovable) movableObjects.Add(ancibleObject.Name);
     if (ancibleObject is ICollidable) collidableObjects.Add(ancibleObject.Name);
     return true;
 }
Exemplo n.º 4
0
 public bool SetObject(IAncibleObject ancibleObject)
 {
     if (!ancibleObjects.ContainsKey(ancibleObject.Name))
     {
         return(false);
     }
     ancibleObjects[ancibleObject.Name] = ancibleObject;
     return(true);
 }
Exemplo n.º 5
0
 public bool AddObject(IAncibleObject ancibleObject)
 {
     if (ancibleObjects.ContainsKey(ancibleObject.Name))
     {
         return(false);
     }
     ancibleObjects.Add(ancibleObject.Name, ancibleObject);
     if (ancibleObject is IAnimated)
     {
         animatedObjects.Add(ancibleObject.Name);
     }
     if (ancibleObject is IMovable)
     {
         movableObjects.Add(ancibleObject.Name);
     }
     if (ancibleObject is ICollidable)
     {
         collidableObjects.Add(ancibleObject.Name);
     }
     return(true);
 }
Exemplo n.º 6
0
 public bool SetObject(IAncibleObject ancibleObject)
 {
     if (!ancibleObjects.ContainsKey(ancibleObject.Name)) return false;
     ancibleObjects[ancibleObject.Name] = ancibleObject;
     return true;
 }