//swap internal void Swap(PlayingObject item1, PlayingObject item2) { ColumnScript firstColumn = item1.myColumnScript; //the column script belongs to ColumnScript secondColumn = item2.myColumnScript; PlayingObject temp = item1; item1.transform.parent = secondColumn.transform; //the first chess's parent node is assigned values by the second column item2.transform.parent = firstColumn.transform; item1.myColumnScript = secondColumn; item2.myColumnScript = firstColumn; firstColumn.playingObjectsScriptList.RemoveAt(item1.indexInColumn); firstColumn.playingObjectsScriptList.Insert(item1.indexInColumn, item2); secondColumn.playingObjectsScriptList.RemoveAt(item2.indexInColumn); secondColumn.playingObjectsScriptList.Insert(item2.indexInColumn, item1); int tempIndex = item1.indexInColumn; item1.indexInColumn = item2.indexInColumn; item2.indexInColumn = tempIndex; }
internal void Swipe(PlayingObject item1, PlayingObject item2) { ColumnScript firstColumn = item1.myColumnScript; ColumnScript secondColumn = item2.myColumnScript; PlayingObject temp = item1; item1.transform.parent = secondColumn.transform; item2.transform.parent = firstColumn.transform; item1.myColumnScript = secondColumn; item2.myColumnScript = firstColumn; firstColumn.playingObjectsScriptList.RemoveAt(item1.indexInColumn); firstColumn.playingObjectsScriptList.Insert(item1.indexInColumn, item2); secondColumn.playingObjectsScriptList.RemoveAt(item2.indexInColumn); secondColumn.playingObjectsScriptList.Insert(item2.indexInColumn, item1); int tempIndex = item1.indexInColumn; item1.indexInColumn = item2.indexInColumn; item2.indexInColumn = tempIndex; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// internal ArrayList GetRemainingObjects() { if (allPlayingObjectScripts == null) { return(null); } currentAvailableObjectsNames = new ArrayList(); currentAvailableObjects = new ArrayList(); GameObject[] objects = GameObject.FindGameObjectsWithTag("Playing Object"); for (int i = 0; i < objects.Length; i++) { string tempName = objects[i].name; PlayingObject playObj = objects[i].GetComponent <PlayingObject>(); if (!currentAvailableObjectsNames.Contains(tempName) && objects[i].name != "DummyBall(Clone)" && objects[i].name != "StoneBall(Clone)" && playObj.isConnected) { currentAvailableObjectsNames.Add(tempName); GetObjectReference(tempName); } } if (currentAvailableObjects.Count == 0) { return(null); } else { return(currentAvailableObjects); } }
IEnumerator BurstAll() { universalPlayingObject.DestroyMe(); for (int i = 0; i < ColumnManager.instance.gameColumns.Length; i++) { for (int j = 0; j < ColumnManager.instance.gameColumns[i].playingObjectsScriptList.Count; j++) { if ((PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[j]) { if (((PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[j]).name == horizontalPOName) { PlayingObject po = ((PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[j]); if (po.brust == false) { po.specialObjectScript.AssignBrustToItsTarget(); yield return(new WaitForSeconds(.6f)); } } } } } print("1"); GameOperations.instance.RemoveBrustItems(); GameOperations.instance.Invoke("AddMissingItems", .1f); }
void Start() { if (this.gameObject.layer == 13) { myPlayingObject = GetComponent <PlayingObject> (); if (myPlayingObject.objectType == ObjectType.Horizontal || myPlayingObject.objectType == ObjectType.Vertical) { string a = name.Substring(name.Length - 8, 1); name = "Playing Object " + 5 + "(Clone)"; } } else { myPlayingObject = GetComponent <PlayingObject>(); if (myPlayingObject.objectType == ObjectType.Horizontal || myPlayingObject.objectType == ObjectType.Vertical) { string a = name.Substring(name.Length - 8, 1); name = "Playing Object " + a + "(Clone)"; } } Invoke("Start1", .05f); }
internal void StartSwapProcess(PlayingObject universalPO,PlayingObject horizontalPO) { horizontalPOName = horizontalPO.name; universalPlayingObject = universalPO; horizontalPlayingObject = horizontalPO; StartCoroutine(ChangeAllToOne()); }
public Adyacentes(PlayingObject po) { own = po; arriba = null; abajo = null; derecha = null; izquierda = null; }
internal void StartSwapProcess(PlayingObject universalPO, PlayingObject horizontalPO) { horizontalPOName = horizontalPO.name; universalPlayingObject = universalPO; horizontalPlayingObject = horizontalPO; StartCoroutine(ChangeAllToOne()); }
internal void AssignBurstUniversalObject(PlayingObject _other) { electricEffectList = new ArrayList(); other = _other; point1 = other.transform.position; myPlayingObject.brust = true; StartCoroutine(ShowEffect()); }
internal void SwapTwoItems(PlayingObject item1, PlayingObject item2) { iTween.Defaults.easeType = iTween.EaseType.easeOutBack; GameManager.instance.isBusy = true; object1 = item1.gameObject; object2 = item2.gameObject; pos1 = item1.transform.position; pos2 = item2.transform.position; //exchange animation iTween.MoveTo(object1, pos2, GameManager.instance.swappingTime); iTween.MoveTo(object2, pos1, GameManager.instance.swappingTime); ObjectType type1 = item1.objectType; ObjectType type2 = item2.objectType; //Normal type if (type1 == ObjectType.None && type2 == ObjectType.None) { if (item1.isMovePossibleInDirection(GetDirectionOfSecondObject(object1, object2)) == false && (item2.isMovePossibleInDirection(GetDirectionOfSecondObject(object2, object1)) == false)) { Invoke("ChangePositionBack", GameManager.instance.swappingTime); return; } else { GameOperations.instance.StopShowingHint(); Swap(item1, item2); GameOperations.instance.Invoke("AssignNeighbours", .1f); } } //Special type else if ((type2 == ObjectType.None && (type1 == ObjectType.Horizontal || type1 == ObjectType.Vertical)) || (type1 == ObjectType.None && (type2 == ObjectType.Horizontal || type2 == ObjectType.Vertical))) { if (item1.isMovePossibleInDirection(GetDirectionOfSecondObject(object1, object2)) == false && (item2.isMovePossibleInDirection(GetDirectionOfSecondObject(object2, object1)) == false)) { Invoke("ChangePositionBack", GameManager.instance.swappingTime); return; } //meet the condition, swap the chesses formally else { GameOperations.instance.StopShowingHint(); Swap(item1, item2); GameOperations.instance.Invoke("AssignNeighbours", .1f); } } else { GetComponent <SwapSpecialObjects>().Swap(item1, item2); } }
void Start() { myPlayingObject = GetComponent <PlayingObject>(); if (myPlayingObject.objectType == ObjectType.Horizontal || myPlayingObject.objectType == ObjectType.Vertical) { string a = name.Substring(name.Length - 8, 1); name = "Playing Object " + a + "(Clone)"; } Invoke("Start1(myPlayingObject)", .05f); }
internal void SwapTwoItems(PlayingObject item1, PlayingObject item2) { iTween.Defaults.easeType = iTween.EaseType.easeOutBack; GameManager.instance.isBusy = true; object1 = item1.gameObject; object2 = item2.gameObject; pos1 = item1.transform.position; pos2 = item2.transform.position; iTween.MoveTo(object1, pos2, GameManager.instance.swappingTime); iTween.MoveTo(object2, pos1, GameManager.instance.swappingTime); ObjectType type1 = item1.objectType; ObjectType type2 = item2.objectType; if (type1 == ObjectType.None && type2 == ObjectType.None) { if (item1.isMovePossibleInDirection(GetDirectionOfSecondObject(object1, object2)) == false && (item2.isMovePossibleInDirection(GetDirectionOfSecondObject(object2, object1)) == false)) { Invoke("ChangePositionBack", GameManager.instance.swappingTime); return; } else { GameOperations.instance.StopShowingHint(); Swipe(item1, item2); GameOperations.instance.Invoke("AssignNeighbours", .1f); } } else if ((type2 == ObjectType.None && (type1 == ObjectType.Horizontal || type1 == ObjectType.Vertical)) || (type1 == ObjectType.None && (type2 == ObjectType.Horizontal || type2 == ObjectType.Vertical))) { if (item1.isMovePossibleInDirection(GetDirectionOfSecondObject(object1, object2)) == false && (item2.isMovePossibleInDirection(GetDirectionOfSecondObject(object2, object1)) == false)) { Invoke("ChangePositionBack", GameManager.instance.swappingTime); return; } else { GameOperations.instance.StopShowingHint(); Swipe(item1, item2); GameOperations.instance.Invoke("AssignNeighbours", .1f); } } else { GetComponent<SwapSpecialObjects>().Swap(item1, item2); } }
internal bool isMovePossibleInDirection(int dir) { parentCallingScript = this; if (adjacentItems[dir]) { if (adjacentItems[dir].JustCheckIfCanBrust(name, dir)) { return(true); } } return(false); }
void PowerIsHorizontal() { int itemIndex = myPlayingObject.indexInColumn; for (int i = 0; i < ColumnManager.instance.gameColumns.Length; i++) { if (ColumnManager.instance.gameColumns[i].playingObjectsScriptList[itemIndex] != null) { PlayingObject po = (PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[itemIndex]; po.AssignBurst("normal"); po.DestroyMe(); } } CreateEffect(); }
void PowerIsVertical() { int itemIndex = myPlayingObject.indexInColumn; for (int i = 0; i < myPlayingObject.myColumnScript.playingObjectsScriptList.Count; i++) { if (myPlayingObject.myColumnScript.playingObjectsScriptList[i] != null) { PlayingObject po = (PlayingObject)myPlayingObject.myColumnScript.playingObjectsScriptList[i]; po.AssignBurst("normal"); po.DestroyMe(); } } CreateEffect(); }
internal bool isMovePossibleInDirection(int dir) { parentCallingScript = this; switch (dir) { case 0: if (adjacentItems.Izquierda) { if (adjacentItems.Izquierda.JustCheckIfCanBrust(name, dir)) { return(true); } } break; case 1: if (adjacentItems.Derecha) { if (adjacentItems.Derecha.JustCheckIfCanBrust(name, dir)) { return(true); } } break; case 2: if (adjacentItems.Arriba) { if (adjacentItems.Arriba.JustCheckIfCanBrust(name, dir)) { return(true); } } break; case 3: if (adjacentItems.Abajo) { if (adjacentItems.Abajo.JustCheckIfCanBrust(name, dir)) { return(true); } } break; } return(false); }
internal void FreeMachine() { GameManager.instance.objectFallingDuration = GameManager.instance.initialObjectFallingDuration; delay = baseDelay; GameManager.instance.isBusy = false; if (item1) { item1.UnSelectMe(); } if (item2) { item2.UnSelectMe(); } item1 = null; item2 = null; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Reassign Adjacent Playing Objects of the current Object internal void RefreshAdjacentObjectList() { adjacentPlayingObjects = new PlayingObject[numberOfAdjacentObjects]; for (int i = 0; i < numberOfAdjacentObjects; i++) { PlayingObject temp = GetObjectInTheDirection(adjacentObjectAngles[i]); if (temp != null) { adjacentPlayingObjects[i] = temp; if (i < 3) { temp.adjacentPlayingObjects[i + 3] = this; } else { temp.adjacentPlayingObjects[i - 3] = this; } } } }
IEnumerator ChangeAllToOne() { yield return(new WaitForSeconds(GameManager.instance.swappingTime)); for (int i = 0; i < ColumnManager.instance.gameColumns.Length; i++) { for (int j = 0; j < ColumnManager.instance.gameColumns[i].playingObjectsScriptList.Count; j++) { if ((PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[j]) { if (((PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[j]).name == horizontalPOName) { PlayingObject po = ((PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[j]); if (po.objectType == ObjectType.None) { Destroy(((PlayingObject)ColumnManager.instance.gameColumns[i].playingObjectsScriptList[j]).gameObject); GameObject pref; if (Random.value < .5f) { pref = horizontalPlayingObject.horizontalPowerPrefab; } else { pref = horizontalPlayingObject.verticalPowerPrefab; } ColumnManager.instance.gameColumns[i].ChangeItem(j, pref, horizontalPOName); SoundFxManager.instance.tickSound.Play(); yield return(new WaitForSeconds(.2f)); } } } } } StartCoroutine(BurstAll()); }
internal void Swap(PlayingObject _item1, PlayingObject _item2) { item1 = _item1; item2 = _item2; type1 = item1.objectType; type2 = item2.objectType; if ((type1 == ObjectType.Horizontal || type1 == ObjectType.Vertical) && (type2 == ObjectType.Horizontal || type2 == ObjectType.Vertical)) { ObjectsAreOfTypeHorizontal(); } if ((type1 == ObjectType.Universal && type2 == ObjectType.None) || (type1 == ObjectType.None && type2 == ObjectType.Universal)) { ObjetsAreOfTypeUniversalAndNone(); } if ((type1 == ObjectType.Universal && (type2 == ObjectType.Horizontal || type2 == ObjectType.Vertical)) || (type2 == ObjectType.Universal && (type1 == ObjectType.Horizontal || type1 == ObjectType.Vertical))) { ObjetsAreOfTypeUniversalAndHorizontal(); } }
internal void Swap(PlayingObject _item1, PlayingObject _item2) { item1 = _item1; item2 = _item2; type1 = item1.objectType; type2 = item2.objectType; if ((type1 == ObjectType.Horizontal || type1 == ObjectType.Vertical) && (type2 == ObjectType.Horizontal || type2 == ObjectType.Vertical)) { ObjectsAreOfTypeHorizontal(); } if((type1 == ObjectType.Universal && type2 == ObjectType.None) || (type1 == ObjectType.None && type2 == ObjectType.Universal)) { ObjetsAreOfTypeUniversalAndNone(); } if ((type1 == ObjectType.Universal && (type2 == ObjectType.Horizontal || type2 == ObjectType.Vertical)) || (type2 == ObjectType.Universal && (type1 == ObjectType.Horizontal || type1 == ObjectType.Vertical))) { ObjetsAreOfTypeUniversalAndHorizontal(); } }
void Start() { playingObjectScript = GetComponent <PlayingObject>(); }
void Start() { playingObjectScript = GetComponent<PlayingObject>(); }
void OnEnable() { targetPlayer = (PlayingObject)target; }
void Start() { myPlayingObject = GetComponent<PlayingObject>(); if (myPlayingObject.objectType == ObjectType.Horizontal || myPlayingObject.objectType == ObjectType.Vertical) { string a = name.Substring(name.Length - 8, 1); name = "Playing Object " + a + "(Clone)"; } Invoke("Start1", .05f); }
internal void FreeMachine() { GameManager.instance.objectFallingDuration = GameManager.instance.initialObjectFallingDuration; delay = baseDelay; GameManager.instance.isBusy = false; if (item1) item1.UnSelectMe(); if (item2) item2.UnSelectMe(); item1 = null; item2 = null; }
internal bool isMovePossibleInDirection(int dir) { parentCallingScript = this; if (adjacentItems[dir]) { if (adjacentItems[dir].JustCheckIfCanBrust(name, dir)) { return true; } } return false; }