Exemplo n.º 1
0
        internal void BeginChaining(Coordinate curCoor, ClientCard card)
        {
            Chain chain = chainPool.New();

            chain.ChainSequence = CurrentChains.Count + 1;
            chain.ChainCard     = card;
            chain.Coordinate    = curCoor;
            chain.ChainCode     = card.Data.Code;
            CurrentChains.Add(chain);

            if (curCoor.Location == (int)CardLocation.Hand)
            {
                chain.Activate(Vector3.Lerp(card.RealPosition, MainGame.Instance.MainCamera.transform.position, 0.01f));
            }
            else
            {
                int factor = curCoor.Controller == 0 ? 1 : -1;
                int repeat = 0;
                for (int i = 0; i < CurrentChains.Count - 1; ++i)
                {
                    if ((curCoor.Location & 0xE) > 0)
                    {
                        if (CurrentChains[i].Coordinate.Equals(curCoor))
                        {
                            repeat += 2;
                        }
                    }
                    else if (curCoor.Location == CurrentChains[i].Coordinate.Location &&
                             curCoor.Controller == CurrentChains[i].Coordinate.Controller)
                    {
                        repeat += 2;
                    }
                }
                if (curCoor.Location == (int)CardLocation.MonsterZone)
                {
                    chain.Activate(FieldInfo.MZonePositions[curCoor.Sequence] * factor + new Vector3(0, 0.1f, repeat * factor));
                }
                else if (curCoor.Location == (int)CardLocation.SpellZone)
                {
                    chain.Activate(FieldInfo.SZonePositions[curCoor.Sequence] * factor + new Vector3(0, 0.1f, repeat * factor));
                }
                else
                {
                    //todo activate at top
                    chain.Activate(FieldInfo.BasePositions[(CardLocation)curCoor.Location] * factor + new Vector3(0, 6, repeat * factor));
                }
            }
            card.AddAnimation(card.ChainingShowUp(), 0.45f);
        }