/// <summary> /// 最下層のブロック位置計算 /// </summary> /// <param name="current"></param> /// <returns></returns> private BlockStatus drawLowestBlock(BlockStatus current, BlockStatus attempt) { // 一旦現在位置と予想位置を削除 boardInfo.DeleteBlock(attempt); boardInfo.DeleteBlock(current); // タイプのみ配置予定ブロックに変更(設定データはそのままでよい) BlockStatus attemptDown = this.current; attemptDown.Type = SharedConstant.BLOCK_TYPE_ATTEMPT; // 現在位置をどんどん下げてタイル情報設定しなおし while (true) { attemptDown.Pos.y--; if (!boardInfo.PutBlock(attemptDown)) { // 下げた位置におけなかったら1個上に戻す / attempt部分を再配置して終了 attemptDown.Pos.y++; boardInfo.PutBlock(attemptDown); break; } else { // 置けたなら即消し boardInfo.DeleteBlock(attemptDown); } } // 元々のcurrentを上書き boardInfo.PutBlock(current); return(attemptDown); }
public IEnumerator BlockPop(int t) { blockStatus = BlockStatus.destroyed; Highlighted.SetActive(false); yield return(new WaitForSeconds(ViewManager.Instance.burstInterval * t)); GameManager.Instance.PlaySound(); Vector2 OriginScale = this.transform.localScale; float timer = 0; while (timer < ViewManager.Instance.burstTime) { float x = (timer / ViewManager.Instance.burstTime); //Debug.Log(x + " " + (1 - x) * (Mathf.Pow(x, 2) + x + 1)); this.transform.localScale = Vector2.Lerp(OriginScale, Vector2.zero, 1 - Mathf.Pow(1 - x, 2)); yield return(new WaitForSeconds(Time.deltaTime)); timer += Time.deltaTime; } Highlighted.SetActive(false); this.transform.SetParent(ViewManager.Instance.BlockContainer.transform); this.gameObject.SetActive(false); yield return(null); }
/// <summary> /// 指定ブロック配置 /// </summary> /// <param name="_attemptPut"></param> /// <returns></returns> public bool PutBlock(BlockStatus attemptPut) { if (!IsBlockPuttable(attemptPut)) { // 更新可能かチェック事前チェック return(false); } int statIdx = calcIdx(attemptPut.Pos); short setType = attemptPut.Type; // (0,0)座標のブロック更新 board[statIdx] = setType; // 相対座標分のブロック更新 for (int i = 0; i < SharedConstant.RELATIVE_BLOCK_NUM; i++) { BlockSettingData settingData = SharedConstant.BLOCK_DATA[attemptPut.SettingDataIdx]; GridPos diffPos = CalcRelativeRotatePos(settingData.RelativePos[i], settingData.RotatableNum, attemptPut.RotateNum); int expectedIdx = calcIdx(attemptPut.Pos.x + diffPos.x, attemptPut.Pos.y + diffPos.y); board[expectedIdx] = setType; } return(true); }
public void SwapBlocks(HexaBlock block0, HexaBlock block1) { // BlockType Board Swap BlockType tempType = blockBoard[block0.xPos, block0.yPos]; blockBoard[block0.xPos, block0.yPos] = blockBoard[block1.xPos, block1.yPos]; blockBoard[block1.xPos, block1.yPos] = tempType; block0.blockType = blockBoard[block0.xPos, block0.yPos]; block1.blockType = blockBoard[block1.xPos, block1.yPos]; BlockStatus tempStatus = block0.blockStatus; block0.blockStatus = block1.blockStatus; block1.blockStatus = tempStatus; // sprite swap Sprite tempSpr = block0.sprRenderer.sprite; block0.sprRenderer.sprite = block1.sprRenderer.sprite; block1.sprRenderer.sprite = tempSpr; Color tempColor = block0.sprRenderer.color; block0.sprRenderer.color = block1.sprRenderer.color; block1.sprRenderer.color = tempColor; int tempHp = block0.hp; block0.hp = block1.hp; block1.hp = tempHp; }
public void CompleteOperation(MovesWithMouse.Movable movableType, bool success) { switch (movableType) { case MovesWithMouse.Movable.Ground: if (_status == BlockStatus.GreenSelected) { _status = success ? BlockStatus.Brown : BlockStatus.Green; _image.sprite = success ? brownSprite : greenSprite; if (success) { GameManager.IncrementGroundCounter(); } EnableOutline(false); } break; case MovesWithMouse.Movable.Wheat: if (_status == BlockStatus.BrownSelected) { _status = success ? BlockStatus.Grows : BlockStatus.Brown; _wheat.StartGrowing(() => _status = BlockStatus.Grown); EnableOutline(false); } break; } }
private void OnTriggerEnter2D(Collider2D other) { ObjectOverBlock = true; switch (_status) { case BlockStatus.Green: if (other.CompareTag("Ground")) { EnableOutline(true); _status = BlockStatus.GreenSelected; } break; case BlockStatus.Brown: if (other.CompareTag("Wheat")) { EnableOutline(true); _status = BlockStatus.BrownSelected; } break; case BlockStatus.Grown: if (other.CompareTag("Sickle")) { _wheat.FlyToTheCounter(); _status = BlockStatus.Brown; _image.sprite = brownSprite; } break; } }
public void setFire() { //set fire on the tile gm.firingTiles++; status = BlockStatus.Fire; //decide if animal on the tile if (Random.Range(0, 2) == 1) { hasAnimals = true; if (hasPlatypus && gm.platypusNumber > 0) { thisAnimalMaterial = gm.platypusOnFire; } else if ((hasDevil && gm.devilNumber > 0) || (hasQuoll && gm.quollNumber > 0)) { thisAnimalMaterial = gm.devilOnFire; } else if ((hasDunnart && gm.dunnartNubmer > 0) || (hasKoala && gm.koalaNumber > 0)) { thisAnimalMaterial = gm.koalaOnFire; } else if (hasEmu && gm.emuNumber > 0) { thisAnimalMaterial = gm.birdOnFire; } } else { hasAnimals = false; } }
private void initArray(BlockStatus[][] fields) { for (int i = 0; i < HEIGHT; i++) { fields[i] = new BlockStatus[WIDTH]; } }
private Color GetColor(BlockStatus status, Color hiddenColor) { switch (status) { case BlockStatus.Hidden: return(hiddenColor); case BlockStatus.LightBlue: return(Color.LightBlue); case BlockStatus.DarkBlue: return(Color.DarkBlue); case BlockStatus.Orange: return(Color.Orange); case BlockStatus.Yellow: return(Color.Yellow); case BlockStatus.Green: return(Color.Green); case BlockStatus.Red: return(Color.Red); default: return(Color.Magenta); } }
void Update() { if (NeedsRedraw) { //Show here the user can cast their spell! ShowAvailiableSquares(); } //Show the reticule! Vector3 world = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3Int iso = gridGen.WorldToCell(new Vector3(world.x, 0, world.z)); iso.x = Mathf.Clamp(iso.x, 0, gridGen.xWidth - 1); iso.y = Mathf.Clamp(iso.y, 0, gridGen.zWidth - 1); bool can_cast = GameStateManager.Instance.PlayerAgent.AbilitySystem.CanActivateTargetAbilityByTag(AbilityType, (Vector2Int)iso); MousePointerMarker.transform.position = gridGen.CellToWorld(iso); MousePointerMarker.color = can_cast ? Color.yellow : Color.red; //make callback if (Input.GetMouseButtonUp(0) && can_cast) { OnCellSelected?.Invoke(iso); BlockStatus hej = gridGen.GetCellStatus(new Vector2Int(iso.x, iso.y)); } }
bool ApplySelfEffect(Effect effect) { switch (effect.effectType) { case EffectType.DamageMultiplier: DamageMultiplierStatus multStatus = new DamageMultiplierStatus(effect.effectValue / 100f, effect.duration, owner, owner); owner.AddStatus(multStatus); return(true); case EffectType.Block: BlockStatus blockStatus = new BlockStatus(effect.effectValue, effect.duration, owner, owner); owner.AddStatus(blockStatus); return(true); case EffectType.Taunt: PartyManager.Instance.ChangeThreat(owner, effect.effectValue * 0.01f); return(true); case EffectType.Link: LinkDamageStatus link = new LinkDamageStatus(effect.effectValue, effect.duration, owner); owner.AddStatus(link); return(true); case EffectType.AddResourceCurrent: ResourceManager.Instance.SpendResources(-effect.effectValue, owner); PartyManager.Instance.ChangeThreat(owner, 0.02f); return(true); case EffectType.Cheating: CheatingStatus cheating = new CheatingStatus(effect.effectValue, effect.duration, owner); owner.AddStatus(cheating); PartyManager.Instance.ChangeThreat(owner, 0.03f); return(true); case EffectType.Protect: List <BaseUnit> units; if (owner.IsPlayer()) { units = PartyManager.Instance.GetUnits(); } else { units = AIManager.Instance.GetEnemies(); } foreach (BaseUnit u in units) { BlockStatus block = new BlockStatus(effect.effectValue, effect.duration, owner, owner); u.AddStatus(block); } return(true); case EffectType.Draw: _resourceManager.hand.Draw(effect.effectValue); return(true); } return(false); }
public PersistedBlock(BlockStatus status, uint height, string blockHash, string transactionHash, decimal amount) { Status = status; Height = height; BlockHash = blockHash; TransactionHash = transactionHash; Amount = amount; }
public IPacket ReadPacket(IMinecraftDataReader reader) { Status = (BlockStatus)reader.ReadByte(); Location = Position.FromReaderLong(reader); Face = reader.ReadByte(); return(this); }
public BlockUnlockedNotification(BlockStatus status, string poolId, ulong blockHeight, string blockHash, string symbol, string explorerLink, string blockType = "block") : base(poolId, blockHeight, symbol) { Status = status; BlockType = blockType; BlockHash = blockHash; ExplorerLink = explorerLink; }
public void _Click() { if (BlStatus == BlockStatus.initial) { BlStatus = BlockStatus.click; this.Refresh(); } }
public IPacket ReadPacket(IMinecraftDataReader reader) { Status = (BlockStatus) reader.ReadByte(); Location = Position.FromReaderLong(reader); Face = reader.ReadByte(); return this; }
public void DrawLine() { if (BlStatus == BlockStatus.clear) { BlStatus = BlockStatus.line; ClickT = 0; this.Refresh(); } }
public void SetBlock() { Highlighted.SetActive(false); this.gameObject.GetComponent <SpriteRenderer>().color = ViewManager.Instance.colorPalette [(int)block.blockColor]; ColorBlindImage.GetComponent <SpriteRenderer>().sprite = ViewManager.Instance.ColorBlindImage [(int)block.blockColor]; blockStatus = BlockStatus.idle; }
public void unClick() { if (BlStatus == BlockStatus.click) { BlStatus = BlockStatus.initial; ClickT = 0; this.Refresh(); } }
public void Clear() { if (BlStatus == BlockStatus.click || BlStatus == BlockStatus.line) { BlStatus = BlockStatus.clear; ClickT = 0; value = 0; this.Refresh(); } }
//--------------------------------------------------------------------- // Constructor //--------------------------------------------------------------------- public Block(BlockType blockType) { m_BlockType = blockType; status = BlockStatus.NORMAL; questType = BlockQuestType.CLEAR_SIMPLE; match = MatchType.NONE; m_Breed = BlockBreed.NA; m_nDurability = 1; }
/// <summary> /// 初期ブロック生成 /// </summary> /// <returns></returns> private void initializeCurrentStatus() { // 現在位置 / 設置予定位置 / 両方初期化 current = nextBlocks[0]; attempt = nextBlocks[0]; // 詰める nextBlocks[0] = nextBlocks[1]; nextBlocks[1] = generateInitBlock(); onBlockDropStart(); }
private void DrawLegendEntry(Graphics graphics, float x, float y, BlockStatus status, string text) { const int BlockWidth = 4; const int BlockHeight = 9; SolidBrush brush = new SolidBrush(UIHelper.GetColor(status)); graphics.FillRectangle(brush, x + 1, y - 1, BlockWidth, BlockHeight); Font font = new Font(FontFamily.GenericSansSerif, 8); graphics.DrawString(text, font, Brushes.Black, x + 12, y - 3); }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Oil")// 기름 먹은 경우 { BlockStatus oil = other.gameObject.GetComponent <BlockStatus>(); health = 10; } if (other.gameObject.tag == "Car")// 차에 부딪힌 경우 { health = 0; } }
private void OnTriggerStay2D(Collider2D collision) { print(collision.gameObject.name); if ((collision.gameObject.layer == 8 || collision.gameObject.layer == 9) && rb.velocity.y <= 0) { anim.SetBool("IsJumping", false); } if (collision.gameObject.layer == 9 && rb.velocity.y <= 0) { BlockStatus block = collision.GetComponent <BlockStatus>(); switch (block.type) { case "Up": Vector2 v = new Vector2(0, block.value); rb.velocity = Vector2.zero; rb.AddForce(v, ForceMode2D.Impulse); break; case "Portal": if (Input.GetKeyDown(KeyCode.UpArrow)) { GameObject[] LinkedPortal = GameObject.FindObjectsOfType <GameObject>(); foreach (GameObject ob in LinkedPortal) { if (ob.GetComponent <BlockStatus>()) { if (ob.GetComponent <BlockStatus>().type == "Portal" && ob.GetComponent <BlockStatus>().value == block.value && ob != block.gameObject) { transform.position = ob.transform.position + Vector3.up; } } } } break; case "Color": // 4 : green / 5 : blue if (block.value == 4) { transform.Find("PlayerModel").GetComponent <SpriteRenderer>().color = Color.green; } else if (block.value == 5) { transform.Find("PlayerModel").GetComponent <SpriteRenderer>().color = Color.blue; } break; } } }
public void recoverLand() { status = BlockManager.BlockStatus.Normal; gm.scorchTiles--; if (hasAnimals) { GetComponent <Renderer>().materials = new Material[] { GetComponent <Renderer>().materials[0], thisAnimalMaterial }; } else { GetComponent <Renderer>().materials = new Material[] { GetComponent <Renderer>().materials[0] }; } }
private void WriteFileData(Stream inputStream, Stream outputStream, BlockStatus blockStatus) { uint[] array = new uint[3]; if (this.CompressionMethod == 8) { array = ZipEntryAttachment.CompressAndWriteOutputStream(outputStream, inputStream, true); this.attachmentBytesWritten = array[0]; this.CheckSum = array[1]; this.attachmentSize = (long)((ulong)array[2]); return; } this.attachmentBytesWritten = ZipEntryAttachment.WriteOutputStream(outputStream, inputStream); }
void OnCollisionExit2D(Collision2D collision) { BlockStatus block = collision.gameObject.GetComponent <BlockStatus>(); if (collision.collider.CompareTag("Util Block") && (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))) { if (block.type == "Up") { Vector2 upVelocity = new Vector2(0, block.value); //collision.collider.attachedRigidbody.velocity = upVelocity; rigid.velocity = upVelocity; } } }
// 阻挡开始 private void BlockStart() { if (attackStatus == AttackStatus.AFTER_ATTACK) { if (originalData.isEnemy) { attackStatus = AttackStatus.CONFIRM_ENEMY; } else { } } blockStatus = BlockStatus.BLOCKING; }
public IEnumerable <IPersistedBlock> GetBlocks(BlockStatus status) { var blocks = new Dictionary <UInt32, IPersistedBlock>(); try { if (!IsEnabled || !IsConnected) { return(blocks.Values.ToList()); } var key = string.Empty; switch (status) { case BlockStatus.Pending: key = string.Format("{0}:blocks:pending", _coin); break; case BlockStatus.Orphaned: key = string.Format("{0}:blocks:orphaned", _coin); break; case BlockStatus.Confirmed: key = string.Format("{0}:blocks:confirmed", _coin); break; } var results = _client.ZRevRangeByScoreWithScores(key, double.PositiveInfinity, 0, true); foreach (var result in results) { var item = result.Item1; var score = result.Item2; var data = item.Split(':'); var blockHash = data[0]; var transactionHash = data[1]; var amount = decimal.Parse(data[2]); blocks.Add((UInt32)score, new PersistedBlock(status, (UInt32)score, blockHash, transactionHash, amount)); } } catch (Exception e) { _logger.Error("An exception occured while getting {0:l} blocks: {1:l}", status.ToString().ToLower(), e.Message); } return(blocks.Values.ToList()); }
/// <summary> /// Initializes a new instance of the GroupBlockModel class. /// </summary> /// <param name="blockedUnits">Number of units blocked</param> /// <param name="fromProperty">Start date and time from which the /// inventory will be blocked<br />Specify a date and time /// (without fractional second part) in UTC or with UTC offset as /// defined in <a /// href="https://en.wikipedia.org/wiki/ISO_8601">ISO8601:2004</a></param> /// <param name="grossDailyRate">Gross daily rate including VAT and /// included service fees for single occupancy. Per person /// surcharges will be added to this price based on the configured /// surcharges of the rate plan</param> /// <param name="id">Block id</param> /// <param name="pickedReservations">Number of reservations already /// picked from this block</param> /// <param name="property">The property</param> /// <param name="ratePlan">The rate plan</param> /// <param name="status">Status of the block. Possible values include: /// 'Tentative', 'Definite', 'Canceled'</param> /// <param name="to">End date and time until which the inventory will /// be blocked<br />Specify a date and time (without fractional /// second part) in UTC or with UTC offset as defined in <a /// href="https://en.wikipedia.org/wiki/ISO_8601">ISO8601:2004</a></param> /// <param name="unitGroup">The unit group</param> public GroupBlockModel(int blockedUnits, System.DateTime fromProperty, MonetaryValueModel grossDailyRate, string id, int pickedReservations, EmbeddedPropertyModel property, EmbeddedRatePlanModel ratePlan, BlockStatus status, System.DateTime to, EmbeddedUnitGroupModel unitGroup) { BlockedUnits = blockedUnits; FromProperty = fromProperty; GrossDailyRate = grossDailyRate; Id = id; PickedReservations = pickedReservations; Property = property; RatePlan = ratePlan; Status = status; To = to; UnitGroup = unitGroup; CustomInit(); }
/// <summary> /// Updates a block's status /// </summary> /// <param name="line">The line the has been modified</param> /// <param name="b">The initial block status of line, whether it has been {BLOCK} or {UNBLOCKED}</param> protected void __update_block_status(KeyValuePair<Point, Point> line, BlockStatus b) { int x = ((line.Key.X == line.Value.X) ? line.Key.X - CellSize / 2 : (line.Key.X + line.Value.X) / 2) / CellSize; int y = ((line.Key.Y == line.Value.Y) ? line.Key.Y - CellSize / 2 : (line.Key.Y + line.Value.Y) / 2) / CellSize; if (b == BlockStatus.UNBLOCKED) __apply_block_status(x, y, BlockStatus.UNBLOCKED); else if (line.Key.X == line.Value.X) __apply_block_status(x, y, BlockStatus.EAST); else if (line.Key.Y == line.Value.Y) __apply_block_status(x, y, BlockStatus.SOUTH); else throw new InvalidOperationException("Unexpected line close-up detected!"); }
private bool _HasStatus(BlockStatus flags) { return ((_status & flags) == flags); }
private void _SetStatus(BlockStatus flags) { _status |= flags; }
private void _ClearStatus(BlockStatus flags) { _status &= (~flags); }
/// <summary> /// Checkes if a grid-cell is blocked /// </summary> /// <param name="x">The grid cell's X location</param> /// <param name="y">The grid cell's Y location</param> /// <param name="blockStatus">The type of block status to validate</param> /// <returns>Returns true if the cell is blocked by the gived status; Otherwise false</returns> public bool IsBlocked(int x, int y, BlockStatus blockStatus = BlockStatus.BLOCKED) { if (__blockStatuses[x, y].HasFlag(blockStatus)) return true; switch (blockStatus) { case BlockStatus.NORTH: return y == 0 || __blockStatuses[x, y - 1].HasFlag(BlockStatus.SOUTH); case BlockStatus.EAST: return x == this.Size.Width - 1 || __blockStatuses[x + 1, y].HasFlag(BlockStatus.WEST); case BlockStatus.SOUTH: return y == this.Size.Height -1 || __blockStatuses[x, y + 1].HasFlag(BlockStatus.NORTH); case BlockStatus.WEST: return x == 0 || __blockStatuses[x - 1, y].HasFlag(BlockStatus.EAST); case BlockStatus.BLOCKED: case BlockStatus.UNBLOCKED: default: /* If these guys didn't pass the above IF-ELSE then this cell does have them */ return false; } }
public static BlockStatus ReadBlockStatus(byte[] daten, int startpos, SelectedStatusValues selStat, BlockStatus oldStatus) { BlockStatus ret = new BlockStatus(); ret.STW = oldStatus.STW; ret.Akku1 = oldStatus.Akku1; ret.Akku2 = oldStatus.Akku2; ret.AR1 = oldStatus.AR1; ret.AR2 = oldStatus.AR2; ret.DB = oldStatus.DB; ret.DI = oldStatus.DI; int pos = startpos; if ((selStat & SelectedStatusValues.STW) > 0) { ret.STW = (short?)(daten[pos] * 0x100 + daten[pos + 1]); pos += 2; } if ((selStat & SelectedStatusValues.Akku1) > 0) { ret.Akku1 = libnodave.getS32from(daten, pos); pos += 4; } if ((selStat & SelectedStatusValues.Akku2) > 0) { ret.Akku2 = libnodave.getS32from(daten, pos); pos += 4; } if ((selStat & SelectedStatusValues.AR1) > 0) { ret.AR1 = libnodave.getS32from(daten, pos); pos += 4; } if ((selStat & SelectedStatusValues.AR2) > 0) { ret.AR2 = libnodave.getS32from(daten, pos); pos += 4; } if ((selStat & SelectedStatusValues.DB) > 0) { //if (daten[pos] > 0) ret.DB = libnodave.getU16from(daten, pos + 2); //if (daten[pos + 1] > 0) ret.DI = libnodave.getU16from(daten, pos + 4); pos += 6; } return ret; }
private IEnumerable<IFinalizedBlock> GetFinalizedBlocks(BlockStatus status) { var blocks = new Dictionary<UInt32, IFinalizedBlock>(); if (!IsEnabled || !IsConnected) return blocks.Values.ToList(); if (status == BlockStatus.Pending) throw new Exception("Pending is not a valid finalized block status"); var coin = _poolConfig.Coin.Name.ToLower(); // the coin we are working on. string key = string.Empty; switch (status) { case BlockStatus.Kicked: key = string.Format("{0}:blocks:kicked", coin); break; case BlockStatus.Orphaned: key = string.Format("{0}:blocks:orphaned", coin); break; case BlockStatus.Confirmed: key = string.Format("{0}:blocks:confirmed", coin); break; } var task = _database.SortedSetRangeByRankWithScoresAsync(key, 0, -1, Order.Ascending, CommandFlags.HighPriority); var results = task.Result; foreach (var result in results) { var data = result.Element.ToString().Split(':'); var blockHash = data[0]; var transactionHash = data[1]; switch (status) { case BlockStatus.Kicked: blocks.Add((UInt32) result.Score, new KickedBlock((UInt32) result.Score, blockHash, transactionHash, 0, 0)); break; case BlockStatus.Orphaned: blocks.Add((UInt32)result.Score, new OrphanedBlock((UInt32)result.Score, blockHash, transactionHash, 0, 0)); break; case BlockStatus.Confirmed: blocks.Add((UInt32)result.Score, new ConfirmedBlock((UInt32)result.Score, blockHash, transactionHash, 0, 0)); break; } } return blocks.Values.ToList(); }
protected override void Update() { if (_companionScript.IsIdle() == false && (_companionScript.currentAction != Character.CharacterAction.Pushing && _companionScript.currentAction != Character.CharacterAction.Pulling)) return; base.Update(); switch(_status) { case BlockStatus.BeingPushed: { if (aiTargetNode.objectActive) { var direction = ( _targetMovementPosition - _block.transform.position ); direction.y = 0; _block.transform.position += direction.normalized * Time.deltaTime; if (direction.sqrMagnitude < 0.1f) { _block.transform.position = _targetMovementPosition; _companionScript.SetCurrentAction(Character.CharacterAction.None); _status = BlockStatus.Idle; } } else { _successfulGesture = false; _companionScript.SetCurrentAction(Character.CharacterAction.None); _status = BlockStatus.Idle; } } break; case BlockStatus.Idle: { if (_successfulGesture) { if (aiTargetNode.objectActive) { if (_companionScript.waitingAtTarget) { RaycastHit hit; if (CheckForValidTargets(out hit)) { var targetHit = hit.transform.gameObject.GetComponent<BlockTrackTarget>(); if (targetHit && (targetHit.occupyingBlock == false || targetHit.occupyingBlock == _block)) { /* We're going to make it occupied here so that a block can't * be pushed onto the same one if the push gets interrupted. */ _block.currentlyOccupying = targetHit; targetHit.occupyingBlock = _block; _targetMovementPosition = hit.transform.position; _targetMovementPosition.y = _block.transform.position.y; _status = BlockStatus.BeingPushed; _companionScript.SetCurrentAction(_blockBeingPushed ? Character.CharacterAction.Pushing : Character.CharacterAction.Pulling); } else { // Target is occupied so just return to the player _player.ActivateObject(this); _companionScript.GetEmotions().InstantiateEmoticon(Emotions.Bad); } } _successfulGesture = false; _companionScript.transform.rotation = Quaternion.LookRotation(transform.forward); // Set the angular speed to 0 to stop the companion spinning _companionScript.GetAgent().angularSpeed = 0; } } else { _successfulGesture = false; } } else { /* This is needed so we can have multiple objects in the same scene * without constantly trying to update and set player as target */ if (_objectUsed && _listening == false) { _objectUsed = false; _companionScript.GetAgent().angularSpeed = 360; _player.ActivateObject(this); } } } break; } }
public BlockControl() { InitializeComponent(); BlStatus = BlockStatus.initial; }
/// <summary> /// Construct a new grid /// </summary> /// <param name="bs">Target block-status of the grid</param> /// <param name="pb">The conatiner's handler</param> public Grid(BlockStatus[,] bs, System.Windows.Forms.PictureBox pb) : this(new Size(bs.GetLength(0), bs.GetLength(1))) { this.__blockStatuses = bs; this.__drawFromBlockStatuses = true; this.__pictureBox = pb; }
/// <summary> /// Properly applies a block status to cell /// </summary> /// <param name="x">The grid cell's X location</param> /// <param name="y">The grid cell's Y location</param> /// <param name="blockStatus">The block status</param> private void __apply_block_status(int x, int y, BlockStatus blockStatus) { if (blockStatus == BlockStatus.UNBLOCKED) __blockStatuses[x, y] = blockStatus; else { __blockStatuses[x, y] &= ~BlockStatus.UNBLOCKED; __blockStatuses[x, y] = __blockStatuses[x, y] | blockStatus; } }