Пример #1
0
    public ImmutableDataPartitionLocation(string id, IXMLNode xmlNode, string error)
    {
        Hashtable hashElements = XMLUtils.GetChildren(xmlNode);

        this.id           = id;
        offset            = StringUtils.ParseVector3(XMLUtils.GetString(hashElements["Offset"] as IXMLNode, null, error));
        absolutePartition = XMLUtils.GetInt(hashElements["AbsolutePartition"] as IXMLNode, 0, error);
        attribute         = (PartitionLocationTypes)Enum.Parse(typeof(PartitionLocationTypes),
                                                               XMLUtils.GetString(hashElements["Attribute"] as IXMLNode, null, error));
    }
Пример #2
0
    public static MinigameTypes GetMinigameTypeFromLocationId(string locationId)
    {
        PartitionLocationTypes partitionLocType = GetData(locationId).Attribute;

        if (partitionLocType == PartitionLocationTypes.Base)
        {
            // Not supported for parsing
            return(MinigameTypes.None);
        }
        else
        {
            // Parse convert string to another enum
            MinigameTypes minigameType = (MinigameTypes)Enum.Parse(typeof(MinigameTypes), partitionLocType.ToString());
            return(minigameType);
        }
    }
Пример #3
0
	/// <summary>
	/// Gets the unused position next to minigame
	/// NOTE: GetRandomUnlockedMinigameType() does not keep track of local, if picked already
	/// </summary>
	/// <returns>The unused position next to minigame.</returns>
	public LgTuple<Vector3, string> GetPositionNextToMinigame(MinigameTypes minigameType){
		CheckInitializeOpenLocations();

		// Converting to the MinigameTypes to a PartitionLocationType
		PartitionLocationTypes locationType = PartitionLocationTypes.None;
		switch(minigameType){
		case MinigameTypes.Clinic:
			locationType = PartitionLocationTypes.Clinic;
			break;
		case MinigameTypes.Memory:
			locationType = PartitionLocationTypes.Memory;
			break;
		case MinigameTypes.Runner:
			locationType = PartitionLocationTypes.Runner;
			break;
		case MinigameTypes.Shooter:
			locationType = PartitionLocationTypes.Shooter;
			break;
		case MinigameTypes.TriggerNinja:
			locationType = PartitionLocationTypes.TriggerNinja;
			break;
		case MinigameTypes.MicroMix:
			locationType = PartitionLocationTypes.MicroMix;
			break;
		default:
			return null;
		}

		// Initialize all to null first
		LgTuple<Vector3, string> tupleToReturn = null;
		ImmutableDataPartitionLocation locationToDelete = null;

		// Loop through available list and keep track if found
		foreach(ImmutableDataPartitionLocation location in openMinipetLocationsList){
			if(location.Attribute == locationType){
				tupleToReturn = new LgTuple<Vector3, string>(location.Offset, location.Id);
				locationToDelete = location;
				break;
			}
		}
		// Remove the tuple from the list if is exists, outside foreach iteration
		if(locationToDelete != null){
			openMinipetLocationsList.Remove(locationToDelete);
		}
		return tupleToReturn;
	}