public Motion OnCardSendToGraveyard(RectTransform cardRect, int PlayerID) { Vector3 finalScale = new Vector3(0.2f, 0.2f, 1); List <Motion> motionsWaitToGraveyard = new List <Motion>(); //RectTransform cardRect = cardUI.GetComponent<RectTransform>(); Motion motionTweenScaleUp = new ScaleRectTweenMotion(this, cardRect, 1, finalScale, 1); motionsWaitToGraveyard.Add(motionTweenScaleUp); Vector3 finalCardPosition = playerOneGraveyardLogo.position; if (PlayerID == 0) { finalCardPosition = playerOneGraveyardLogo.position; } else { finalCardPosition = playerTwoGraveyardLogo.position; } Motion motionTweenSpawn = new SpawnCardTweenMotion(this, cardRect, 1, finalCardPosition, 2); motionsWaitToGraveyard.Add(motionTweenSpawn); // tengo que setear el parent List <Configurable> configurables = new List <Configurable>(); RectTransform parentTransform = null; if (PlayerID == 0) { parentTransform = playerOneGraveyard; } else { parentTransform = playerTwoGraveyard; } SetParentConfigureAnimotion <Transform, Transform> cardHandSetParentConfigAnimotion = new SetParentConfigureAnimotion <Transform, Transform>(cardRect, parentTransform, 3); configurables.Add(cardHandSetParentConfigAnimotion); //SetCanvasGroupBlockRaycastConfigureAnimotion<MikzeerGame.CardUI, Transform> blockRayCastConfigAnimotion // = new SetCanvasGroupBlockRaycastConfigureAnimotion<MikzeerGame.CardUI, Transform>(cardUI, GameCreator.Instance.playerOneGraveyard, 4); //configurables.Add(blockRayCastConfigAnimotion); CombineMotion combineSendToGraveyardMotion = new CombineMotion(this, 1, motionsWaitToGraveyard, configurables); return(combineSendToGraveyardMotion); }
public Motion AddCard(GameObject createdCardGameObject, int PlayerID) { Vector3 normalScale = createdCardGameObject.transform.localScale; Vector3 startScale = new Vector3(0.2f, 0.2f, 1); createdCardGameObject.transform.localScale = startScale; // hacerla animacion de instanciamiento a la mano y saliendo un poco de la pantalla List <Motion> motionsSpawn = new List <Motion>(); RectTransform cardRect = createdCardGameObject.GetComponent <RectTransform>(); Motion motionTweenScaleUp = new ScaleRectTweenMotion(this, cardRect, 1, normalScale, 1); motionsSpawn.Add(motionTweenScaleUp); Vector3 finalCardPosition = Vector3.zero; if (PlayerID == 0) { if (cardHolderPlayerLeft.transform.childCount > 0) { finalCardPosition = cardHolderPlayerLeft.GetChild(cardHolderPlayerLeft.childCount - 1).position; } else { finalCardPosition = cardHolderPlayerLeft.position; } } else { if (cardHolderPlayerRight.transform.childCount > 0) { finalCardPosition = cardHolderPlayerRight.GetChild(cardHolderPlayerRight.childCount - 1).position; } else { finalCardPosition = cardHolderPlayerRight.position; } } Motion motionTweenSpawn = new SpawnCardTweenMotion(this, createdCardGameObject.transform, 1, finalCardPosition, 2); motionsSpawn.Add(motionTweenSpawn); // tengo que setear el parent List <Configurable> configurables = new List <Configurable>(); SetParentConfigureAnimotion <Transform, Transform> cardHandSetParentConfigAnimotion = null; if (PlayerID == 0) { cardHandSetParentConfigAnimotion = new SetParentConfigureAnimotion <Transform, Transform>(createdCardGameObject.transform, cardHolderPlayerLeft, 3); } else { cardHandSetParentConfigAnimotion = new SetParentConfigureAnimotion <Transform, Transform>(createdCardGameObject.transform, cardHolderPlayerRight, 3); } configurables.Add(cardHandSetParentConfigAnimotion); CardInGameUINEW cardInGameUI = createdCardGameObject.GetComponent <CardInGameUINEW>(); // activamos el canvas group para que pueda recibir raycast otra vez SetCanvasGroupBlockRaycastConfigureAnimotion <CardInGameUINEW, Transform> blockRayCastConfigAnimotion = new SetCanvasGroupBlockRaycastConfigureAnimotion <CardInGameUINEW, Transform>(cardInGameUI, null, 4); configurables.Add(blockRayCastConfigAnimotion); //Motion motionTimer = new TimeMotion(this, 2, 2f); //motionsWaitToGraveyard.Add(motionTimer); CombineMotion combineMoveMotion = new CombineMotion(this, 1, motionsSpawn, configurables); return(combineMoveMotion); }