void Awake()
    {
        spawnPoint = GameObject.Find("GameCore").GetComponent <GameController>().spawnPoints[(int)chooseSpawnPoint];
        cameraC    = GameObject.Find("Main Camera").GetComponent <CameraController>() as CameraController;

        myAnim     = GetComponent <Animator>();
        gC         = FindObjectOfType <GameController>() as GameController;
        enemyPhase = EnemyPhase.start;         // first phase, till enemy will rich the ball
        myTr       = transform;
        // myTr.position = spawnPoint.position;

        // transform.rotation = Ground.worldRot;          // set direction of current enemy at the beggining of movement
        ball         = FindObjectOfType <Ball>();
        thirdOfHight = GetComponent <Collider2D>().bounds.size.y / 2;             // calculate third part of the enemy

        stuckTime = namberOfCicles * (2 * Mathf.PI * Ball.ballRadius / gC.speed); // calculate stuck time in the ball

        myStartVel    = myTr.up + myTr.right;                                     // in the end phase it is direction where enemy will be thrown in the world space
        myVertVel     = new Vector2(0, 0);                                        // starting speed of falling
        normolizedVec = new Vector2(0.0f, 1.0f);

        relSpeedValue = Random.Range(minMaxRelSpeed.x, minMaxRelSpeed.y); //generate te current enemy's speed
        distanceValue = Random.Range(minMaxDistanceBetween.x, minMaxDistanceBetween.y);
        timeBetween   = distanceValue / gC.speed + relSpeedValue;

        //myTr.position = spawnPoint.position;
    }
    // 引数で必要なデータを受け取ればいいのでは?
    public override IEnumerator Execute(BattleContext battleContext)
    {
        // 技選択をしたら次のフェーズにいく
        yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.Space)));

        int currentID = battleContext.windowBattleMenuCommand.currentID;

        if (currentID == 0)
        {
            // 0なら攻撃
            battleContext.player.selectCommand = battleContext.player.commands[0];
            battleContext.player.target        = battleContext.enemy;
            next = new EnemyPhase();
        }
        else if (currentID == 1)
        {
            next = new ChooseSpellCommandPhase();
        }
        else if (currentID == 3)
        {
            // アイテム使用
            next = new ChooseItemCommandPhase();
        }
        else
        {
            // それ以外なら再度ChooseCommandPhaseになる
            next = new ChooseCommandPhase();
        }


        Debug.Log("ChooseCommandPhase");
    }
Esempio n. 3
0
    public override IEnumerator Execute(BattleContext battleContext)
    {
        // アイテム一覧の表示
        battleContext.windowBattleItemCommand.CreateSelectableText(battleContext.player.GetStringOfItem());
        yield return(null);

        battleContext.windowBattleItemCommand.Open();

        yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Escape)));

        if (Input.GetKeyDown(KeyCode.Space))
        {
            // 選択したアイテム
            int currentID = battleContext.windowBattleItemCommand.currentID;
            // コマンドの設定
            battleContext.player.selectCommand = battleContext.player.inventory[currentID];
            //ターゲットの設定
            battleContext.player.SetTarget();
            next = new EnemyPhase();
        }
        else
        {
            // escの処理
            battleContext.windowBattleMenuCommand.Select();
            next = new ChooseCommandPhase();
        }

        battleContext.windowBattleItemCommand.gameObject.SetActive(false);
    }
Esempio n. 4
0
    void Start()
    {
        stateMachine = GetComponent <StateMachine>();
        setupPhase   = GetComponent <SetupPhase>();
        enemyPhase   = GetComponent <EnemyPhase>();
        buildPhase   = GetComponent <IntermissionPhase>();

        patioHealth            = GameObject.FindGameObjectWithTag("Patio").GetComponent <Health>();
        player                 = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
        stateMachine.nextPhase = setupPhase; //set the default phase
        musicPlayer            = GetComponent <AudioSource>();
    }
    void Update()
    {
        switch (enemyPhase)
        {
        case EnemyPhase.start:


            // move enemy to the ball
            myTr.Translate(myTr.right * (gC.speed + relSpeedValue) * Time.deltaTime, Space.World);

            // check if enemy isCatchable (not a bird) and catch him if the enemy riches the ball
            if (isCatchable && myTr.position.x >= ball.transform.position.x + 2)
            {
                // and if it's true, set ball as enemy's parent
                myTr.SetParent(ball.rollingElement.transform);

                // and set the position at the distance equal center of the ball minus radius and fourth part of the enemy
                myTr.position = ball.rollingElement.transform.position - myTr.up * (Ball.ballRadius + thirdOfHight);

                // activate shaking
                StartCoroutine(cameraC.Shake(cameraC.EnemyClash));

                // then change enemyPhase to next one
                enemyPhase = EnemyPhase.middle;
            }
            break;

        case EnemyPhase.middle:
            myAnim.SetBool("middle", true);
            // after enemy was glued earliar it is staying on the ball during stuck time
            Invoke("ChangeEnemyPhaseToEnd", stuckTime);

            break;

        case EnemyPhase.end:
            myAnim.SetBool("end", true);

            myTr.Translate(((Vector3)myStartVel * throwPower + (Vector3)myVertVel * 1.5f) * Time.deltaTime, Space.World);
            myVertVel = myVertVel - normolizedVec * 9.807f * Time.deltaTime;
            myTr.Rotate(0, 0, GameController.worldAngVel * Time.deltaTime, Space.Self);
            Invoke("Destroy", 3.0f);

            break;

        default:
            break;
        }
    }
Esempio n. 6
0
    public void CheckForPhaseChange()
    {
        var phaseChanged = false;

        foreach (var phase in _phases)
        {
            if (phase.IsWithinPhaseThreshold(UtilitiesER.Remap(0, _maxHealth, 0, 100, _health)) && phase != _currentPhase)
            {
                _currentPhase     = phase;
                _attackOrderIndex = 0;
                _attackTimer      = _currentPhase._attackCooldown;
                if (_currentPhase._usesPhaseTransitionAnimation)
                {
                    _animatedInterface.AnimationTriggerWithCallback("PhaseTransition", RestartAttacking);
                    phaseChanged = true;
                }
            }
        }

        if (!phaseChanged)
        {
            RestartAttacking();
        }
    }
Esempio n. 7
0
    public void SpawEnemy(EnemyPhase phase)
    {
        curPhase = phase;
        List <GameObject> enemyPhase = null;

        switch (phase)
        {
        case EnemyPhase.FirstPhase:
            enemyPhase = EnemyPhase01;
            break;

        case EnemyPhase.SecondPhase:
            enemyPhase = EnemyPhase02;
            break;

        case EnemyPhase.ThirdPhase:
            enemyPhase = EnemyPhase03;
            break;

        case EnemyPhase.FinalPhase:
            enemyPhase = EnemyPhase04;
            break;
        }
        GameObject enemyPrefab = ResourceManager.Instance.LoadPrefab("Fight/Enemy/FlowerMonster-Blue") as GameObject;

        if (enemyPhase != null && enemyPhase.Count != 0)
        {
            foreach (GameObject go in enemyPhase)
            {
                GameObject enemy = Instantiate(enemyPrefab) as GameObject;
                enemy.transform.parent        = go.transform;
                enemy.transform.localPosition = Vector3.zero;
                EnemyManager.Instance.AddEnemy(enemy);
            }
        }
    }
Esempio n. 8
0
    void Hit(float damage)
    {
        if (damage < 0)
            damage = 1f;

        if ((HP -= damage) <= 0)
        {
            StartCoroutine(Dead());
            enemy_phase = EnemyPhase.DEAD;
        }
        else
            StartCoroutine(Kiraring());
    }
