1 #pragma once//©SDXFramework http://sourceforge.jp/projects/dxframework/
2 #include <SDXFramework.h>
3 #include <Utility/IMotion.h>
4 #include <Framework/Shape.h>
29 template <
class TSpeed>
39 void Update(
IModel* 移動対象)
override
46 template <
class TSpeed>
54 Bound(
const TSpeed &速度,
const Rect& 移動範囲,
double 進行方向):
62 if (移動対象->
GetX() < 移動範囲.GetLeft())
64 if (進行方向 > PAI / 2 && 進行方向 < PAI * 3 / 2)
70 if (移動対象->
GetX() > 移動範囲.GetRight())
72 if (進行方向 < PAI / 2 || 進行方向 > PAI * 3 / 2)
77 else if (移動対象->
GetY() < 移動範囲.GetTop())
81 進行方向 = PAI * 2 - 進行方向;
84 else if (移動対象->
GetY() > 移動範囲.GetBottom())
92 if (進行方向 < 0) 進行方向 += PAI * 2;
93 if (進行方向 > PAI * 2) 進行方向 -= PAI * 2;
100 template <
class TSpeed>
115 const double nowSpeed = speed.Update();
116 const double lx = 目標座標.
GetX() - 移動対象->
GetX();
117 const double ly = 目標座標.
GetY() - 移動対象->
GetY();
119 if (lx * lx + ly * ly <= nowSpeed * nowSpeed)
123 const double angle = atan2(ly, lx);
130 template <
class TSpeed>
142 Orbit(
const TSpeed &速度):
150 角度 += speed.Update();
152 const double nextX = cos(角度) * 半径X;
153 const double nextY = sin(角度) * 半径Y;
179 移動対象->
Move(前振れ幅X, 前振れ幅Y);
目標座標に移動.
Definition: Motion.h:101
矩形を表す図形クラス.
Definition: Shape.h:536
double GetY() const
Y座標を取得.
Definition: Shape.h:176
double GetY() const
Y座標を取得.
Definition: Model.h:188
円周上を移動.
Definition: Motion.h:131
点を表す図形クラス.
Definition: Shape.h:129
double GetX() const
X座標を取得.
Definition: Shape.h:171
Modelの移動方法.
Definition: IMotion.h:13
double GetAngle()
角度を取得する.
Definition: Model.h:151
void SetPos(double X座標, double Y座標)
指定座標に移動.
Definition: Shape.h:159
void Move(double X移動量, double Y移動量)
相対座標で移動.
Definition: Model.h:98
範囲内で跳ね返る.
Definition: Motion.h:47
void MovePolar(double 距離, double 角度)
極座標で移動.
Definition: Model.h:104
前方に移動.
Definition: Motion.h:30
範囲内で振動.
Definition: Motion.h:162
ShapeとSpriteをまとめて、2Dモデルを表すクラス.
Definition: Model.h:12
static double Get(double 最大値)
0~最大値の乱数を取得.
Definition: Rand.h:22
double GetX() const
X座標を取得.
Definition: Model.h:182
void SetPos(double X座標, double Y座標)
指定座標に移動.
Definition: Model.h:110