Example #1
0
void check_powerup_col(struct Snake snake[], struct Snake other_snake[], int dir_arg, int player, struct SnakeInfo * info){
	checkFood(snake, other_snake, dir_arg, player, info);
	checkSpeed(snake, other_snake, player, info);
	checkFreeze(snake,other_snake, player, info);
	recalc_freeze_times(snake, player,info);
	checkEdwards(snake, other_snake, player, info);
}
Example #2
0
void CNpc::run(float time)
{
    //log("%d  m_fCount:%f", m_State, m_fCount);
    //log("onAri!!!!!!!!!!!!!!!");
    checkSkillConfuse(time);
    checkFreeze(time);
  
}
Example #3
0
bool RippleCalc::addPathState(STPath const& path, TER& resultCode)
{
    auto pathState = std::make_shared<PathState> (
        saDstAmountReq_, saMaxAmountReq_);

    if (!pathState)
    {
        resultCode = temUNKNOWN;
        return false;
    }

    pathState->expandPath (
        mActiveLedger,
        path,
        uDstAccountID_,
        uSrcAccountID_);

    if (pathState->status() == tesSUCCESS)
        pathState->checkNoRipple (uDstAccountID_, uSrcAccountID_);

    if (pathState->status() == tesSUCCESS)
        pathState->checkFreeze ();

    pathState->setIndex (pathStateList_.size ());

    WriteLog (lsDEBUG, RippleCalc)
        << "rippleCalc: Build direct:"
        << " status: " << transToken (pathState->status());

    // Return if malformed.
    if (isTemMalformed (pathState->status()))
    {
        resultCode = pathState->status();
        return false;
    }

    if (pathState->status () == tesSUCCESS)
    {
        resultCode = pathState->status();
        pathStateList_.push_back (pathState);
    }
    else if (pathState->status () != terNO_LINE)
    {
        resultCode = pathState->status();
    }

    return true;
}
Example #4
0
//-----------------------------------------------------------------------------
//! 更新(この中で更新すべきUpdateを呼び出す)
//-----------------------------------------------------------------------------
void EnemyBase::Update()
{
	// 死亡フラグが立っていたら処理しない
	if( _isDead ) return;
	// 所属している分隊からリーダーの位置を取得
	if( _keyType != KEY_LEADER ) { 
		_goalPos = _pSquad->getLeader()->getPosition();
	}

	s32	currentAnimation = _pTaskModel->getAnimation();

	// リーダーの命令によって処理変更
	UpdateByCommand();
	
	//---- 移動
	// キャラの移動(左スティックの情報取得)
	_mov._x = sinf( _rotation._y )  * _speed;
	_mov._z = cosf( _rotation._y )  * _speed;

	if( _speed > 0.0f ) 
	{
		// デグリーに直す
		_rotation._y = TO_DEGREE(_rotation._y );
	}

	// 更新
	_oldPosition = _position;

	// フリーズしなかったら
	if( !checkFreeze(currentAnimation) ){
		// 移動してなければ
		if( _mov._x == 0.0f && _mov._z == 0.0f )
		{
			// 立ちモーション
			//_aniState = STATE_WAIT;
			if( currentAnimation != _aniWait ) {
				_pTaskModel->setAnimation(_aniWait, ANIMATION_PLAY_REPEAT);
			}
		}else{
			// 歩きモーション
			//_aniState = STATE_MOVE;
			if( currentAnimation != _aniMove ) {
				_pTaskModel->setAnimation(_aniMove, ANIMATION_PLAY_REPEAT);
			}
		}
	}

	// 攻撃してたら
	if( currentAnimation == _aniAttack ) {
		// 移動速度を少なくする
		_mov._x *= 0.5f;
		_mov._z *= 0.5f;
	}else if( currentAnimation == _aniDamage ){
		// 移動速度をなくす
		_mov._x *= 0.0f;
		_mov._z *= 0.0f;
	}

	_position += _mov * Global::deltaTime;

	//---- パーティクル
	// パーティクルの生成待ち時間カウント
	_genCount += 1 * Global::deltaTime;

	Vector3 sub = _oldPosition - _position;

	// 移動している且つ、生成待ち時間が切れた時
	if( (abs(sub._x) > 0.0f || abs(sub._z) > 0.0f) && _genCount >= _waitGenTime ) {

		// カウントリセット
		_genCount = 0;

		Vector3 pos = _position + Vector3( (f32)(rand() % 40 - 20) );

		Vector3 mov = -_mov;

		mov._x *= (rand() %  50) / 100.0f;
		mov._y  = (rand() % 100) / 100.0f;
		mov._z *= (rand() %  50) / 100.0f;

		f32		rot = ( rand() % 20 ) / 20.0f;
		Radian	angVel = Radian( ( rand() % 10 ) / 100.0f );

		// パーティクル生成
		IParticleMan()->generateParticle(pos,
										 mov,
										 Vector3(0.5f, 0.5f, 0.0f),
										 Radian(rot),
										 100, 0,
										 angVel,
										 ParticleManager::PARTICLE_SMOKE); 
	}


	// あたり判定の球の更新
	Man::Update();
	
	//---- マップとの当たり判定
	GmSystemCollision()->checkCollisionModel(_hitPosition, _radius, _hitGround);

	// 外にいけなくする
	ICastleCol()->hitOutRange(_hitPosition);

	// あたり判定用の球情報更新
	setSphereParam(_hitPosition, _hitRadius);
	// 座標の設定
	toPosition(_hitPosition, _position);

	// 重力処理
	if( !_hitGround ){
		_mov._y -= 0.6f * Global::deltaTime;
	}
	else{
		_mov._y = 0.0f;
	}

	// 最大重力設定
	if( _mov._y <= -9.8f )
	{
		_mov._y = -9.8f; 
	}

	if( _aniAttack != -1 ) {

		// 攻撃ボタンが押されているかどうか
		if( _key->getPushState("Attack") )
		{
			// 攻撃アニメーション再生
			_pTaskModel->setAnimation(_aniAttack);
			// 攻撃
			Attack();

		}else if ( currentAnimation == _aniAttack ) {

			// 攻撃再生中なら
			// 再生比率取得
			f32	aniRate = _pTaskModel->getAnimationRate();
			// 再生が半分いったら
			if( aniRate >= 0.5f && !_isAttack ) {
				// 攻撃
				Attack();
			}else if( _isAttack ){
				// 攻撃範囲、座標を戻す
				_attackPosition = Vector3( 0.0f, 0.0f, 0.0f );
				_attackRadius	= 0.0f;
			}

		}else{
			// この時点で半径が初期化されてなければ
			if( _attackRadius != 0.0f ){
				// 攻撃範囲、座標を戻す
				_attackPosition = Vector3( 0.0f, 0.0f, 0.0f );
				_attackRadius	= 0.0f;
			}
			// 攻撃フラグを元に戻す
			_isAttack = false;
		}

	}

	// 体力が0以下なら
	if( _myStatus->getParam()->_HP <= 0 )
	{
		// 死亡フラグを立てる
		_isDead = true;
	}
}