/// <summary> /// Desplaza las cartas de la mano para que quede centrado. /// </summary> void MoverSlotCartas() { foreach (GameObject g in CartasEnMano) { g.transform.DOLocalMoveX(slots.Children[CartasEnMano.IndexOf(g)].transform.localPosition.x, 0.3f); // apply correct sorting order and HandSlot value for later WhereIsTheCardOrEntity w = g.GetComponent <WhereIsTheCardOrEntity>(); w.Slot = CartasEnMano.IndexOf(g); w.SetearOrdenCarta(); } }
/// <summary> /// Instancia el ente y configura sus valores. /// </summary> /// <param name="ente">Ente.</param> /// <param name="ca">Ca.</param> /// <param name="idUnico">Identifier unico.</param> /// <param name="indiceSlot">Indice slot.</param> private void ConfigurarEnte(GameObject ente, CartaBase ca, int idUnico, int indiceSlot) { string tagEnte = ""; OneEnteManager manager = null; if (ente.name.Contains("Magica")) { tagEnte = "Magica"; manager = ente.GetComponent <OneMagicaManager> (); } else { tagEnte = "Criatura"; manager = ente.GetComponent <OneCreatureManager>(); } manager.CartaAsset = ca; manager.LeerDatosAsset(); foreach (Transform t in ente.GetComponentsInChildren <Transform>()) { t.tag = owner.ToString() + tagEnte; } // parent a new creature gameObject to table slots ente.transform.SetParent(slots.transform); // add a new creature to the list // Debug.Log ("insert index: " + index.ToString()); EntesOnTable.Insert(indiceSlot, ente); // let this creature know about its position WhereIsTheCardOrEntity w = ente.GetComponent <WhereIsTheCardOrEntity>(); w.Slot = indiceSlot; if (ente.tag.Contains("Low")) { //PETA w.EstadoVisual = VisualStates.MesaJugadorAbajo; } else { w.EstadoVisual = VisualStates.MesaJugadorArriba; } if (ente.GetComponents <AudioSource> () [0] != null && ente.GetComponents <AudioSource> () [0].clip != null) { ente.GetComponents <AudioSource>()[0].Play(); } // add our unique ID to this creature IDHolder id = ente.AddComponent <IDHolder>(); id.UniqueID = idUnico; ActualizarSlots(); MoverSlotCartas(); // TODO: remove this Comandas.Instance.CompletarEjecucionComanda(); }
void Awake() { // establish all the connections sr = GetComponent <SpriteRenderer>(); lr = GetComponentInChildren <LineRenderer>(); lr.sortingLayerName = "AboveEverything"; triangle = transform.Find("Triangle"); triangleSR = triangle.GetComponent <SpriteRenderer>(); manager = GetComponentInParent <OneCreatureManager>(); dondeEstaCartaOCriatura = GetComponentInParent <WhereIsTheCardOrEntity>(); }
/// <summary> /// Resetea el estado visual de la carta de la mano. /// </summary> /// <param name="card">Card.</param> /// <param name="w">The width.</param> void CambiarEstadoCartaAMano(GameObject card, WhereIsTheCardOrEntity w) { //Debug.Log("Changing state to Hand for card: " + card.gameObject.name); if (owner == AreaPosition.Low) { w.EstadoVisual = VisualStates.ManoJugadorAbajo; } else { w.EstadoVisual = VisualStates.ManoJugadorArriba; } w.SetearOrdenCarta(); Comandas.Instance.CompletarEjecucionComanda(); }
void Awake() { whereIsCard = GetComponent <WhereIsTheCardOrEntity>(); manager = GetComponent <OneCardManager>(); }
void Awake() { manager = GetComponentInParent <OneCreatureManager>(); dondeEstaCartaOCriatura = GetComponentInParent <WhereIsTheCardOrEntity>(); }
protected void Awake() { manager = GetComponent <OneCreatureManager>(); w = GetComponent <WhereIsTheCardOrEntity>(); }
/// <summary> /// Instancia la carta visual del jugador y la reparte. /// </summary> /// <param name="c">C.</param> /// <param name="UniqueID">Unique I.</param> /// <param name="fast">If set to <c>true</c> fast.</param> /// <param name="fromDeck">If set to <c>true</c> from deck.</param> /// <param name="rotarDeCara">If set to <c>true</c> rotar de cara.</param> public void DarCartaJugador(CartaPartida c, int UniqueID, bool fast = false, bool fromDeck = true, bool rotarDeCara = false) { if (!rotarDeCara) { fast = true; } GameObject card; if (fromDeck) { card = CrearCartaPorPosicion(c, DeckTransform.position, new Vector3(0f, -179f, 0f)); } else { card = CrearCartaPorPosicion(c, OtherCardDrawSourceTransform.position, new Vector3(0f, -179f, 0f)); } // save this as visual representation in CardLogic // Player ownerPlayer = GlobalSettings.Instance.Players[owner]; //Debug.Log(ownerPlayer); //Debug.Log(ownerPlayer.hand); //Debug.Log("CArdsInHand.Count: "+ ownerPlayer.hand.CardsInHand.Count); //Debug.Log("Attempted placeInHand: " +placeInHand); // ownerPlayer.hand.CardsInHand[0].VisualRepresentation = card; //Debug.Log(ownerPlayer.hand); // Set a tag to reflect where this card is foreach (Transform t in card.GetComponentsInChildren <Transform>()) { t.tag = owner.ToString() + "Card"; } // pass this card to HandVisual class AñadirCarta(card); // let the card know about its place in hand. WhereIsTheCardOrEntity w = card.GetComponent <WhereIsTheCardOrEntity>(); w.TraerAlFrente(); w.Slot = 0; w.EstadoVisual = VisualStates.Transicion; // pass a unique ID to this card. IDHolder id = card.AddComponent <IDHolder>(); id.UniqueID = UniqueID; // save this card to change its state to "Hand" when it arrives to the hand. LastDealtCard = card; if (card.GetComponent <AudioSource>() != null && ConfiguracionUsuario.Instance.Musica) { card.GetComponent <AudioSource>().Play(); } // move card to the hand; Sequence s = DOTween.Sequence(); if (!fast) { Debug.Log("Not fast!!!"); s.Append(card.transform.DOMove(DrawPreviewSpot.position, ConfiguracionUsuario.Instance.CardTransitionTime)); s.Insert(0f, card.transform.DORotate(Vector3.zero, ConfiguracionUsuario.Instance.CardTransitionTime)); s.AppendInterval(ConfiguracionUsuario.Instance.CardPreviewTime); // displace the card so that we can select it in the scene easier. s.Append(card.transform.DOLocalMove(slots.Children[0].transform.localPosition, ConfiguracionUsuario.Instance.CardTransitionTime)); } else { // displace the card so that we can select it in the scene easier. if (rotarDeCara) { s.Insert(0f, card.transform.DORotate(Vector3.zero, ConfiguracionUsuario.Instance.CardTransitionTime)); } s.Append(card.transform.DOLocalMove(slots.Children[0].transform.localPosition, ConfiguracionUsuario.Instance.CardTransitionTime)); //if (TakeCardsOpenly) //s.Insert(0f, card.transform.DORotate(Vector3.zero, DatosGenerales.Instance.CardTransitionTimeFast)); } s.OnComplete(() => CambiarEstadoCartaAMano(card, w)); }