mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 16:09:06 +07:00
fix sample_06
This commit is contained in:
@@ -3,16 +3,6 @@
|
||||
"components" : {
|
||||
"spine_player" : {
|
||||
"spine" : "../spines/coin_spine.json"
|
||||
},
|
||||
"spine_player_cmd" : {
|
||||
"commands" : [{
|
||||
"type" : "set_anim_cmd",
|
||||
"desc" : {
|
||||
"track" : 0,
|
||||
"name" : "animation",
|
||||
"loop" : true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,6 @@
|
||||
"components" : {
|
||||
"spine_player" : {
|
||||
"spine" : "../spines/dragon_spine.json"
|
||||
},
|
||||
"spine_player_cmd" : {
|
||||
"commands" : [{
|
||||
"type" : "set_anim_cmd",
|
||||
"desc" : {
|
||||
"track" : 0,
|
||||
"name" : "flying",
|
||||
"loop" : true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,42 +3,6 @@
|
||||
"components" : {
|
||||
"spine_player" : {
|
||||
"spine" : "../spines/raptor_spine.json"
|
||||
},
|
||||
"spine_player_cmd" : {
|
||||
"commands" : [{
|
||||
"type" : "add_anim_cmd",
|
||||
"desc" : {
|
||||
"track" : 0,
|
||||
"name" : "walk"
|
||||
}
|
||||
}, {
|
||||
"type" : "add_anim_cmd",
|
||||
"desc" : {
|
||||
"track" : 0,
|
||||
"name" : "roar"
|
||||
}
|
||||
}, {
|
||||
"type" : "add_anim_cmd",
|
||||
"desc" : {
|
||||
"track" : 0,
|
||||
"name" : "walk",
|
||||
"loop" : true
|
||||
}
|
||||
}, {
|
||||
"type" : "add_anim_cmd",
|
||||
"desc" : {
|
||||
"track" : 1,
|
||||
"name" : "gun-grab",
|
||||
"delay" : 2
|
||||
}
|
||||
}, {
|
||||
"type" : "add_anim_cmd",
|
||||
"desc" : {
|
||||
"track" : 1,
|
||||
"name" : "gun-holster",
|
||||
"delay" : 3
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
"normal" : "../materials/spine_material_normal.json",
|
||||
"screen" : "../materials/spine_material_screen.json"
|
||||
}
|
||||
},
|
||||
"spine_player_cmd" : {},
|
||||
"spine_player_evt" : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,30 +40,29 @@ namespace
|
||||
roar, jump, gun_grab
|
||||
](ecs::entity e, const spine_player& p) {
|
||||
if ( roar && p.has_animation("roar") ) {
|
||||
e.ensure_component<spine_player_cmd>().add_command(
|
||||
spine_player_cmd::set_anim_cmd(0, "roar")
|
||||
e.ensure_component<commands<spine_player_commands::command>>()
|
||||
.add(spine_player_commands::set_anim_cmd(0, "roar")
|
||||
.complete_message("to_walk"));
|
||||
} else if ( jump && p.has_animation("jump") ) {
|
||||
e.ensure_component<spine_player_cmd>().add_command(
|
||||
spine_player_cmd::set_anim_cmd(0, "jump")
|
||||
e.ensure_component<commands<spine_player_commands::command>>()
|
||||
.add(spine_player_commands::set_anim_cmd(0, "jump")
|
||||
.complete_message("to_walk"));
|
||||
} else if ( gun_grab && p.has_animation("gun-grab") ) {
|
||||
e.ensure_component<spine_player_cmd>()
|
||||
.add_command(spine_player_cmd::set_anim_cmd(1, "gun-grab"))
|
||||
.add_command(spine_player_cmd::add_anim_cmd(1, "gun-holster")
|
||||
.delay(3.f));
|
||||
e.ensure_component<commands<spine_player_commands::command>>()
|
||||
.add(spine_player_commands::set_anim_cmd(1, "gun-grab"))
|
||||
.add(spine_player_commands::add_anim_cmd(1, "gun-holster").delay(3.f));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
owner.for_joined_components<spine_player_evt>([
|
||||
](ecs::entity e, const spine_player_evt& pe) {
|
||||
for ( const auto& evt : pe.events() ) {
|
||||
if ( auto complete_evt = std::get_if<spine_player_evt::complete_evt>(&evt);
|
||||
owner.for_joined_components<events<spine_player_events::event>>([
|
||||
](ecs::entity e, const events<spine_player_events::event>& pe) {
|
||||
for ( const auto& evt : pe ) {
|
||||
if ( auto complete_evt = std::get_if<spine_player_events::complete_evt>(&evt);
|
||||
complete_evt && complete_evt->message() == "to_walk" )
|
||||
{
|
||||
e.ensure_component<spine_player_cmd>().add_command(
|
||||
spine_player_cmd::add_anim_cmd(0, "walk")
|
||||
e.ensure_component<commands<spine_player_commands::command>>()
|
||||
.add(spine_player_commands::add_anim_cmd(0, "walk")
|
||||
.loop(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <enduro2d/high/components/commands.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace e2d;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <enduro2d/high/components/events.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace e2d;
|
||||
}
|
||||
Reference in New Issue
Block a user