public Animotion OnCardSendToGraveyardAnimotion(RectTransform cardRect, int PlayerID) { Vector3 finalScale = new Vector3(0.2f, 0.2f, 1); List <Animotion> motionsWaitToGraveyard = new List <Animotion>(); Animotion motionTweenScaleUp = new ScaleRectTweenAnimotion(this, 1, cardRect, finalScale, 1); motionsWaitToGraveyard.Add(motionTweenScaleUp); Vector3 finalCardPosition = playerOneGraveyardLogo.position; if (PlayerID == 0) { finalCardPosition = playerOneGraveyardLogo.position; } else { finalCardPosition = playerTwoGraveyardLogo.position; } Animotion motionTweenSpawn = new SpawnCardTweenAnimotion(this, 1, cardRect, finalCardPosition, 2); motionsWaitToGraveyard.Add(motionTweenSpawn); // tengo que setear el parent List <ConfigurableMotion> configurables = new List <ConfigurableMotion>(); RectTransform parentTransform = null; if (PlayerID == 0) { parentTransform = playerOneGraveyard; } else { parentTransform = playerTwoGraveyard; } ChildParentConfigureContainer parentContainer = new ChildParentConfigureContainer(parentTransform, cardRect); ConfigureAnimotion parentChildConfigAnimotion = new ConfigureAnimotion(parentContainer, 3); configurables.Add(parentChildConfigAnimotion); //SetCanvasGroupBlockRaycastConfigureAnimotion<MikzeerGame.CardUI, Transform> blockRayCastConfigAnimotion // = new SetCanvasGroupBlockRaycastConfigureAnimotion<MikzeerGame.CardUI, Transform>(cardUI, GameCreator.Instance.playerOneGraveyard, 4); //configurables.Add(blockRayCastConfigAnimotion); CombineAnimotion combineSendToGraveyardMotion = new CombineAnimotion(this, 1, motionsWaitToGraveyard, configurables); return(combineSendToGraveyardMotion); }
public Animotion AddCardAnimotion(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 <Animotion> motionsSpawn = new List <Animotion>(); RectTransform cardRect = createdCardGameObject.GetComponent <RectTransform>(); Animotion motionTweenScaleUp = new ScaleRectTweenAnimotion(this, 1, cardRect, 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; } } Animotion motionTweenSpawn = new SpawnCardTweenAnimotion(this, 1, createdCardGameObject.transform, finalCardPosition, 2); motionsSpawn.Add(motionTweenSpawn); // tengo que setear el parent List <ConfigurableMotion> configurables = new List <ConfigurableMotion>(); ChildParentConfigureContainer parentContainer = null; if (PlayerID == 0) { parentContainer = new ChildParentConfigureContainer(cardHolderPlayerLeft, createdCardGameObject.transform); } else { parentContainer = new ChildParentConfigureContainer(cardHolderPlayerRight, createdCardGameObject.transform); } ConfigureAnimotion parentChildConfigAnimotion = new ConfigureAnimotion(parentContainer, 3, true); configurables.Add(parentChildConfigAnimotion); CardInGameUINEW cardInGameUI = createdCardGameObject.GetComponent <CardInGameUINEW>(); // activamos el canvas group para que pueda recibir raycast otra vez SetCanvasGroupBlockRaycastConfigureContainer canvasBlockRayContainer = new SetCanvasGroupBlockRaycastConfigureContainer(cardInGameUI, true); ConfigureAnimotion blackRayCastConfigAnimotion = new ConfigureAnimotion(canvasBlockRayContainer, 4, true); configurables.Add(blackRayCastConfigAnimotion); CombineAnimotion combineMoveMotion = new CombineAnimotion(this, 1, motionsSpawn, configurables); return(combineMoveMotion); }