ソースコード共有

「ソースコード共有」の編集履歴(バックアップ)一覧に戻る

ソースコード共有 - (2009/05/26 (火) 17:18:18) のソース

&bold(){&u(){CharacterData.h}}
/**********************************************************************************/
/*!	@file
	@brief	オブジェクトを管理するクラス

	@author	柴田 大輔
    @date	2005/03/23
    $Revision: $
***********************************************************************************/
#ifndef _CHARACTER_DATA_H
#define _CHARACTER_DATA_H

 #include "../OgLib/OG.h"

class CharacterData
{
protected:
	MODEL_HANDLE _mesh;			// モデルハンドル
 D3DXVECTOR3	 _position;		// 位置
	float		 _hp;			// HP
	float		 _direction;	         // 向き
	float              _velocity;		// 移動速度
	float		 _attack_vel;	         // 攻撃速度
 int                _attack;                  // 攻撃力

public:
	// コンストラクタ
	CharacterData( const char* x_file, float hp, D3DXVECTOR3 pos );
	// デストラクタ
	virtual ~CharacterData();
	// 移動
	virtual void Move( void ) = 0;
	// 描画
	virtual void Draw( void ) = 0;

	// HPの取得&設定
	virtual float GetHP( void ) const {return _hp;}
	virtual void SetHP( float hp ) {_hp = hp;}
	// 位置の取得&設定
	virtual D3DXVECTOR3 GetPosition( void ) const {return _position;}
	virtual void SetPosition( D3DXVECTOR3 pos ) {_position = pos;}
	// 向きの取得&設定
	virtual float GetDirection( void ) const {return _direction;}
	virtual void SetDirection( float dir ) {_direction = dir;}
	// 移動速度の取得&設定
	virtual float GetVelocity( void ) const {return _velocity;}
	virtual void SetVelocity( float vel ) {_velocity = vel;}
	// 攻撃速度の取得&設定
	virtual float GetAttackVel( void ) const {return _attack_vel;}
	virtual void SetAttackVel( float at_vel ) {_attack_vel = at_vel;}
	// 攻撃の取得&設定
	virtual float GetAttack( void ) const {return _attack;}
	virtual void SetAttack( float at_vel ) {_attack_vel = at_vel;}

};


#endif



&bold(){&u(){CharacterData.cpp}}

/**********************************************************************************/
/*!	@file
	@brief	オブジェクトを管理するクラス

	@author	柴田 大輔
    @date	2005/03/23
    $Revision: $
***********************************************************************************/
 #include "stdafx.h"
 #include "Object.h"


/**************************************************************/
/*!
	コンストラクタ

	初期化処理
---------------------------------------------------------------
	@param	なし
	@return 生成したシーンのポインタ
***************************************************************/
Object::Object( const char* x_file, float hp, D3DXVECTOR3 pos )
: _mesh(NULL)			// モデルハンドル
, _hp(hp)				// HP
, _position(pos)		// 位置
, _direction(0.0f)		// 向き
, _velocity(0.0f)		// 移動速度
, _attack_vel(0.0f)		// 攻撃速度
{
	// モデルの読み込み
	if (_mesh == NULL ) {
		_mesh = OG_RequestLoadModel( x_file );
	}

}

/**************************************************************/
/*!
	デストラクタ

	解放処理
---------------------------------------------------------------
	@param	なし
	@return 生成したシーンのポインタ
***************************************************************/
Object::~Object()
{
}



----

- ページ分けるかzipのリンク貼った方がいいんじゃね…?  -- 花烏風月  (2009-05-22 01:46:26)
#comment()