Ejemplo n.º 1
0
        public override void OnEnter()
        {
            base.OnEnter();
            time = 0.0f;
            battleMain.player_icon_list.Clear();
            battleMain.enemy_icon_list.Clear();

            for (int i = 1; i <= 4; i++)
            {
                int iIndex = 0;
                foreach (MasterCardSymbolParam sym in battleMain.player_card.card_symbol_list.FindAll(p => p.line == i))
                {
                    BattleIcon icon = PrefabManager.Instance.MakeScript <BattleIcon>(battleMain.m_prefBattleIcon, battleMain.m_goBattleChara);
                    icon.Initialize(sym, iIndex, true);
                    battleMain.player_icon_list.Add(icon);
                    iIndex += 1;
                }
                iIndex = 0;
                foreach (MasterCardSymbolParam sym in battleMain.enemy_card.card_symbol_list.FindAll(p => p.line == i))
                {
                    BattleIcon icon = PrefabManager.Instance.MakeScript <BattleIcon>(battleMain.m_prefBattleIcon, battleMain.m_goBattleEnemy);
                    icon.Initialize(sym, iIndex, false);
                    battleMain.enemy_icon_list.Add(icon);
                    iIndex += 1;
                }
            }
        }
Ejemplo n.º 2
0
        private bool act_attack()
        {
            bool              bRet        = false;
            BattleIcon        target_icon = null;
            List <BattleIcon> target_list = null;

            if (is_player.Value)
            {
                target_icon = battleMain.player_icon_list.Find(p => p.master_symbol.card_symbol_id == symbol_id.Value);
                if (target_icon != null)
                {
                    target_list = battleMain.player_icon_list.FindAll(p => p.master_symbol.line == target_icon.master_symbol.line && p != target_icon);
                }
            }
            else
            {
                target_icon = battleMain.enemy_icon_list.Find(p => p.master_symbol.card_symbol_id == symbol_id.Value);
                if (target_icon != null)
                {
                    target_list = battleMain.enemy_icon_list.FindAll(p => p.master_symbol.line == target_icon.master_symbol.line && p != target_icon);
                }
            }
            if (target_icon != null)
            {
                target_icon.HitHandler.AddListener(OnHit);

                target_icon.m_animator.SetTrigger("attack");
                if (is_player.Value)
                {
                    battleMain.player_icon_list.Remove(target_icon);
                }
                else
                {
                    battleMain.enemy_icon_list.Remove(target_icon);
                }
                bRet = true;
            }
            if (target_list != null && 0 < target_list.Count)
            {
                foreach (BattleIcon icon in target_list)
                {
                    icon.move(Defines.ICON_MOVE_TIME, icon.index - 1, icon.master_symbol.line, icon.is_left);
                    icon.index -= 1;
                }
            }
            else
            {
                // ここいらない
                //bRet = false;
            }
            return(bRet);
        }
Ejemplo n.º 3
0
 private void OnHeal(BattleIcon arg0)
 {
     // アニメーションのタイミングを合わせるために階層で呼び出してます
     if (is_player.Value)
     {
         battleMain.m_animChara.SetBool("win_loop", true);
     }
     else
     {
     }
     SEControl.Instance.Play("Magic Heal 03");
     StartCoroutine(HealEffectAppear(arg0));
 }
Ejemplo n.º 4
0
 private void OnHit(BattleIcon arg0)
 {
     SEControl.Instance.Play(se_name.Value);
     // アニメーションのタイミングを合わせるために階層で呼び出してます
     if (is_player.Value)
     {
         battleMain.m_animEnemy.SetBool("damage", true);
     }
     else
     {
         battleMain.m_animChara.SetBool("damage", true);
     }
     StartCoroutine(DamageEffectAppear(arg0));
 }
Ejemplo n.º 5
0
        private void CheckIcons()
        {
            if (_battleIcons.Count > 0)
            {
                BattleIcon icon = _battleIcons.Peek();

                if (icon.IsDone)
                {
                    _battleIcons.Dequeue();
                }

                // don't loop over all of them...just get it the next iteration
            }
        }
Ejemplo n.º 6
0
        public bool act_heal()
        {
            BattleIcon        target_icon      = null;
            List <BattleIcon> target_line_list = null;
            List <BattleIcon> target_icon_list = null;

            bool bExist = false;

            if (is_player.Value)
            {
                target_icon_list = battleMain.player_icon_list;
            }
            else
            {
                target_icon_list = battleMain.enemy_icon_list;
            }

            target_icon = target_icon_list.Find(p => p.master_symbol.card_symbol_id == symbol_id.Value);
            //Debug.Log(target_icon);
            if (target_icon != null)
            {
                target_line_list = target_icon_list.FindAll(p => p.master_symbol.line == target_icon.master_symbol.line && p != target_icon);
            }

            if (target_icon != null)
            {
                bExist = true;
                target_icon.HealHandler.AddListener(OnHeal);
                target_icon.m_animator.SetTrigger("heal");
                target_icon_list.Remove(target_icon);
            }

            if (target_line_list != null && 0 < target_line_list.Count)
            {
                foreach (BattleIcon icon in target_line_list)
                {
                    icon.move(Defines.ICON_MOVE_TIME, icon.index - 1, icon.master_symbol.line, icon.is_left);
                    icon.index -= 1;
                }
            }
            return(bExist);
        }