Esempio n. 9
0
        //configures data
        public virtual void Init(Enemy_ScriptObject scriptObject, Transform attackSource, EnemyPhase phase)
        {
            animator     = gameObject.GetComponent <Animator>();
            spotRadius   = scriptObject.spotRadius;
            attackRadius = scriptObject.attackRadius;
            facingRight  = scriptObject.facingRight;
            attackRate   = scriptObject.attackRate;

            if (phase == EnemyPhase.Phase2)
            {
                attackRate /= scriptObject.attackRateMultiplier;
            }
        }
 public void ChangeEnemyPhaseToEnd()
 {
     enemyPhase  = EnemyPhase.end;
     myTr.parent = null;
 }
Esempio n. 11
0
        public override void Init(Enemy_ScriptObject scriptObject, Transform attackSource, EnemyPhase phase)
        {
            base.Init(scriptObject, attackSource, phase);

            //add the phase sub-classes at the dictionary
            phaseDict.Add(EnemyPhase.Phase1, new Phase1(this));
            phaseDict.Add(EnemyPhase.Phase2, new Phase2(this));

            chosenPhase       = phaseDict[phase];
            projectilePrefab  = scriptObject.projectilePrefab;
            this.attackSource = attackSource;
        }
Esempio n. 12
0
        private Coroutine rollCoroutine;               //asynchronous work

        public override void Init(Enemy_ScriptObject scriptObject, Transform attackSource, EnemyPhase phase)
        {
            base.Init(scriptObject, attackSource, phase);

            //add the phase sub-classes at the dictionary
            phaseDict.Add(EnemyPhase.Phase1, new Phase1(this));
            phaseDict.Add(EnemyPhase.Phase2, new Phase1(this));

            chosenPhase = phaseDict[phase];

            rollRigid = GetComponent <Rigidbody2D>();
            rollSpeed = scriptObject.movementSpeed * 25f;
        }
Esempio n. 13
0
 void Update()
 {
     switch (enemy_phase)
     {
         case EnemyPhase.INTRO:
             my_AI();
             if (!IsOutOfScreen())//객체가 화면 안에 있는지 체크
                 enemy_phase = EnemyPhase.ACTION;
             break;
         case EnemyPhase.ACTION:
             my_AI();
             if (IsOutOfScreen())
                 DestroyImmediate(gameObject);
             break;
         case EnemyPhase.PAUSE:
             if (moved_pos != Vector3.zero)
             {
                 moved_pos = Vector3.zero;
             }
             break;
         case EnemyPhase.DEAD:
             break;
     }
 }
Esempio n. 14
0
    int[] state_overridden = new int[NumberOfStates]; // It's like a semaphore

    // Use this for initialization
    void Awake()
    {
        enemy_phase = EnemyPhase.INTRO;
        animator = gameObject.GetComponent<Animator>();
    }
