entity_spell_system/entities/resources/entity_resource.h

106 lines
2.8 KiB
C
Raw Normal View History

/*
Copyright (c) 2019-2020 Péter Magyar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef ENTITY_RESOURCE_H
#define ENTITY_RESOURCE_H
#include "core/reference.h"
class Stat;
class Entity;
class EntityResourceData;
class EntityResource : public Reference {
GDCLASS(EntityResource, Reference);
public:
2020-03-11 16:08:07 +01:00
bool get_dirty() const;
void set_dirty(const bool value);
2020-03-11 16:08:07 +01:00
bool get_should_process() const;
void set_should_process(const bool value);
Ref<EntityResourceData> get_resource_data();
2020-03-11 16:08:07 +01:00
void set_resource_data(const Ref<EntityResourceData> &value);
StringName get_data_path() const;
void set_data_path(const StringName &value);
2020-03-11 16:08:07 +01:00
int get_current_value() const;
void set_current_value(const int value);
2020-03-11 16:08:07 +01:00
int get_max_value() const;
void set_max_value(const int value);
Entity *get_owner();
void set_owner(Entity *entity);
void set_owner_bind(Node *owner);
void ons_added(Entity *owner);
void onc_added(Entity *owner);
void ons_stat_changed(Ref<Stat> stat);
void onc_stat_changed(Ref<Stat> stat);
void ons_target_changed(Entity *entity, Entity *old_target);
void onc_target_changed(Entity *entity, Entity *old_target);
2020-03-11 16:08:07 +01:00
void process_server(const float delta);
void _process_server(const float delta);
2020-03-11 16:08:07 +01:00
void process_client(const float delta);
void _process_client(const float delta);
2020-03-11 16:08:07 +01:00
void receivec_update(const int current);
void receivec_update_full(const int current, const int max);
void receivec_update_string(const String str);
void resolve_references();
2019-09-13 09:26:53 +02:00
Dictionary to_dict();
void from_dict(const Dictionary &dict);
Dictionary _to_dict();
void _from_dict(const Dictionary &dict);
EntityResource();
~EntityResource();
protected:
static void _bind_methods();
private:
bool _server_side;
Entity *_owner;
bool _dirty;
bool _should_process;
Ref<EntityResourceData> _data;
StringName _data_path;
int _current;
int _max;
};
#endif