Ejemplo n.º 7
0
        private IEnumerator HealEffectAppear(BattleIcon arg0)
        {
            // この微妙なずらし作業がしたかっただけ
            yield return(new WaitForSeconds(0.5f));

            int iHeal  = 12;
            int iSwing = UtilRand.GetRand(5) - 2;

            if (is_player.Value)
            {
                DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara");
                iHeal = unit_chara.heal + iSwing;
            }
            else
            {
                DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy");
                iHeal = unit_enemy.heal + iSwing;
            }
            //Debug.Log(iDamage);

            battleMain.Heal(is_player.Value, iHeal, OnHealFinished);

            // プレイヤー側の攻撃
            if (arg0.is_left)
            {
                DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara");
                unit_chara.HpHeal(iHeal);
                GameMain.Instance.CharaRefresh();
            }
            else
            {
                DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy");
                unit_enemy.HpHeal(iHeal);
            }
            battleMain.HpRefresh();
        }
Ejemplo n.º 8
0
 private void OnAttackFinished(BattleIcon arg0)
 {
     result_count += 1;
 }
Ejemplo n.º 9
0
        private IEnumerator DamageEffectAppear(BattleIcon arg0)
        {
            // この微妙なずらし作業がしたかっただけ
            yield return(new WaitForSeconds(0.5f));

            int iDamage = 12;
            int iSwing  = UtilRand.GetRand(5) - 2;

            if (is_player.Value)
            {
                DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara");

                switch (arg0.master_symbol.card_symbol_id)
                {
                case Defines.CARD_SYMBOL_ATTACK:
                    iDamage = unit_chara.str + iSwing;
                    break;

                case Defines.CARD_SYMBOL_MAGIC:
                    iDamage = unit_chara.magic + iSwing;
                    break;

                default:
                    break;
                }
            }
            else
            {
                DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy");
                switch (arg0.master_symbol.card_symbol_id)
                {
                case Defines.CARD_SYMBOL_ATTACK:
                    iDamage = unit_enemy.str + iSwing;
                    break;

                case Defines.CARD_SYMBOL_MAGIC:
                    iDamage = unit_enemy.magic + iSwing;
                    break;

                default:
                    break;
                }
            }
            //Debug.Log(iDamage);

            battleMain.Damage(is_player.Value, iDamage, OnDamageFinished);

            // プレイヤー側の攻撃
            if (arg0.is_left)
            {
                DataUnitParam enemy = DataManagerGame.Instance.dataUnit.list.Find(p =>
                                                                                  p.unit == "enemy");
                //Debug.Log(enemy.hp);
                enemy.hp -= iDamage;
            }
            else
            {
                DataUnitParam select_chara = DataManagerGame.Instance.dataUnit.list.Find(p =>
                                                                                         p.chara_id == GameMain.Instance.SelectCharaId &&
                                                                                         p.unit == "chara");

                select_chara.hp -= iDamage;
                GameMain.Instance.CharaRefresh();
            }
            battleMain.HpRefresh();
        }
