Exemple #1
0
 public static void LoadCollectables(XElement collectableDataGroup, Data.RegistrationCallback registerComponent)
 {
     if (collectableDataGroup != null)
     {
         foreach (XElement node in collectableDataGroup.Elements())
         {
             TerrainObjectBase toAdd = CreateCollectableFromXmlNode(node);
             toAdd.WorldPosition = new Vector2((float)node.Attribute("x"), (float)node.Attribute("y"));
             registerComponent(toAdd);
         }
     }
 }
        public static TerrainObjectBase CreateFlagFromTextureName(string textureName)
        {
            TerrainObjectBase newFlag = null;

            switch (textureName)
            {
            case "flag-goal": newFlag = Factory.CreateGoalFlag(textureName); break;

            case "flag-checkpoint": newFlag = Factory.CreateRestartFlag(textureName); break;
            }

            if (newFlag != null)
            {
                newFlag.GroupNodeName = Data_Group_Node_Name;
            }
            return(newFlag);
        }
Exemple #3
0
        public static TerrainObjectBase CreateSignpostFromTextureName(string textureName)
        {
            TerrainObjectBase newSignpost = null;

            switch (textureName)
            {
            case "sign-one-way": newSignpost = Factory.CreateOneWaySignpost(textureName); break;

            case "sign-speed-1-4": newSignpost = Factory.CreateSpeedLimitSignpost("sign-speed-1-1"); break;
            }

            if (newSignpost != null)
            {
                newSignpost.GroupNodeName = Data_Group_Node_Name;
            }
            return(newSignpost);
        }
Exemple #4
0
 private void AddTerrainObject(TerrainObjectBase toAdd, Vector2 worldPosition)
 {
     toAdd.WorldPosition = SnapToGrid(worldPosition + _cameraController.WorldPosition - new Vector2(Definitions.CellSizeInPixels / 2.0f));
     RegisterGameObject(toAdd);
 }
Exemple #5
0
 private void AddTerrainObjectDataNode(XDocument saveData, TerrainObjectBase toSave)
 {
     saveData.Element("leveldata").Element("terrain").Element(toSave.GroupNodeName).Add(toSave.Save());
 }