Magic_Game/src/core/ActionGroup.h

109 lines
2.5 KiB
C
Raw Normal View History

// Copyright (c) 2016-2018 Easy2D - Nomango
//
// 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.
#pragma once
#include "Action.h"
namespace easy2d
{
// ˳<><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2019-02-11 11:13:13 +08:00
class E2D_API ActionSequence
: public Action
{
public:
2019-02-11 11:13:13 +08:00
ActionSequence();
2019-02-11 11:13:13 +08:00
explicit ActionSequence(
Array<ActionPtr> const& actions /* <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD> */
);
2019-02-11 11:13:13 +08:00
virtual ~ActionSequence();
// <20>ڽ<EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD>
void Add(
ActionPtr const& action
);
// <20>ڽ<EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Add(
Array<ActionPtr> const& actions /* <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD> */
);
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2019-01-26 17:18:31 +08:00
ActionPtr Clone() const override;
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
2019-01-26 17:18:31 +08:00
ActionPtr Reverse() const override;
protected:
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Init(NodePtr const& target) override;
// <20><><EFBFBD><EFBFBD><C2B6><EFBFBD>
void Update(NodePtr const& target, Duration dt) override;
protected:
ActionPtr current_;
IntrusiveList<ActionPtr> actions_;
};
// ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2019-02-11 11:13:13 +08:00
class E2D_API ActionSpawn
: public Action
{
public:
2019-02-11 11:13:13 +08:00
ActionSpawn();
2019-02-11 11:13:13 +08:00
explicit ActionSpawn(
Array<ActionPtr> const& actions /* <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD> */
);
2019-02-11 11:13:13 +08:00
virtual ~ActionSpawn();
// <20>ڽ<EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD>
void Add(
ActionPtr const& action
);
// <20>ڽ<EFBFBD>β<EFBFBD><CEB2><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Add(
Array<ActionPtr> const& actions /* <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD> */
);
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2019-01-26 17:18:31 +08:00
ActionPtr Clone() const override;
// <20><>ȡ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ĵ<EFBFBD>ת
virtual ActionPtr Reverse() const;
protected:
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Init(NodePtr const& target) override;
// <20><><EFBFBD><EFBFBD><C2B6><EFBFBD>
void Update(NodePtr const& target, Duration dt) override;
protected:
int size_;
IntrusiveList<ActionPtr> actions_;
};
}