// Update is called once per frame void Update() { if (!isVisible) //if the player is out of bounds { posType currentPosition = getPositionType(); //gets current player position (refer back to the enum) setPointerPosition(currentPosition); //sets pointer's position setPointerRotation(currentPosition); //sets pointer's rotation } }
public void setPosPieces(posType type, posSide side, int x, int y) { if (x < 0 || x > 9 || y < 0 || y > 10) { MessageBox.Show("error setPosPieces out of range"); } else { board[x][y][0] = type.ToString(); board[x][y][1] = side.ToString(); } }
private posType getPositionType() //gets current player position (refer back to the enum) { posType pos = posType.other; if (playerTransform.position.y > screenMax.y) //out of the screen (top) { if (playerTransform.position.x > screenMax.x) //also out on the right { pos = posType.topRight; } else if (playerTransform.position.x < screenMin.x) //also out on the left { pos = posType.topLeft; } else //not out on the horizontal axis { pos = posType.top; } } else if (playerTransform.position.y < screenMin.y) //out of the screen (bottom) { if (playerTransform.position.x > screenMax.x) //out of the screen (right) { pos = posType.bottomRight; } else if (playerTransform.position.x < screenMin.x) //out of the screen (left) { pos = posType.bottomLeft; } else { pos = posType.bottom; } } else //not out on the top { if (playerTransform.position.x > screenMax.x) //out of the screen (right) { pos = posType.right; } else if (playerTransform.position.x < screenMin.x) //out of the screen (left) { pos = posType.left; } } return(pos); }
private void setPointerPosition(posType pos) //sets position, based on the position variable { Vector2 newPosition; //new pointer position switch (pos) { case (posType.topRight): newPosition = new Vector2(screenMax.x - 1, screenMax.y - 1); break; case (posType.topLeft): newPosition = new Vector2(screenMin.x + 1, screenMax.y - 1); break; case (posType.top): newPosition = new Vector2(playerTransform.position.x, screenMax.y - 1); break; case (posType.right): newPosition = new Vector2(screenMax.x - 1, playerTransform.position.y); break; case (posType.left): newPosition = new Vector2(screenMin.x + 1, playerTransform.position.y); break; case (posType.bottomRight): newPosition = new Vector2(screenMax.x - 1, screenMin.y + 1); break; case (posType.bottomLeft): newPosition = new Vector2(screenMin.x + 1, screenMin.y + 1); break; case (posType.bottom): newPosition = new Vector2(playerTransform.position.x, screenMin.y + 1); break; default: newPosition = new Vector2(playerTransform.position.x, playerTransform.position.y); break; } pointerTransform.position = newPosition; //set new position }
void ChangeType() { if(Input.GetKey(KeyCode.A) && currentPos == posType.CENTER) { currentPos = posType.LEFT; } if (Input.GetKey(KeyCode.D) && currentPos == posType.CENTER) { currentPos = posType.RIGHT; } if (Input.GetKey(KeyCode.A) && currentPos == posType.RIGHT) { currentPos = posType.CENTER; } if (Input.GetKey(KeyCode.D) && currentPos == posType.LEFT) { currentPos = posType.CENTER; } }
private void setPointerRotation(posType pos) { switch (pos) { case posType.topRight: pointerTransform.rotation = Quaternion.Euler(0, 0, 45); break; case posType.topLeft: pointerTransform.rotation = Quaternion.Euler(0, 0, 135); break; case posType.top: pointerTransform.rotation = Quaternion.Euler(0, 0, 90); break; case posType.right: pointerTransform.rotation = Quaternion.Euler(0, 0, 0); break; case posType.left: pointerTransform.rotation = Quaternion.Euler(0, 0, 180); break; case (posType.bottomRight): pointerTransform.rotation = Quaternion.Euler(0, 0, -45); break; case (posType.bottomLeft): pointerTransform.rotation = Quaternion.Euler(0, 0, -135); break; case (posType.bottom): pointerTransform.rotation = Quaternion.Euler(0, 0, -90); break; default: pointerTransform.rotation = Quaternion.Euler(0, 0, 0); break; } }
private List<cardOptionItem> getCardOptionListByPosId(int posId, posType postype, int langId, decimal cargoAndProductPrice, CultureInfo priceStrFormat, string currency) { var posItem = getBankPosByType(postype, langId).Where(a => a.bankPosId == posId).FirstOrDefault(); // posItem is Valid if (posItem != null) { db.Entry(posItem).Collection(p => p.tbl_bankPosOption).Load(); var posOptionList = posItem.tbl_bankPosOption; List<cardOptionItem> helperList = new List<cardOptionItem>(); // Add Defult Option => Tek Çekim helperList.Add(getDefaultOption(cargoAndProductPrice, priceStrFormat, currency)); foreach (var item in posOptionList) { if (item.minBasketAmount <= cargoAndProductPrice) { cardOptionItem helper = new cardOptionItem(); helper.monthStr = item.paymentCount.ToString(); var calc = getInstallmentAmount(cargoAndProductPrice, item.paymentCount, item.additionalAmount); helper.totalPrice = calc.Item2; helper.monthPrice = calc.Item1; helper.bankPosOptionId = item.bankPosOptionId; helper.totalPriceStr = helper.totalPrice.ToString("F2", priceStrFormat) + " " + currency; helper.monthPriceStr = helper.monthPrice.ToString("F2", priceStrFormat) + " " + currency; helperList.Add(helper); } } return helperList; } else { return null; } }
internal List<cardOptionItem> getCardOptionList(int langId, decimal cargoAndProductPrice, string cardNo, posType postype, CultureInfo priceStrFormat, string currency) { var posList = getBankPosByType(postype, langId); int posId = 0; foreach (var item in posList) { // Get Pos Class var posItem = getPosClass(item.posCode); if (posItem != null) { // Is Card Relative Pos if (posItem.isBinExist(cardNo)) { posId = item.bankPosId; break; } } } // Taksitli if (posId != 0) { return getCardOptionListByPosId(posId, postype, langId, cargoAndProductPrice, priceStrFormat, currency); } else // Tek çekim Main Pos { return getMainPosOption(postype, langId, cargoAndProductPrice, priceStrFormat, currency); } }
public Horse(posType pType, posSide pSide) : base() { }
public General(posType pType, posSide pSide) : base(pType, pSide) { }
public Guard(posType pType, posSide pSide) : base(pType, pSide) { }
public Cannon(posType pType, posSide pSide) : base(pType, pSide) { }
public Elephant(posType pType, posSide pSide) : base(pType, pSide) { }
public Pieces(posType pType, posSide pSide) { this.side = pSide.ToString(); this.type = pType.ToString(); }
private List<cardOptionItem> getMainPosOption(posType postype, int langId, decimal cargoAndProductPrice, CultureInfo priceStrFormat, string currency) { var posItem = getBankPosByType(postype, langId).Where(a => a.isMainPos).FirstOrDefault(); if (posItem != null) { List<cardOptionItem> helperList = new List<cardOptionItem>(); // Only Add Defult Option => Tek Çekim helperList.Add(getDefaultOption(cargoAndProductPrice, priceStrFormat, currency)); return helperList; } else { return null; } }
public Chariot(posType pType, posSide pSide) : base(pType, pSide) { }
public List<tbl_bankPos> getBankPosByType(posType postype, int iangId) { return db.tbl_bankPos.Include("tbl_bank").Where(a => a.tbl_bank != null && a.tbl_bank.statu && a.statu && a.posTypeId == (int)postype).ToList(); }
public Soldier(posType pType, posSide pSide) : base(pType, pSide) { }