// さいころ回転 private void _onFlickDice(GameObject p_dice, FlickInfo p_info) { if(this._animCount < (_HALF / _ROLL_SPEED)) { if(this._animCount == 0 ) { int l_y = this._roundAngle( p_dice.transform.localEulerAngles.y); int l_x = this._roundAngle( p_dice.transform.localEulerAngles.x); int l_z = this._roundAngle( p_dice.transform.localEulerAngles.z); int Direction = DiceUtility.getDiceDirection(l_y); int State = DiceUtility.getDiceState(l_x, l_z); // 回転する方向を取得 this._rollDirection = DiceUtility.getRotateVector( State, Direction, p_info.Direction); } p_dice.transform.Rotate( this._rollDirection.x, this._rollDirection.y, this._rollDirection.z); this._animCount++; } else { this._isRolling = false; this._animCount = 0; this._rollDirection.x = 0; this._rollDirection.y = 0; this._rollDirection.z = 0; this.onDiceStateChanged(p_dice); } }
// アップイベント protected void onTouchUpEvent() { if(this._directionX != (int)DirectionKind.None && this._directionY != (int)DirectionKind.None) { return; } else if(this._directionX == (int)DirectionKind.None && this._directionY == (int)DirectionKind.None) { return; } FlickInfo l_fInfo = new FlickInfo(); l_fInfo.StartX = this._startX; l_fInfo.StartY = this._startY; l_fInfo.Direction = ((this._directionX != (int)DirectionKind.None) ? this._directionX : this._directionY); // メッセージ送信 GameMessenger.Instance.SendMessage(l_fInfo); this._startX = 0; this._startY = 0; this._directionX = (int)DirectionKind.None; this._directionY = (int)DirectionKind.None; }
// メッセージ受信イベント private void _receiveMessage() { if(GameMessenger.Instance.Count > 0) { // メッセージ受信 object l_msg = GameMessenger.Instance.RecvMessage(); FlickInfo l_fInfo = l_msg as FlickInfo; if(l_fInfo != null) { // フリック開始位置からダイスを取得 GameObject l_dice = GameLayerInfo.Instance.getDiceAt( l_fInfo.StartX, l_fInfo.StartY); if(l_dice != null) { // 回転フラグ立てる this._isRolling = true; this._target = l_dice; this._targetInfo_f = l_fInfo; } } } }