mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00

* This allows [custom behaviors](http://wiki.compilgames.net/doku.php/gdevelop5/behaviors/events-based-behaviors), that you can create in your project or get from extensions, to require the presence of one or multiple other behaviors on an object. * This is an advanced feature that is helpful to create behaviors that are based on other. For example, a behavior "Platformer enemy" using the "Platformer object" behavior and adding specific actions, conditions and logic to make an enemy chase the player. * If you create a behavior and want to use this, just go to the properties of this behavior and add a new property. Choose the type "Required Behavior" for this property. You can then use this new behavior in the events of the behavior you just edited. * To use a behavior based on another, you don't need to do anything special! Just add it to your object as usual: any missing behavior will be added to your object, so you can start using it immediately.
63 lines
2.1 KiB
C++
63 lines
2.1 KiB
C++
/*
|
|
* GDevelop Core
|
|
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
|
* reserved. This project is released under the MIT License.
|
|
*/
|
|
#if defined(GD_IDE_ONLY)
|
|
#ifndef ParameterMetadataTools_H
|
|
#define ParameterMetadataTools_H
|
|
#include <vector>
|
|
#include "GDCore/String.h"
|
|
namespace gd {
|
|
class Project;
|
|
class ObjectsContainer;
|
|
class ParameterMetadata;
|
|
class Expression;
|
|
} // namespace gd
|
|
|
|
namespace gd {
|
|
class GD_CORE_API ParameterMetadataTools {
|
|
public:
|
|
static void ParametersToObjectsContainer(
|
|
gd::Project& project,
|
|
const std::vector<gd::ParameterMetadata>& parameters,
|
|
gd::ObjectsContainer& outputObjectsContainer);
|
|
|
|
/**
|
|
* Iterate over a list of parameters and their values.
|
|
* Callback function is called with the parameter metadata, its value
|
|
* and if applicable the name of the object it's linked to.
|
|
*/
|
|
static void IterateOverParameters(
|
|
const std::vector<gd::Expression>& parameters,
|
|
const std::vector<gd::ParameterMetadata>& parametersMetadata,
|
|
std::function<void(const gd::ParameterMetadata& parameterMetadata,
|
|
const gd::String& parameterValue,
|
|
const gd::String& lastObjectName)> fn);
|
|
|
|
/**
|
|
* Iterate over a list of parameters and their values.
|
|
* Callback function is called with the parameter metadata, its value
|
|
* and if applicable the name of the object it's linked to.
|
|
*/
|
|
static void IterateOverParametersWithIndex(
|
|
const std::vector<gd::Expression>& parameters,
|
|
const std::vector<gd::ParameterMetadata>& parametersMetadata,
|
|
std::function<void(const gd::ParameterMetadata& parameterMetadata,
|
|
const gd::String& parameterValue,
|
|
size_t parameterIndex,
|
|
const gd::String& lastObjectName)> fn);
|
|
|
|
/**
|
|
* Given a parameter, return, if applicable, the index of the object parameter
|
|
* it's linked to.
|
|
*/
|
|
static size_t GetObjectParameterIndexFor(
|
|
const std::vector<gd::ParameterMetadata>& parametersMetadata,
|
|
size_t parameterIndex);
|
|
};
|
|
} // namespace gd
|
|
|
|
#endif // ParameterMetadataTools_H
|
|
#endif
|