// Use this for initialization void Start() { gManager = GameManager.gManager; associatedCase = GetComponent <CaseBehavior>(); associatedTile = transform.parent.GetComponent <TileBehaviorIHM>(); clockwiseRotation = transform.parent.GetComponent <TileBehavior>().clockwiseRotation; }
private void ExecuteActionRoomRotated(ActionRoomRotated action) { if (gManager.onlineGameInterface.WaitingForExpectedState()) { gManager.onlineGameInterface.ForceEndReplayAction(); return; } TileBehaviorIHM tile = GetTileOfIndex(action.tileIndex).GetComponent <TileBehaviorIHM>(); CharacterBehaviorIHM chara = GetTokenByNameAndPlayerId(action.tokenName, action.playerId).GetComponent <CharacterBehaviorIHM>(); chara.characterSelection(); tile.inverseRotationDirection = (tile.associatedTile.clockwiseRotation != action.clockwise); tile.enableTileRotation(); // enable rotation, apply the rotation and than disable rotation // EndReplayAction is called at the end of the rotation. }
public void enableTileRotation() { gManager.actionWheel.resetButtonsActions(); if (highlight != null) { disableHighlight(); hideArrow(); Debug.Assert(associatedTile.canRotateSisterTile()); TileBehaviorIHM sisterTile = associatedTile.getSisterTile().GetComponent <TileBehaviorIHM>(); sisterTile.disableHighlight(); sisterTile.hideArrow(); } gManager.tilePourRotation = gameObject; originalDirection = transform.rotation; SpriteRenderer[] spriteRenderers = GetComponentsInChildren <SpriteRenderer>(); foreach (SpriteRenderer sR in spriteRenderers) { sR.sortingLayerName = "HUD"; } //GetComponent<SpriteRenderer>().sortingLayerName = "Selection"; for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).GetComponent <CaseBehavior>() != null) { foreach (Token t in transform.GetChild(i).GetComponent <CaseBehavior>().tokens_) { t.GetComponent <TokenIHM>().forceEndScaleValue(); t.transform.parent = transform.GetChild(i); t.GetComponent <TokenIHM>().changeSortingLayer("Selection"); } } } scaleChangeStartTime = Time.time; gManager.playSound(engagingRotation); newScaleValue = stdScaleValue * coeffRotatingScaleValue; Vector3 newScale = new Vector3(newScaleValue, newScaleValue, 1); iTween.ScaleTo(gameObject, iTween.Hash("name", "scaleTileUp", "scale", newScale, "time", SCALE_UP_DURATION, "easetype", iTween.EaseType.linear, "oncomplete", "enableTileInteraction")); //StartCoroutine(scaleTileUp()); }