HoverRace  2.0
MetaPlayer.h
Go to the documentation of this file.
1 
2 // MetaPlayer.h
3 //
4 // Copyright (c) 2014, 2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 namespace HoverRace {
25  namespace Client {
26  namespace HoverScript {
27  class MetaSession;
28  class PlayerPeer;
29  }
30  }
31 }
32 
33 namespace HoverRace {
34 namespace Client {
35 namespace HoverScript {
36 
42 {
43 public:
44  MetaPlayer(std::shared_ptr<PlayerPeer> player);
45  virtual ~MetaPlayer();
46 
47 public:
48  std::shared_ptr<PlayerPeer> GetPlayer() const { return player; }
49 
50 public:
51  virtual void OnInit() { }
52 
53  virtual void OnJoined(std::shared_ptr<MetaSession>) { }
54  virtual void OnStart() { }
55  virtual void OnCheckpoint(int) { }
56  virtual void OnFinishLine() { }
57  virtual void OnFinish() { }
58 
59 public:
60  static void Register(Script::Core &scripting);
61 
62 private:
63  std::shared_ptr<PlayerPeer> player;
64  boost::signals2::scoped_connection checkpointConn;
65  boost::signals2::scoped_connection finishLineConn;
66 };
67 
68 } // namespace HoverScript
69 } // namespace Client
70 } // namespace HoverRace
std::shared_ptr< PlayerPeer > player
Definition: MetaPlayer.h:63
Native base class for scripted players.
Definition: MetaPlayer.h:41
boost::signals2::scoped_connection finishLineConn
Definition: MetaPlayer.h:65
virtual void OnStart()
Definition: MetaPlayer.h:54
virtual void OnFinishLine()
Definition: MetaPlayer.h:56
virtual void OnJoined(std::shared_ptr< MetaSession >)
Definition: MetaPlayer.h:53
std::shared_ptr< PlayerPeer > GetPlayer() const
Definition: MetaPlayer.h:48
virtual void OnInit()
Definition: MetaPlayer.h:51
boost::signals2::scoped_connection checkpointConn
Definition: MetaPlayer.h:64
virtual void OnCheckpoint(int)
Definition: MetaPlayer.h:55
virtual void OnFinish()
Definition: MetaPlayer.h:57
Definition: Announcement.h:24
A script environment.
Definition: Core.h:66