//this gets called automatically when we try and output to, or input from, a pin private void SetupPin(enumPIN pin, enumDirection direction) { //unexport if it we're using it already if (_OutExported.Contains(pin) || _InExported.Contains(pin)) { UnexportPin(pin); } //export File.WriteAllText(GPIO_PATH + "export", GetPinNumber(pin)); if (DEBUG) { Console.WriteLine("exporting pin " + pin + " as " + direction); } // set i/o direction File.WriteAllText(GPIO_PATH + pin.ToString() + "/direction", direction.ToString().ToLower()); //record the fact that we've setup that pin if (direction == enumDirection.OUT) { _OutExported.Add(pin); } else { _InExported.Add(pin); } }
//this gets called automatically when we try and output to, or input from, a pin private static void SetupPin(uint pin, enumDirection direction) { try { //unexport if it we're using it already if (_OutExported.Contains(pin) || _InExported.Contains(pin)) { UnexportPin(pin); } //export File.WriteAllText(GPIO_PATH + "export", pin.ToString()); // set i/o direction File.WriteAllText(GPIO_PATH + "gpio" + pin.ToString() + "/direction", direction.ToString().ToLower()); //record the fact that we've setup that pin if (direction == enumDirection.OUT) { _OutExported.Add(pin); } else { _InExported.Add(pin); } } catch {} }
public void Init(int mazeSize) { _mazeSize = mazeSize; Row = 0; Column = 0; Direction = enumDirection.down; }
public DirectionalSegment(int inTop, int inLeft, enumDirection inDirection, int inGroupID) { Left = inLeft; Top = inTop; Direction = inDirection; GroupID = inGroupID; }
public bool GetNext(bool[,] array) { switch (Direction) { case enumDirection.down: Row++; if (Row == _mazeSize || (Row != _mazeSize - 1 && array[Row + 1, Column])) { Row--; Column++; Direction = enumDirection.right; return(IsStop(array)); } break; case enumDirection.up: Row--; if (Row == -1 || (Row > 0 && array[Row - 1, Column])) { Row++; Column--; Direction = enumDirection.left; return(IsStop(array)); } break; case enumDirection.left: Column--; if (Column == -1 || (Column > 0 && array[Row, Column - 1])) { Row++; Column++; Direction = enumDirection.down; return(IsStop(array)); } break; case enumDirection.right: Column++; if (Column == _mazeSize || (Column + 1 < _mazeSize && array[Row, Column + 1])) { Row--; Column--; Direction = enumDirection.up; return(IsStop(array)); } break; default: return(true); } return(false); }
public void ChangeTilt() { if (tiltDirection == enumDirection.Left) { tiltDirection = enumDirection.Right; } else { tiltDirection = enumDirection.Left; } if (stunTick <= 0) { GotoIdle(); } }
bool NotFill(enumDirection dir) { return(Neighbours[(int)dir] != null && !Neighbours[(int)dir].m_Filled); }
bool IsFill(enumDirection dir) { return(Neighbours[(int)dir] == null || Neighbours[(int)dir].m_Filled); }
/// <summary> /// Playerまでの第2最短ルート /// </summary> private enumDirection GetShortRoute2nd(Vector2 vA, Vector2 vB, enumDirection eA, enumDirection eB) { var type = enumDirection.Front; var id = _player.GetID (); var dF = Vector2.Distance (id, vA); var dB = Vector2.Distance (id, vB); if (dF <= dB) type = eA; else if (dB <= dF) type = eB; return type; }
///############################################################ /// <summary> /// Maps data between the provided objects. /// </summary> /// <param name="oBusinessObject">Object to be used as a data source/destination.</param> /// <param name="l_oInputCollection">IInputCollection object to be used as a data source/destination.</param> /// <param name="iRowIndex">Integer representing the row index to use within the data source.</param> /// <returns>Boolean value representing if all of the readable properties within the provided oFrom object were successfully mapped into oTo object.</returns> ///############################################################ /// <LastUpdated>February 15, 2010</LastUpdated> private static bool DoMap(MultiArray oBusinessObject, IList <Controls.Input> l_oInputCollection, int iRowIndex, enumDirection eDirection) { Controls.Input oCurrentInput; InputData oInputData; int i; bool bReturn = false; //#### If we have valid objects to traverse (as well as a valid iRowIndex within the oDataTable) if (oBusinessObject != null && oBusinessObject.RowCount > iRowIndex && iRowIndex >= 0 && l_oInputCollection != null && l_oInputCollection.Count > 0 ) { //#### Re-default our bReturn value to true bReturn = true; //#### Traverse the l_oInputCollection for (i = 0; i < l_oInputCollection.Count; i++) { //#### Collect the oCurrentInput and oInputData for this loop oCurrentInput = l_oInputCollection[i]; oInputData = oCurrentInput.ControlManager; //#### If the oCurrentInput was found, it's .InitialValueIs(not an)Expression and the .ColumnName .Exists within the oBusinessObject //#### NOTE: We do not test for the .TableName below because we allow the developer to bypass the test by using a DataTable. If the .TableName is to be tested, a DataSet should be set into the oDataSource if (oCurrentInput != null && !oCurrentInput.InitialValueIsExpression && oBusinessObject.Exists(oInputData.ColumnName) ) { //#### Determine the eDirection, copying the .ColumnName's value accordingly switch (eDirection) { case enumDirection.PopulateContols: { oCurrentInput.InitialValue = oBusinessObject.Value(iRowIndex, oInputData.ColumnName); break; } case enumDirection.PopulateBusinessObject: { oBusinessObject.Value(iRowIndex, oInputData.ColumnName, oCurrentInput.Value); break; } } } //#### Else the oCurrentInput was not found within the oBusinessObject, so flip our bReturn value to false else { bReturn = false; } } } //#### Return the above determined bReturn value to the caller return(bReturn); }
/// <summary> /// 回転 /// </summary> protected virtual void Rotation(enumDirection rot) { var dur = _duration / 2.0f; transform.DOLocalRotate (GetMoveRot (rot), dur); }
/// <summary> /// 引数のenumDirectionに対応するVector3を取得 /// </summary> protected Vector3 GetMoveRot(enumDirection rot) { if (rot == enumDirection.Left) return new Vector3 (0, -90, 0); else if (rot == enumDirection.Right) return new Vector3 (0, 90, 0); else if (rot == enumDirection.Front) return new Vector3 (0, 0, 0); else if (rot == enumDirection.Back) return new Vector3 (0, 180, 0); else return Vector3.zero; }
/// <summary> /// 第1引数に入れたVector2の前後左右のVector2の中から /// 第2引数に入れたenumDirectionに対応したものを取得 /// </summary> protected Vector2 GetMovePoint(Vector2 id, enumDirection rot) { if (rot == enumDirection.Front) return new Vector2 (id.x, id.y + 1); else if (rot == enumDirection.Back) return new Vector2 (id.x, id.y - 1); else if (rot == enumDirection.Left) return new Vector2 (id.x - 1, id.y); else if (rot == enumDirection.Right) return new Vector2 (id.x + 1, id.y); else return id; }
/// <summary> /// 移動時ルート選択 /// </summary> private void Route(Vector2 t, enumDirection te, Vector2 tA, enumDirection teA, Vector2 tB, enumDirection teB) { if (IsCell (t)) { Branch (t, te); } else { var e = GetShortRoute2nd (tA, tB, teA, teB); if (e == teA) { if (IsCell (tA)) { Branch (tA, teA); } else if (IsCell (tB)) Branch (tB, teB); } else if (e == teB) { if (IsCell (tB)) Branch (tB, teB); else if (IsCell (tA)) Branch (tA, teA); } } }
//this gets called automatically when we try and output to, or input from, a pin private void SetupPin(RaspiGpio pin, enumDirection direction) { //unexport if it we're using it already if (outExported.Contains(pin) || inExported.Contains(pin)) UnexportPin(pin); //export File.WriteAllText(GPIO_PATH + "export", GetPinNumber(pin)); if (DEBUG) Console.WriteLine("exporting pin " + pin + " as " + direction); // set i/o direction File.WriteAllText(GPIO_PATH + pin.ToString() + "/direction", direction.ToString().ToLower()); //record the fact that we've setup that pin if (direction == enumDirection.OUT) outExported.Add(pin); else inExported.Add(pin); }
///############################################################ /// <summary> /// Maps data between the provided objects. /// </summary> /// <param name="oBusinessObject">Object to be used as a data source/destination.</param> /// <param name="l_oInputCollection">IInputCollection object to be used as a data source/destination.</param> /// <param name="iRowIndex">Integer representing the row index to use within the data source.</param> /// <param name="bStrict">Boolean value indicating if we are to ensure the table names match (case insensitive).</param> /// <returns>Boolean value representing if all of the readable properties within the provided oFrom object were successfully mapped into oTo object.</returns> ///############################################################ /// <LastUpdated>February 15, 2010</LastUpdated> private static bool DoMap(DataTable oBusinessObject, IList <Controls.Input> l_oInputCollection, int iRowIndex, bool bStrict, enumDirection eDirection) { Controls.Input oCurrentInput; InputData oInputData; string sTableName; int i; bool bReturn = false; //#### If we have valid objects to traverse (as well as a valid iRowIndex within the oBusinessObject) if (oBusinessObject != null && oBusinessObject.Rows.Count > iRowIndex && iRowIndex >= 0 && l_oInputCollection != null && l_oInputCollection.Count > 0 ) { //#### Collect the .ToLower'd sTableName and re-default our bReturn value to true sTableName = oBusinessObject.TableName.ToLower(); bReturn = true; //#### Traverse the l_oInputCollection for (i = 0; i < l_oInputCollection.Count; i++) { //#### Collect the oCurrentInput and oInputData for this loop oCurrentInput = l_oInputCollection[i]; oInputData = oCurrentInput.ControlManager; //#### If the oCurrentInput was found, it's .InitialValueIs(not an)Expression, the .ColumnName exists within the oDataSet and we're not in bStrict mode or if the .TableNames match, copy the .ColumnName's value across //#### NOTE: We do not test for the .TableName below because we allow the developer to bypass the test by using a DataTable. If the .TableName is to be tested, a DataSet should be set into the oDataSource if (oCurrentInput != null && !oCurrentInput.InitialValueIsExpression && oBusinessObject.Columns.Contains(oInputData.ColumnName) && (!bStrict || sTableName == oInputData.TableName.ToLower()) ) { //#### Determine the eDirection, copying the .ColumnName's value accordingly switch (eDirection) { case enumDirection.PopulateContols: { oCurrentInput.InitialValue = oBusinessObject.Rows[iRowIndex][oInputData.ColumnName].ToString(); break; } case enumDirection.PopulateBusinessObject: { //! typing issues here? oBusinessObject.Rows[iRowIndex][oInputData.ColumnName] = oCurrentInput.Value; break; } } } //#### Else the oCurrentInput was not found within the oDataSet, so flip our bReturn value to false else { bReturn = false; } } } //#### Return the above determined bReturn value to the caller return(bReturn); }
/// <summary> /// 攻撃、移動の行動分岐 /// </summary> private void Branch(Vector2 vec, enumDirection rot) { var id = _player.GetID (); var f = GetMovePoint (id, enumDirection.Front); var b = GetMovePoint (id, enumDirection.Back); var l = GetMovePoint (id, enumDirection.Left); var r = GetMovePoint (id, enumDirection.Right); if (_id == f) { Rotation (enumDirection.Back); Attack (); } else if (_id == b) { Rotation (enumDirection.Front); Attack (); } else if (_id == l) { Rotation (enumDirection.Right); Attack (); } else if (_id == r) { Rotation (enumDirection.Left); Attack (); } else { Rotation (rot); Move (vec); } }