Esempio n. 15
0
    void SendInformationToOpponent(int cardID, int gameAction, int other1, int other2, string str1, int other3 = 0)
    {
        CardIdentifier _cardID = (CardIdentifier)cardID;
        GameAction _gameAction = (GameAction)gameAction;

        DataTransferManager.getTransferManager().ExecuteDataTransfer(new DataTransfer(_cardID, _gameAction, other1, other2, other3, str1));

        if(_gameAction == GameAction.LOSE_BY_CARD_EFFECT)
        {
            bGameEnded = true;
            bPauseGameplay = false;
            bWinByCardEffect = false;
            bLoseByCardEffect = true;
        }
        else if(_gameAction == GameAction.FORCE_DAMAGE_CHECK)
        {
            ForceDamageCheck(other1);
        }
        else if(_gameAction == GameAction.FROM_DECK_TO_GUARDIANCIRCLE)
        {
            Card tempCard = enemyDeck.DrawCard();
            Data.FillCardWithData(tempCard, _cardID);
            guardZone.AddToGuardZone(tempCard, false);
            //guardZone.AddExtraPower(tempCard.shield);
            CardToAttack.AddExtraShield(tempCard.shield);
            tempCard.TurnUp();
        }
        else if(_gameAction == GameAction.FROM_BIND_TO_DROP)
        {
            Card tmp = enemyField.GetCardFromBindByID(_cardID);
            enemyField.RemoveFromBindZone(tmp);
            enemyField.AddToDropZone(tmp, false);
        }
        else if(_gameAction == GameAction.OPPONENT_FROM_BIND_TO_DROP)
        {
            Card tmp = field.GetBoundByID(_cardID);
            dummyUnitObject.FromBindToDrop(tmp);
        }
        else if(_gameAction == GameAction.OPPONENT_FROM_HAND_TO_BIND)
        {
            int index = playerHand.Size() - other1;
            dummyUnitObject.FromHandToBind(playerHand.GetCardAtIndex(index), index, true);
        }
        else if(_gameAction == GameAction.ENEMY_FROM_BIND_TO_HAND)
        {
            Card cardToReturn = field.GetBoundByID(_cardID);
            dummyUnitObject.FromBindToHand(cardToReturn);
        }
        else if(_gameAction == GameAction.SET_ENEMY_ENDTURN)
        {
            enemyPhase = EnemyPhase.ENDTURN;
            SendPacket(GameAction.CONFORM_ENEMY_ENDTURN);
        }
        else if(_gameAction == GameAction.CONFORM_ENEMY_ENDTURN)
        {
            bConfirmEndTurn = true;
        }
        else if(_gameAction == GameAction.MOVE_TO_OPENRC)
        {
            Card c = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other1));

            EnemyFieldPosition p2 = Util.TranformToEnemyPosition((fieldPositions)other2);
            fieldPositions p = Util.EnemyToFieldPosition(p2);

            enemyField.ClearZone(Util.TransformToEquivalentEnemyPosition(c.pos));

            c.pos = p;

            if(p == fieldPositions.ENEMY_FRONT_LEFT) enemyField.Left_Front = c;
            else if(p == fieldPositions.ENEMY_FRONT_RIGHT) enemyField.Right_Front = c;
            else if(p == fieldPositions.ENEMY_REAR_CENTER) enemyField.Center_Rear = c;
            else if(p == fieldPositions.ENEMY_REAR_RIGHT) enemyField.Right_Rear = c;
            else if(p == fieldPositions.ENEMY_REAR_LEFT)  enemyField.Left_Rear = c;

            Vector3 newVector = enemyField.fieldInfo.GetPosition((int)p2);
            c.GoTo(newVector.x, newVector.z);
        }
        else if(_gameAction == GameAction.EXCHANGE)
        {
            Card c1 = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other1));
            Card c2 = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other2));

            fieldPositions p1 = c1.pos;
            fieldPositions p2 = c2.pos;

            if(p1 == fieldPositions.ENEMY_REAR_CENTER)      enemyField.Center_Rear = c2;
            else if(p1 == fieldPositions.ENEMY_REAR_LEFT)   enemyField.Left_Rear   = c2;
            else if(p1 == fieldPositions.ENEMY_REAR_RIGHT)  enemyField.Right_Rear  = c2;
            else if(p1 == fieldPositions.ENEMY_FRONT_LEFT)  enemyField.Left_Front  = c2;
            else if(p1 == fieldPositions.ENEMY_FRONT_RIGHT) enemyField.Right_Front = c2;

            if(p2 == fieldPositions.ENEMY_REAR_CENTER)      enemyField.Center_Rear = c1;
            else if(p2 == fieldPositions.ENEMY_REAR_LEFT)   enemyField.Left_Rear   = c1;
            else if(p2 == fieldPositions.ENEMY_REAR_RIGHT)  enemyField.Right_Rear  = c1;
            else if(p2 == fieldPositions.ENEMY_FRONT_LEFT)  enemyField.Left_Front  = c1;
            else if(p2 == fieldPositions.ENEMY_FRONT_RIGHT) enemyField.Right_Front = c1;

            c1.pos = p2;
            c2.pos = p1;

            Vector3 c1NewPos = enemyField.fieldInfo.GetPosition((int)Util.TransformToEquivalentEnemyPosition(c1.pos));
            Vector3 c2NewPos = enemyField.fieldInfo.GetPosition((int)Util.TransformToEquivalentEnemyPosition(c2.pos));

            c1.GoTo(c1NewPos.x, c1NewPos.z);
            c2.GoTo(c2NewPos.x, c2NewPos.z);
        }
        else if(_gameAction == GameAction.SET_ENEMY_MAIN)
        {
            enemyPhase = EnemyPhase.MAIN;
        }
        else if(_gameAction == GameAction.BIND_HAND_FACEDOWN_RETURN_ENDTURN)
        {
            _OppBindHandFacedownReturnEndTurn = true;
            GameChat.AddHelpMessage("Choose a card from your hand and bind it.");
        }
        else if(_gameAction == GameAction.OPPONENT_FROM_FIELD_TO_DAMAGE)
        {
            _OppFromFieldToDamage = true;
            GameChat.AddHelpMessage("Choose one of your rear-guards.");
        }
        else if(_gameAction == GameAction.ENEMY_FROM_DAMAGE_TO_DROP)
        {
            Card c = field.GetDamageAtIndex(other1);
            dummyUnitObject.FromDamageToDrop (c);
        }
        else if(_gameAction == GameAction.FROM_DRIVE_TO_DROP)
        {
            enemyField.AddToDropZone(DriveCard, false);
        }
        else if(_gameAction == GameAction.OPEN_DECISIONWINDOW)
        {
            Card tmp = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other1));

            _DecisionWindow.Set(tmp, other2);
            _DecisionWindow.SetCaption(str1);

        }
        else if(_gameAction == GameAction.DECISIONWINDOW_ACCEPT)
        {
            Card tmp = field.GetCardAt(Util.TransformToPlayerField((fieldPositions)other1));
            if(tmp != null)
            {
                tmp.unitAbilities.DecisionWindowAccept(other2);
            }
        }
        else if(_gameAction == GameAction.REGISTER_ID)
        {
            lastIDRegistered = other1;
        }
        else if(_gameAction == GameAction.DECISIONWINDOW_DENIED)
        {
            Card tmp = field.GetCardAt(Util.TransformToPlayerField((fieldPositions)other1));

            if(tmp != null)
            {
                tmp.unitAbilities.DecisionWindowDenied(other2);
            }
            else
            {
                GameChat.AddChatMessage("ADMIN", "NULL");
            }
        }
        else if(_gameAction == GameAction.EFFECT_ON)
        {
            bEnemyEffectOngoing = true;
        }
        else if(_gameAction == GameAction.EFFECT_OFF)
        {
            bEnemyEffectOngoing = false;
        }
        else if(_gameAction == GameAction.BLOCK_EFFECT_TRIGGER_THIS_BATTLE)
        {
            bBlockTriggerEffects = true;
        }
        else if(_gameAction == GameAction.CREATE_AUXILIAR_INT_ARRAY)
        {
            intArr = new List<int>();
        }
        else if(_gameAction == GameAction.ADD_TO_INT_ARRAY)
        {
            intArr.Add(other1);
        }
        else if(_gameAction == GameAction.FORCE_CALL_FROM_BIND)
        {
            bForceToCallFromBind = true;
            iNumberOfUnitsToCallFromBind = other1;
            field.ViewBindZone(1, delegate(Card c) {
                for(int i = 0; i < intArr.Count; i++)
                {
                    CardIdentifier tmpId = (CardIdentifier)intArr[i];
                    if(tmpId == c.cardID)
                    {
                        return true;
                    }
                }
                return false;
            });
            bEndEvent = false;
        }
        else if(_gameAction == GameAction.OPPONENT_CANNOT_NORMAL_GUARD_ENDBATTLE)
        {
            bCanNormalGuard = false;
        }
        else if(_gameAction == GameAction.OPPONENT_CANNOT_RECEIVEDAMAGE_ENDBATTLE)
        {
            bCanReceiveDamage = false;
        }
        else if(_gameAction == GameAction.BIND_FROM_DECK)
        {
            //Take the top card of the enemy deck.
            Card c = enemyDeck.DrawCard();
            //Transform the card to the desired card identifier.
            Data.FillCardWithData(c, _cardID);
            //Add the card to the enemy bind zone.
            enemyField.AddToBindZone(c);
            //Perform the bind animation.
            c.TurnUp();
            c.BindAnim();
        }
        else if(_gameAction == GameAction.FROM_BIND_TO_DECK)
        {
            Card c = enemyField.GetCardFromBindByID(_cardID);

            enemyField.RemoveFromBindZone(c);
            enemyDeck.AddCard(c);

            c.FromEnemyBindTo(new Vector3(-15.89146f, -2.667145f, 9.565327f),
            delegate {
                enemyDeck.SetDeckPosition();
            });
        }
        else if(_gameAction == GameAction.OPPONENT_MOVE_SOUL)
        {
            fieldPositions p = (fieldPositions)other1;
            Card c = field.GetCardAt(Util.TransformToPlayerField(p));
            if(c != null)
            {
                MoveToSoul(c);
            }
        }
        else if(_gameAction == GameAction.DRAW_FROM_DECK)
        {
            //Remove a number "other1" of cards from the deck an put them on the enemy hand.
            for(int i = 0; i < other1; i++)
            {
                enemyHand.AddToHand (enemyDeck.DrawCard());
            }
        }
        else if(_gameAction == GameAction.FROM_DROP_TO_HAND)
        {
            Card c = enemyField.GetDropByID(_cardID);
            enemyField.RemoveFromDropZone(c);
            enemyHand.AddToHand(c);
        }
        else if(_gameAction == GameAction.BLOCK_GUARD_END_BATTLE)
        {
            bBlockGuardEndBattle = true;
            bMaxGuardGradeBlocked = other1;
        }
        else if(_gameAction == GameAction.BLOCK_GUARD_END_BATTLE_MIN)
        {
            bBlockGuardEndBattle = true;
            bMinGuardGradeBlocked = other1;
        }
        else if(_gameAction == GameAction.UNIT_CANNOT_INTERCEPT_ENDTURN)
        {
            fieldPositions p = Util.TransformToPlayerField((fieldPositions)other1);
            Card c = field.GetCardAt(p);
            SelectAnimField(c);
            c.BlockInterceptEndTurn();
        }
        else if(_gameAction == GameAction.RIDE_FROM_BIND)
        {
            Card c = enemyField.GetCardFromBindByID(_cardID);
            if(c != null)
            {
                enemyField.RemoveFromBindZone(c);
                enemyField.Ride(c);
            }
        }
        else if(_gameAction == GameAction.PLAY_CARD_ON_THE_FIELD)
        {
            //The opponent Call/Ride an unit from hand.
            EnemyFieldPosition pos = (EnemyFieldPosition)other1;
            if(pos != EnemyFieldPosition.VANGUARD)
            {
                Card tempCard = enemyHand.RemoveFromHand();
                Data.FillCardWithData(tempCard, _cardID);
                enemyField.Call(tempCard, pos);
            }
            else
            {
                Card tempCard = enemyHand.RemoveFromHand();
                Data.FillCardWithData(tempCard, _cardID);
                enemyField.Ride(tempCard);
            }
        }
        else if(_gameAction == GameAction.LOCK)
        {
            fieldPositions tmpPos = (fieldPositions)other1;
            Card card = field.GetCardAt(Util.TransformToPlayerField(tmpPos));
            card.Lock();
        }
        else if(_gameAction == GameAction.UNLOCK)
        {
            fieldPositions tmpPos = (fieldPositions)other1;
            Card card = field.GetCardAt(Util.TransformToPlayerField(tmpPos));
            card.Unlock();
        }
        else if(_gameAction == GameAction.LOCK_ENEMY)
        {
            enemyField.GetCardAt((EnemyFieldPosition)other1).Lock();
        }
        else if(_gameAction == GameAction.OMEGA_LOCK)
        {
            fieldPositions tmpPos = (fieldPositions)other1;
            Card card = field.GetCardAt(Util.TransformToPlayerField(tmpPos));
            card.SetOmegaLock(true);
        }
        else if(_gameAction == GameAction.UNLOCK_ENEMY)
        {
            EnemyFieldPosition pos = (EnemyFieldPosition)other1;
            Card tempCard = enemyField.GetCardAt(pos);
            tempCard.Unlock();
            field.CheckAbilities(CardState.EnemyUnlockCard, tempCard);
            bEndEvent = true;
        }
        else if(_gameAction == GameAction.PLAY_CARD_FROM_SOUL)
        {
            EnemyFieldPosition pos = (EnemyFieldPosition)other1;
            Card tempCard = enemyField.GetCardFromSoulByID(_cardID);
            enemyField.RemoveFromSoul(tempCard);
            enemyField.Call(tempCard, pos);
        }
        else if(_gameAction == GameAction.FROM_BIND_TO_FIELD)
        {
            EnemyFieldPosition pos = (EnemyFieldPosition)other1;
            Card tempCard = enemyField.GetCardFromBindByID(_cardID);
            enemyField.RemoveFromBindZone(tempCard);
            enemyField.Call(tempCard, pos);
        }
        else if(_gameAction == GameAction.REST_UNIT)
        {
            enemyField.GetCardAt((EnemyFieldPosition)other1).RestEnemy();
        }
        else if(_gameAction == GameAction.ADD_EXTRA_SHIELD)
        {
            if(CardToAttack != null)
            {
                CardToAttack.AddExtraShield(other1);
            }
        }
        else if(_gameAction == GameAction.FROM_HAND_TO_BIND)
        {
            Card c = enemyHand.GetCardAtIndex(enemyHand.Size() - other1 - 1);
            Data.FillCardWithData(c, _cardID);

            FromHandToBindList.Add(c);
            c.BindAnim();
        }
        else if(_gameAction == GameAction.SELECT_UNIT_TO_ATTACK)
        {
            Card tempCard = field.GetCardAt(Util.TransformToPlayerField((fieldPositions)other1));
            PutSelectorOnCard(tempCard);
            CardToAttack = tempCard;

            AttackedList.Add(CardToAttack);
            CurAttackedListIndex = 0;

            CardAttacking = enemyField.GetCardAt((EnemyFieldPosition)other2);
            bShowAttackPowerWindow = true;
            bShowDefensePowerWindow = true;

            SendPacket (GameAction.REQUEST_BOOT);
            //gamePhase = GamePhase.GUARD;
        }
        else if(_gameAction == GameAction.ATTACK_ALL_UNITS)
        {
            AttackedList.Clear();

            Card c = field.GetCardAt(fieldPositions.FRONT_GUARD_LEFT);
            if(c != null) AttackedList.Add(c);

            c = field.GetCardAt(fieldPositions.FRONT_GUARD_RIGHT);
            if(c != null) AttackedList.Add(c);

            c = field.GetCardAt(fieldPositions.REAR_GUARD_LEFT);
            if(c != null) AttackedList.Add(c);

            c = field.GetCardAt(fieldPositions.REAR_GUARD_CENTER);
            if(c != null) AttackedList.Add(c);

            c = field.GetCardAt(fieldPositions.REAR_GUARD_RIGHT);
            if(c != null) AttackedList.Add(c);

            c = field.GetCardAt(fieldPositions.VANGUARD_CIRCLE);
            if(c != null) AttackedList.Add(c);

            CardToAttack = AttackedList[0];
            CurAttackedListIndex = 0;
            TargetCard(CardToAttack);

            CardAttacking = enemyField.GetCardAt((EnemyFieldPosition)other1);
            bShowAttackPowerWindow = true;
            bShowDefensePowerWindow = true;

            BeginGuardPhase();

            gamePhase = GamePhase.GUARD;
        }
        else if(_gameAction == GameAction.ALL_FRONT)
        {
            AttackedList.Clear();

            Card c = field.GetCardAt(fieldPositions.FRONT_GUARD_LEFT);
            if(c != null) AttackedList.Add(c);

            c = field.GetCardAt(fieldPositions.FRONT_GUARD_RIGHT);
            if(c != null) AttackedList.Add(c);

            c = field.GetCardAt(fieldPositions.VANGUARD_CIRCLE);
            if(c != null) AttackedList.Add(c);

            CardToAttack = AttackedList[0];
            CurAttackedListIndex = 0;
            TargetCard(CardToAttack);

            CardAttacking = enemyField.GetCardAt((EnemyFieldPosition)other1);
            bShowAttackPowerWindow = true;
            bShowDefensePowerWindow = true;

            BeginGuardPhase();

            gamePhase = GamePhase.GUARD;
        }
        else if(_gameAction == GameAction.FROM_DAMAGE_TO_DROP)
        {
            Card c = enemyField.GetDamageAtIndex(other1);
            enemyField.RemoveFromDamage(c);
            enemyField.AddToDropZone(c, false);
        }
        else if(_gameAction == GameAction.FROM_DAMAGE_TO_SOUL)
        {
            Card tempCard = enemyField.GetDamageAtIndex(other1);
            enemyField.RemoveFromDamage(tempCard);
            enemyField.AddToSoul(tempCard);
            tempCard.TurnUp();
            tempCard.SetRotation(0,0,0);
            Vector3 newPosition = EnemyFieldInfo.GetPosition((int)EnemyFieldPosition.VANGUARD) + new Vector3(0.0f, -0.002f, 0.0f);
            tempCard.GoTo (newPosition.x, newPosition.y, newPosition.z);
        }
        else if(_gameAction == GameAction.ADD_TO_GUARDZONE)
        {
            Card tempCard = enemyHand.RemoveFromHand();
            Data.FillCardWithData(tempCard, _cardID);
            guardZone.AddToGuardZone(tempCard, false);
            CardToAttack.AddExtraShield(tempCard.shield);
        }
        else if(_gameAction == GameAction.FROM_SOUL_TO_GC)
        {
            Card tempCard = enemyField.GetCardFromSoulByID(_cardID);
            enemyField.RemoveFromSoul(tempCard);
            guardZone.AddToGuardZone(tempCard, false);
            CardToAttack.AddExtraShield(tempCard.shield);
        }
        else if(_gameAction == GameAction.END_ATTACK)
        {
            CardSelector.transform.position = new Vector3(0.0f, 100.0f, 0.0f);
            bShowAttackPowerWindow = false;
            bShowDefensePowerWindow = false;
            bAttacking = false;
            guardZone.CleanGuardZone(enemyField);
            bDoAttackOnce = true;
            bBlockGuardEndBattle = false;
        }
        else if(_gameAction == GameAction.ADD_TO_DAMAGEZONE)
        {
            Card tmpCard = enemyDeck.DrawCard();
            Data.FillCardWithData(tmpCard, _cardID);
            enemyField.AddToDamageZone(tmpCard);
        }
        else if(_gameAction == GameAction.SURRENDER)
        {
            bGameEnded = true;
            bSurrender = false;
            bOpponentSurrender = true;
        }
        else if(_gameAction == GameAction.FROM_DAMAGE_TO_DECK)
        {
            Card c = enemyField.GetDamageAtIndex(other1);
            enemyField.RemoveFromDamage(c);
            enemyDeck.AddCard(c);
            enemyDeck.SetDeckPosition();
            //c.TurnUp();
        }
        else if(_gameAction == GameAction.END_TURN)
        {
            bBlockInterceptUntilEndTurn = false;

            enemyField.ResetPowers();
            enemyField.ResetTurnPowers();
            field.ResetPowers();
            field.ResetTurnPowers();
            gamePhase = GamePhase.DRAW;
            field.DoStandPhase();
            SendPacket(GameAction.STAND_ALL_UNITS);
            numTurn++;
        }
        else if(_gameAction == GameAction.FROM_BIND_TO_HAND)
        {
            Card c = enemyField.GetCardFromBindByID(_cardID);
            if(c != null)
            {
                enemyField.RemoveFromBindZone(c);
                enemyHand.AddToHand(c);
            }
        }
        else if(_gameAction == GameAction.POWER_INCREASE)
        {
            enemyField.GetCardAt((EnemyFieldPosition)other1).IncreasePower(other2);
        }
        else if(_gameAction == GameAction.CAN_BE_RETIRED)
        {
            if(other2 == 0)
            {
                enemyField.GetCardAt((EnemyFieldPosition)other1).bCanBeRetireByEffects = false;
            }
            else
            {
                enemyField.GetCardAt((EnemyFieldPosition)other1).bCanBeRetireByEffects = true;
            }

        }
        else if(_gameAction == GameAction.FLIPDOWN)
        {
            Card c = enemyField.GetDamageAtIndex(other1);
            if(c != null)
            {
                c.TurnDown();
            }
        }
        else if(_gameAction == GameAction.FLIPUP)
        {
            Card c = enemyField.GetDamageAtIndex(other1);
            if(c != null)
            {
                c.TurnUp();
            }
        }
        else if(_gameAction == GameAction.INCREASE_POWER_END_TURN)
        {
            enemyField.GetCardAt((EnemyFieldPosition)other1).IncreasePowerUntilEndTurn(other2);
        }
        else if(_gameAction == GameAction.INCREASE_CRITICAL_END_TURN)
        {
            enemyField.GetCardAt((EnemyFieldPosition)other1).IncreaseCriticalUntilEndTurn(other2);
        }
        else if(_gameAction == GameAction.STAND_ALL_UNITS)
        {
            //enemyField.StandAllUnits();
            enemyField.DoStandPhase();
        }
        else if(_gameAction == GameAction.SEND_TO_DROPZONE)
        {
            enemyField.AddToDropZone(enemyField.GetCardAt((EnemyFieldPosition)other1), true);
            enemyField.ClearZone((EnemyFieldPosition)other1);
        }
        else if(_gameAction == GameAction.SELECT_ANIM_DAMAGE)
        {
            enemyField.GetDamageAtIndex(other1).DoSelectAnim();
        }
        else if(_gameAction == GameAction.DRIVE_CHECK)
        {
            if(field.GetCardAt(fieldPositions.VANGUARD_CIRCLE).hasTwinDrive())
            {
                bTwinDrive = true;
            }
            else
            {
                bTwinDrive = false;
            }
            DriveCheck();
        }
        else if(_gameAction == GameAction.PUT_CARD_ON_DRIVEZONE)
        {
            DriveCard = enemyDeck.DrawCard();
            if(DriveCard != null)
            {
                Data.FillCardWithData(DriveCard, _cardID);
                DriveCard.GetGameObject().transform.position = EnemyFieldInfo.GetPosition((int)EnemyFieldPosition.DRIVE);
                DriveCard.GetGameObject().transform.eulerAngles = EnemyFieldInfo.GetDriveRotation();
                DriveCard.TurnUp();
            }
        }
        else if(_gameAction == GameAction.SEND_DRIVE_TO_HAND)
        {
            if(DriveCard != null)
            {
                enemyHand.AddToHand(DriveCard);
                DriveCard = null;
            }
        }
        else if(_gameAction == GameAction.END_DRIVECHECK)
        {
            for(int i = 0; i < AttackedList.Count - 1; i++)
            {
                ResolveBattle(AttackedList[i]);
            }

            ResolveLastBattle(AttackedList[AttackedList.Count - 1]);
        }
        else if(_gameAction == GameAction.STAND_UNIT)
        {
            enemyField.GetCardAt((EnemyFieldPosition)other1).StandEnemy();
        }
        else if(_gameAction == GameAction.REST_ENEMY_UNIT)
        {
            fieldPositions p = Util.TransformToPlayerField((fieldPositions)other1);
            Card c = field.GetCardAt(p);
            if(c != null)
            {
                c.Rest();
            }
        }
        else if(_gameAction == GameAction.CRITICAL_INCREASE)
        {
            enemyField.GetCardAt((EnemyFieldPosition)other1).IncreaseCritical(other2);
        }
        else if(_gameAction == GameAction.END_BATTLE)
        {
            Card temp = field.GetCardAt(Util.TransformToPlayerField((fieldPositions)(other1)));
            temp.ResetPower();
            temp.IsBoostedBy = null;
            field.CheckAbilitiesBind(CardState.BindZone_EndBattle);
            temp.CheckAbilities(CardState.EndBattle);
            field.CheckAbilitiesExcept(temp.pos, CardState.EndBattle_NotMe, temp);
            bBlockGuardEndBattle = false;
            bMinGuardGradeBlocked = 0;
            bMaxGuardGradeBlocked = 99;
            bDoPerfectGuardPerBattle = false;
            bBlockInterceptUntilEndBattle = false;
            CardToAttack.ResetPower();
            field.CheckAbilities(CardState.ClearEndBattleVariables);
        }
        else if(_gameAction == GameAction.FROM_DROP_TO_DECK)
        {
            DD_Card = enemyField.GetDropByID(_cardID);
            Vector3 newPos = EnemyFieldInfo.GetPosition((int)EnemyFieldPosition.DECK);
            DD_Card.GoTo(newPos.x, newPos.z);
        }
        else if(_gameAction == GameAction.HEAL_TRIGGER)
        {
            enemyField.AddToDropZone(enemyField.RemoveFromDamage(), false);
        }
        else if(_gameAction == GameAction.ADD_CARD_TO_ABILITYSTACK)
        {
            //Description: When an enemy ability is resolved during your turn. The enemy effect
            //will be added to the Stack Ability and it will be performed like any normal ability does.
            //The game will be paused for current player and enemy will take the control.
            fieldPositions p = Util.TransformToPlayerField((fieldPositions)other1);
            EnemyTurnStackedCards.Add(field.GetCardAt(p));
        }
        else if(_gameAction == GameAction.CLEAR_ZONE)
        {
            enemyField.ClearZone((EnemyFieldPosition)other1);
        }
        else if(_gameAction == GameAction.INTERCEPT)
        {
            Card c = enemyField.GetCardAt((EnemyFieldPosition)other1);
            guardZone.AddToGuardZone(enemyField.GetCardAt((EnemyFieldPosition)other1), true);
            CardToAttack.AddExtraShield(c.shield);
        }
        else if(_gameAction == GameAction.SHOW_CARD)
        {
            ShowCardEffect(Resources.Load ("CardHelper/" + Data.GetCardInfo(_cardID).clan + "/" + Data.GetImageName(_cardID)) as Texture2D);
        }
        else if(_gameAction == GameAction.FLIPDAMAGE)
        {
            enemyField.FlipDamageZoneCard();
        }
        else if(_gameAction == GameAction.UNFLIPDAMAGE)
        {
            enemyField.UnflipDamageZoneCard();
        }
        else if(_gameAction == GameAction.ENEMY_REMOVE_FROM_GUARDIAN)
        {
            guardZone.Remove(guardZone.cards[other1], true);
        }
        else if(_gameAction == GameAction.SEND_TO_DROPZONE_ALLY)
        {
            fieldPositions tmpPos = (fieldPositions)other1;
            Card card = field.GetCardAt(Util.TransformToPlayerField(tmpPos));

            Debug.Log("Send to drop zone ally event");
            if(!card.IsVanguard())
            {
                Debug.Log("Sent to dropzone: " + card.cardID);
                card.CheckAbilities(CardState.DropZoneFromRC);
            }

            field.AddToDropZone(field.GetCardAt(Util.TransformToPlayerField(tmpPos)));
            field.ClearZone(Util.TransformToPlayerField(tmpPos));
        }
        else if(_gameAction == GameAction.SEND_TO_BINDZONE_ALLY)
        {
            fieldPositions tmpPos = (fieldPositions)other1;
            Card card = field.GetCardAt(Util.TransformToPlayerField(tmpPos));
            field.AddToBindZone(field.GetCardAt(Util.TransformToPlayerField(tmpPos)));
            field.ClearZone(Util.TransformToPlayerField(tmpPos));
            card.BindAnim();
        }
        else if(_gameAction == GameAction.ENEMY_DISCARD)
        {
            Card tmpCard = enemyHand.RemoveFromHand();
            Data.FillCardWithData(tmpCard, _cardID);
            enemyField.AddToDropZone(tmpCard, false);
            tmpCard.TurnUp();
        }
        else if(_gameAction == GameAction.RETURN_FROM_HAND_TO_DECK)
        {
            Card tmpCard = enemyHand.RemoveFromHand();
            enemyDeck.AddCard(tmpCard);
            enemyDeck.SetDeckPosition();
        }
        else if(_gameAction == GameAction.FROM_HAND_TO_DECK)
        {
            Card tmpCard = enemyHand.RemoveFromHand(playerHand.Size() - other1 - 1);
            enemyDeck.AddCard(tmpCard);
            enemyDeck.SetDeckPosition();
        }
        else if(_gameAction == GameAction.DRAW_FROM_DECK_AND_SHOW)
        {
            Card tmpCard = enemyDeck.DrawCard();
            enemyHand.AddToHand(tmpCard);
            Data.FillCardWithData(tmpCard, _cardID);
            tmpCard.TurnUp();
            ShowingCardAtHandTimer = SHOW_CARD_FROM_HAND_DELAY;
            bIsCardAtHandShowing = true;
        }
        else if(_gameAction == GameAction.FROM_DAMAGE_TO_HAND)
        {
            Card c = enemyField.GetDamageAtIndex(other1);
            enemyField.RemoveFromDamage(c);
            enemyHand.AddToHand(c);
        }
        else if(_gameAction == GameAction.CARDSTATE_FROM_BIND_TO_HAND_END_TURN)
        {
            Card c = playerHand.GetCardAtIndex(playerHand.Size() - other1 - 1);
            if(c != null)
            {
                Debug.Log ("Adding Ability to " + c.cardID);

                c.unitAbilities.AddExternAuto(delegate(CardState cs, Card effectOwner) {
                    if(cs == CardState.EnemyEndTurn)
                    {
                        c.unitAbilities.FromBindToHand(c);
                    }
                });
            }
        }
        else if(_gameAction == GameAction.FROM_HAND_TO_DAMAGE)
        {
            Card c = enemyHand.GetCardAtIndex(enemyHand.Size() - other1 - 1);
            Data.FillCardWithData(c, _cardID);
            enemyHand.RemoveFromHand(c);
            enemyField.AddToDamageZone(c);
        }
        else if(_gameAction == GameAction.SHOW_CARD_HAND)
        {
            Card tmpCard = enemyHand.GetCardAtIndex(enemyHand.Size() - other1 - 1);
            Data.FillCardWithData(tmpCard, _cardID);
            tmpCard.TurnUp();
            ShowingCardAtHandTimer = SHOW_CARD_FROM_HAND_DELAY;
            bIsCardAtHandShowing = true;
        }
        else if(_gameAction == GameAction.ATTACK_HITS)
        {
            CardAttacking.CheckAbilities(CardState.AttackHits, CardAttacking);
            field.CheckAbilitiesExcept(CardAttacking.pos, CardState.AttackHits_NotMe, CardAttacking);
        }
        else if(_gameAction == GameAction.ADD_POWER_TO_GUARDZONE)
        {
            guardZone.AddExtraPower(other1);
        }
        else if(_gameAction == GameAction.RETURN_FROM_FIELD_TO_DECK)
        {
            Card tempCard = enemyField.GetCardAt((EnemyFieldPosition)other1);
            enemyField.RemoveFrom((EnemyFieldPosition)other1);
            tempCard.SetRotation(0,0,0);
            enemyDeck.ReturnToDeck(tempCard);
            ReturnToDeckCard = tempCard;
        }
        else if(_gameAction == GameAction.FROM_FIELD_TO_DAMAGE)
        {
            Card tempCard = enemyField.GetCardAt((EnemyFieldPosition)other1);
            enemyField.RemoveFrom((EnemyFieldPosition)other1);
            enemyField.AddToDamageZone(tempCard);
        }
        else if(_gameAction == GameAction.SOULCHARGE)
        {
            Card tempCard = enemyDeck.DrawCard();
            Data.FillCardWithData(tempCard, _cardID);
            enemyField.AddToSoul(tempCard);
            tempCard.TurnUp();
            tempCard.SetRotation(0,0,0);
            //Vector3 newPosition = fieldInfo.GetPosition((int)fieldPositions.VANGUARD_CIRCLE) + new Vector3(0.0f, -0.001f, 0.0f);
            Vector3 newPosition = EnemyFieldInfo.GetPosition((int)EnemyFieldPosition.VANGUARD) + new Vector3(0.0f, -0.002f, 0.0f);
            tempCard.GoTo (newPosition.x, newPosition.y, newPosition.z);

        }
        else if(_gameAction == GameAction.SOULBLAST)
        {
            EnemySoulBlastQueue.Add(enemyField.GetCardFromSoulByID(_cardID));
        }
        else if(_gameAction == GameAction.PERSISTENT_POWER)
        {
            fieldPositions pos = (fieldPositions)other1;

            Card temp = enemyField.GetCardAt(Util.TranformToEnemyPosition(pos));
            if(temp != null)
            {
                temp.SetPersistentPower(other2);
            }
        }
        else if(_gameAction == GameAction.RIDE_FROM_FIELD)
        {
            Card c = enemyField.GetCardAt(Util.TransformToEquivalentEnemyPosition((fieldPositions)other1));
            fieldPositions p = c.pos;
            enemyField.RemoveFrom(Util.TransformToEquivalentEnemyPosition(c.pos));
            enemyField.Ride(c);
            SendPacket (GameAction.RIDE_FROM_FIELD_OPP, p);
        }
        else if(_gameAction == GameAction.PERSISTENT_CRITICAL)
        {
            fieldPositions pos = (fieldPositions)other1;

            Card temp = enemyField.GetCardAt(Util.TranformToEnemyPosition(pos));
            if(temp != null)
            {
                temp.SetPersistentCritical(other2);
            }
        }
        else if(_gameAction == GameAction.HEAL_TRIGGER_SELECT)
        {
            Card c = enemyField.RemoveFromDamage(other1);
            enemyField.AddToDropZone(c, false);
        }
        else if(_gameAction == GameAction.PLAY_CARD_FROM_DECK)
        {
            Card tempCard = enemyDeck.DrawCard();
            Data.FillCardWithData(tempCard, _cardID);
            tempCard.TurnUp();
            enemyField.Call(tempCard, (EnemyFieldPosition)other1);
        }
        else if(_gameAction == GameAction.FROM_DECK_TO_DAMAGE)
        {
            Card c = enemyDeck.DrawCard();
            Data.FillCardWithData(c, _cardID);
            enemyField.AddToDamageZone(c);
            c.TurnDown();
        }
        else if(_gameAction == GameAction.FROM_DECK_TO_DAMAGE_FACEUP)
        {
            Card c = enemyDeck.DrawCard();
            Data.FillCardWithData(c, _cardID);
            enemyField.AddToDamageZone(c);
            c.TurnUp();
        }
        else if(_gameAction == GameAction.FROM_FIELD_TO_SOUL)
        {
            Card tempCard = enemyField.GetCardAt((EnemyFieldPosition)other1);

            enemyField.MoveToSoul(Util.TransformToEquivalentEnemyPosition(tempCard.pos));
            enemyField.AddToSoul(tempCard);
            enemyField.RemoveFrom(Util.TransformToEquivalentEnemyPosition(tempCard.pos));
        }
        else if(_gameAction == GameAction.PLAY_CARD_FROM_DROP)
        {

            Card tempCard = enemyField.GetDropByID(_cardID);
            if(tempCard != null)
            {
                enemyField.RemoveFromDropZone(tempCard);
                enemyField.Call(tempCard, Util.TranformToEnemyPosition((fieldPositions)other1));
            }
            else
            {
            }

        }
        else if(_gameAction == GameAction.CHECK_CARD_ABILITY)
        {
            Card c = EnemyTurnStackedCards[0];
            EnemyTurnStackedCards.RemoveAt(0);
            EffectOnGoingEnemyTurn = true;
            c.CheckAbilities((CardState)other1);
        }
        else if(_gameAction == GameAction.FIELD_FROM_DAMAGE)
        {
            Card c = enemyField.GetDamageAtIndex(other2);
            enemyField.RemoveFromDamage(c);
            enemyField.Call(c, Util.TranformToEnemyPosition((fieldPositions)other1));
        }
        else if(_gameAction == GameAction.BIND_HAND)
        {
            Card c = playerHand.GetCardAtIndex(playerHand.Size() - other1 - 1);
            if(c != null)
            {
                BindHand(c);
            }
        }
        else if(_gameAction == GameAction.RIDE_FROM_DECK)
        {
            Card tempCard = enemyDeck.DrawCard();
            Data.FillCardWithData(tempCard, _cardID);
            enemyField.Ride(tempCard);
        }
        else if(_gameAction == GameAction.RETURN_CARD_FROM_HAND_TO_DECK)
        {
            Card tempCard = enemyHand.RemoveFromHand();
            enemyDeck.AddCard(tempCard);
            enemyDeck.SetDeckPosition();
        }
        else if(_gameAction == GameAction.PERFECT_GUARD)
        {
            guardZone.ActivePerfectGuard();
            CardToAttack.PerfectGuard();
        }
        else if(_gameAction == GameAction.MOVE_ALLY)
        {
            EnemyFieldPosition pos = Util.TranformToEnemyPosition((fieldPositions)other1);
            Card temp = enemyField.GetCardAt(pos);
            enemyField.Move(temp);
        }
        else if(_gameAction == GameAction.NEGATE_ENEMY_STAND)
        {
            fieldPositions pos = Util.TransformToPlayerField((fieldPositions)other1);
            Card temp = field.GetCardAt(pos);
            temp.NegateStand();
        }
        else if(_gameAction == GameAction.ALLY_DISCARD)
        {
            bEffectOnGoing = true;
            GameChat.AddChatMessage("ADMIN", "ALLY_DISCARD");
            bDiscard = true;
            _GameHelper.CustomMessage("Choose a card from your hand and discard it.");
        }
        else if(_gameAction == GameAction.RIDE_FROM_DROP)
        {
            Card tempCard = enemyField.SearchInDropZone(_cardID);
            enemyField.RemoveFromDropZone(tempCard);
            enemyField.Ride(tempCard);
        }
        else if(_gameAction == GameAction.FROM_DROP_TO_SOUL)
        {
            Card tmp = enemyField.SearchInDropZone(_cardID);
            if(tmp != null)
            {
                enemyField.MoveToSoul(tmp);
                enemyField.RemoveFromDropZone(tmp);
            }
        }
        else if(_gameAction == GameAction.FROM_DECK_TO_DROP)
        {
            Card tmp = enemyDeck.DrawCard();
            Data.FillCardWithData(tmp, _cardID);
            tmp.TurnUp();
            tmp.SetRotation(0,0,0);
            enemyField.AddToDropZone(tmp, false);
        }
        else if(_gameAction == GameAction.BLOCK_INTERCEPT_UNTIL_ENDTURN)
        {
            bBlockInterceptUntilEndTurn = true;
        }
        else if(_gameAction == GameAction.BLOCK_INTERCEPT_UNTIL_ENDBATTLE)
        {
            bBlockInterceptUntilEndBattle = true;
        }
        else if(_gameAction == GameAction.PLAY_CARD_FROM_DRIVE)
        {
            enemyField.Call(DriveCard, (EnemyFieldPosition)other1);
            DriveCard = null;
        }
        else if(_gameAction == GameAction.RETURN_FROM_FIELD_TO_HAND)
        {
            fieldPositions pos = (fieldPositions)other1;
            EnemyFieldPosition enemyPos = Util.TranformToEnemyPosition(pos);
            Card c = enemyField.GetCardAt(enemyPos);
            enemyField.RemoveFrom(enemyPos);
            enemyHand.AddToHand(c);
        }
        else if(_gameAction == GameAction.ATTACK_NOT_HIT)
        {
            CardAttacking.CheckAbilities(CardState.AttackNotHit);
            field.CheckAbilitiesExcept(CardAttacking.pos, CardState.AttackNotHit_NotMe);
            field.CheckAbilitiesBind(CardState.BindZone_AttackNotHit);
        }
        else if(_gameAction == GameAction.INCREASE_ENEMY_POWER_BATTLE)
        {
            fieldPositions p = Util.TransformToPlayerField((fieldPositions)other1);
            Card c = field.GetCardAt(p);
            if(c != null)
            {
                c.IncreasePower(other2);
                SendPacket(GameAction.POWER_INCREASE, c.pos, other2);
            }
        }
        else if(_gameAction == GameAction.INCREASE_ENEMY_POWER_TURN)
        {
            fieldPositions p = Util.TransformToPlayerField((fieldPositions)other1);
            Card c = field.GetCardAt(p);
            if(c != null)
            {
                c.IncreasePowerUntilEndTurn(other2);
                SendPacket(GameAction.INCREASE_POWER_END_TURN, c.pos, other2);
            }
        }
        else if(_gameAction == GameAction.BOOST)
        {
            Card c = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other1));
            if(c != null)
            {
                fieldPositions p = fieldPositions.DECK_ZONE;
                if(c.pos == fieldPositions.ENEMY_FRONT_LEFT)
                {
                    p = fieldPositions.ENEMY_REAR_LEFT;
                }

                if(c.pos == fieldPositions.ENEMY_FRONT_RIGHT)
                {
                    p = fieldPositions.ENEMY_REAR_RIGHT;
                }

                if(c.pos == fieldPositions.ENEMY_VANGUARD)
                {
                    p = fieldPositions.ENEMY_REAR_CENTER;
                }

                Card d = enemyField.GetCardAt(Util.TransformToEquivalentEnemyPosition(p));
                if(d != null)
                {
                    c.IsBoostedBy = d;
                }
            }
        }
        else if(_gameAction == GameAction.REQUEST_BOOT)
        {
            bEffectOnGoing = true;
            GameChat.AddChatMessage("ADMIN", "REQUEST_BOOT");
            if(CanBeBoosted(CardAttacking))
            {
                bBoostWindow = true;
            }
            else
            {
                BoostUnit();
            }
        }
        else if(_gameAction == GameAction.BEGIN_GUARD)
        {
            BeginGuardPhase();

            gamePhase = GamePhase.GUARD;
        }
        else if(_gameAction == GameAction.FROM_HAND_TO_SOUL)
        {
            Card c = enemyHand.GetCardAtIndex(other1);
            Data.FillCardWithData(c, _cardID);
            enemyHand.RemoveFromHand(c);
            enemyField.AddToBindZone(c);
            c.TurnUp();
            c.BindAnim();
            /*
            FromHandToSoulCard = c;
            Vector3 newPos = EnemyFieldInfo.GetPosition((int)EnemyFieldPosition.VANGUARD);
            c.SetRotation(0,0,0);
            c.GoTo(newPos.x, newPos.y, newPos.z);
            c.TurnUp();
            */
        }
        else if(_gameAction == GameAction.FROM_HAND_TO_SOUL)
        {
            Card c = enemyHand.GetCardAtIndex(other1);
            Data.FillCardWithData(c, _cardID);
            FromHandToSoulCard = c;
            Vector3 newPos = EnemyFieldInfo.GetPosition((int)EnemyFieldPosition.VANGUARD);
            c.SetRotation(0,0,0);
            c.GoTo(newPos.x, newPos.y, newPos.z);
            c.TurnUp();
        }
        else if(_gameAction == GameAction.REVEAL_TOP_CARD)
        {
            Card c = enemyDeck.TopCard();
            Data.FillCardWithData(c, _cardID);
            c.TurnUp();
        }
        else if(_gameAction == GameAction.HIDE_TOP_CARD)
        {
            enemyDeck.TopCard().TurnDown();
        }
        else if(_gameAction == GameAction.TARGET_CARD)
        {
            Card c = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other1));
            c.IsTargetted(true);
            CardToAttack = c;
        }
        else if(_gameAction == GameAction.UNTARGET_CARD)
        {
            Card c = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other1));
            if(c != null)
            {
                c.IsTargetted(false);
            }
        }
        else if(_gameAction == GameAction.RIDE_FROM_SOUL)
        {
            Card c = enemyField.GetCardFromSoulByID(_cardID);
            if(c != null)
            {
                enemyField.RemoveFromSoul(c);
                enemyField.Ride(c);
            }
        }
        else if(_gameAction == GameAction.SELECT_ANIM_FIELD)
        {
            Card c = enemyField.GetCardAt(Util.TranformToEnemyPosition((fieldPositions)other1));
            if(c != null)
            {
                c.DoSelectAnim();
            }
        }
        else if(_gameAction == GameAction.OPPONENT_CALL_FROM_TOP_DECK)
        {
            bEffectOnGoing = true;

            dummyUnitObject.SetBool(1);
            dummyUnitObject.GetDeck().ViewDeck(1, SearchMode.TOP_CARD, other1, delegate(Game2DCard c) {
                return c._CardInfo.grade >= other2 && c._CardInfo.grade <= other3;
            });
        }
        else if(_gameAction == GameAction.EVENT_END_BATTLE)
        {
            field.CheckAbilitiesEnemyTurn(CardState.EnemyBeginRide);
        }
        else if(_gameAction == GameAction.EVENT_BEGIN_RIDEPHASE)
        {
            field.CheckAbilitiesEnemyTurn(CardState.EnemyEndBattle);
        }
        else if(_gameAction == GameAction.EVENT_BEGIN_ENDTURN)
        {
            //field.CheckAbilities(CardState.EnemyEndTurn);
            field.CheckBindZoneAbilities(CardState.EnemyEndTurn);
            bEndEvent = true;
            //bEnemyWaiting = true;
        }
        else if(_gameAction == GameAction.DISPLAY_WINDOW)
        {
            bOpponentWindow = true;
            bOpponentWindowMessage = str1;
            bEffectOnGoing = true;
            GameChat.AddChatMessage("ADMIN", "DISPLAY_WINDOW");
        }
        else if(_gameAction == GameAction.PLAYER_ACCEPT)
        {
            LastOpponentWindow = OPPWINDOW.ACCEPT;
        }
        else if(_gameAction == GameAction.PLAYER_DENIED)
        {
            LastOpponentWindow = OPPWINDOW.DENIED;
        }
        else if(_gameAction == GameAction.BLOCK_NORMALRIDE)
        {
            bRideThisTurn = false;
            bEffectOnGoing = false;
        }
        else if(_gameAction == GameAction.RIDE_FROM_FIELD_OPP)
        {
            //Opponent performs a Ride on my field.
            Card c = field.GetCardAt(Util.TransformToPlayerField((fieldPositions)other1));
            if(c != null)
            {
                field.RemoveFrom(c.pos);
                field.Ride (c, false);
            }
        }
        else if(_gameAction == GameAction.OPPONENT_RIDE_FROM_SOUL)
        {
            field.ViewSoul(1);
            _OppRideFromSoulEvent = true;
        }
        else if(_gameAction == GameAction.OPPONENT_DRAW)
        {
            playerHand.AddToHand(playerDeck.DrawCard());
            SendPacket(GameAction.DRAW_FROM_DECK, 1);
            bEffectOnGoing = false;
            bEndEvent = true;
        }
        else if(_gameAction == GameAction.END_EVENT)
        {
            //bEffectOnGoing = false;
            if(ownerCardCallEvent != null)
            {
                ownerCardCallEvent.unitAbilities.EndEvent(other1);
                ownerCardCallEvent = null;
            }
            else
            {
                bEffectOnGoing = false;
            }
        }
        else if(_gameAction == GameAction.OPPONENT_RETIRE_UNIT)
        {
            _OppRetireUnitEvent = true;
            _GameHelper.CustomMessage("Choose one of your rear-guards, and retire it");
            GameChat.SetTab(ChatTab.HELP);
        }
        else if(_gameAction == GameAction.MESSAGE)
        {
            GameChat.AddHelpMessage(str1);
        }
    }
Esempio n. 16
0
 void Melted()
 {
     if (!gameObject.name.Contains("Champ"))
     {
         enemy_phase = EnemyPhase.ACTION;
         PlayAnimation(AnimationName.normal);
     }
 }
Esempio n. 17
0
 void Frozen()
 {
     if (!gameObject.name.Contains("Champ"))
     {
         enemy_phase = EnemyPhase.PAUSE;
         PlayAnimation(AnimationName.Froze);
     }
 }