Beispiel #1
0
	// Check that the player can create a specific object, by checking that he already possess every requirements needed
	public bool CanCreate(WorldObject obj) 
	{
		List<Type> requirements = obj.GetBuildingRequirements();

		// Check that for each type requirement, there is an object in the children of the player
		foreach (Type requirement in requirements) {
			Component objInChildren = this.GetComponentInChildren( requirement );

			// If no object of type requirement was found, then the player cannot create the object yet
			if (objInChildren == null) {
				return false;
			}
		}
		return true;
	}