Ejemplo n.º 10
0
        public override void OnEnter()
        {
            base.OnEnter();
            move_time = 0.5f;
            //m_fTime = 0.0f;
            offset_num   = 0;
            offset_count = 0;
            //Debug.Log("SymbolOffset.OnEnter");

            if (symbol_id_player_canceler.Value != 0)
            {
                BattleIcon player_icon_canceler = battleMain.player_icon_list.Find(p => p.master_symbol.card_symbol_id == symbol_id_player_canceler.Value);
                if (player_icon_canceler != null)
                {
                    Debug.Log("find canceler player");
                    Finish();
                    return;
                }
            }
            if (symbol_id_enemy_canceler.Value != 0)
            {
                BattleIcon enemy_icon_canceler = battleMain.enemy_icon_list.Find(p => p.master_symbol.card_symbol_id == symbol_id_enemy_canceler.Value);
                if (enemy_icon_canceler != null)
                {
                    Debug.Log("find canceler enemy");
                    Finish();
                    return;
                }
            }

            BattleIcon player_icon = battleMain.player_icon_list.Find(p => p.master_symbol.card_symbol_id == symbol_id_player.Value);
            BattleIcon enemy_icon  = battleMain.enemy_icon_list.Find(p => p.master_symbol.card_symbol_id == symbol_id_enemy.Value);

            if (player_icon != null && enemy_icon != null)
            {
                //m_bMove = true;

                player_icon.m_animator.SetTrigger("break");
                enemy_icon.m_animator.SetTrigger("break");

                offset_num += 2;

                player_icon.OnOffsetFinished.AddListener(OnIconOffsetFinished);
                enemy_icon.OnOffsetFinished.AddListener(OnIconOffsetFinished);

                List <BattleIcon> player_icon_list = battleMain.player_icon_list.FindAll(p => p.master_symbol.line == player_icon.master_symbol.line && p != player_icon);
                List <BattleIcon> enemy_icon_list  = battleMain.enemy_icon_list.FindAll(p => p.master_symbol.line == enemy_icon.master_symbol.line && p != enemy_icon);

                foreach (BattleIcon icon in player_icon_list)
                {
                    icon.move(move_time, icon.index - 1, icon.master_symbol.line, icon.is_left);
                    icon.index -= 1;
                }
                foreach (BattleIcon icon in enemy_icon_list)
                {
                    icon.move(move_time, icon.index - 1, icon.master_symbol.line, icon.is_left);
                    icon.index -= 1;
                }

                battleMain.player_icon_list.Remove(player_icon);
                battleMain.enemy_icon_list.Remove(enemy_icon);
            }
            else
            {
                //m_bMove = false;
                Finish();
            }
        }
Ejemplo n.º 11
0
        protected override void OnRegistered()
        {
            var layer = new asd.Layer2D();

            AddLayer(layer);

            // 下地
            var background = new asd.GeometryObject2D();

            layer.AddObject(background);
            var bgRect = new asd.RectangleShape();

            bgRect.DrawingArea = new asd.RectF(0, 0, 1800, 1000);
            background.Shape   = bgRect;

            var label = new asd.TextObject2D();

            label.Font     = Singleton.LargeFont;
            label.Text     = "VS";
            label.Position = new asd.Vector2DF(470, 400);
            layer.AddObject(label);

            var attackCityLabel = new asd.TextObject2D();

            attackCityLabel.Font     = Singleton.LargeFont;
            attackCityLabel.Text     = _attack.Name;
            attackCityLabel.Position = new asd.Vector2DF(450, 650);
            layer.AddObject(attackCityLabel);

            var deffenceCityLabel = new asd.TextObject2D();

            deffenceCityLabel.Font     = Singleton.LargeFont;
            deffenceCityLabel.Text     = _deffence.Name;
            deffenceCityLabel.Position = new asd.Vector2DF(450, 150);
            layer.AddObject(deffenceCityLabel);

            _attackParam          = new asd.TextObject2D();
            _attackParam.Font     = Singleton.LargeFont;
            _attackParam.Text     = "戦闘力:" + _attackPower;
            _attackParam.Position = new asd.Vector2DF(700, 650);
            layer.AddObject(_attackParam);

            _deffenceParam          = new asd.TextObject2D();
            _deffenceParam.Font     = Singleton.LargeFont;
            _deffenceParam.Text     = "戦闘力:" + _deffencePower;
            _deffenceParam.Position = new asd.Vector2DF(700, 150);
            layer.AddObject(_deffenceParam);

            _image_gu_attack = new BattleIcon(BattleIcon.Icon.Gu, BattleIcon.Position.Attack);
            _image_gu_attack.AddLayer(layer);
            _image_gu_attack.Hide();
            _image_choki_attack = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Attack);
            _image_choki_attack.AddLayer(layer);
            _image_choki_attack.Hide();
            _image_par_attack = new BattleIcon(BattleIcon.Icon.Par, BattleIcon.Position.Attack);
            _image_par_attack.AddLayer(layer);
            _image_par_attack.Hide();
            _image_gu_deffence = new BattleIcon(BattleIcon.Icon.Gu, BattleIcon.Position.Deffence);
            _image_gu_deffence.AddLayer(layer);
            _image_gu_deffence.Hide();
            _image_choki_deffence = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Deffence);
            _image_choki_deffence.AddLayer(layer);
            _image_choki_deffence.Hide();
            _image_par_deffence = new BattleIcon(BattleIcon.Icon.Par, BattleIcon.Position.Deffence);
            _image_par_deffence.AddLayer(layer);
            _image_par_deffence.Hide();
            _attackResult = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Attack);
            _attackResult.AddLayer(layer);
            _attackResult.Hide();
            _deffenceResult = new BattleIcon(BattleIcon.Icon.Choki, BattleIcon.Position.Deffence);
            _deffenceResult.AddLayer(layer);
            _deffenceResult.Hide();
        }
Ejemplo n.º 12
0
 private void CreateBattleIcon(BattleIcon e)
 {
     gameBox.Image = e.GenerateImage(true);
 }