Ejemplo n.º 1
0
    }                                             // 피격시 효과

    public virtual void Add(BattleSlot bs)
    {
        // 이미 있는 버프인지 검사. 있다면 중첩처리 재정의
        // ...

        bs.AddBuff(this);
    }
Ejemplo n.º 2
0
    void Start()
    {
        Vector3 spawnPos;

        // 슬롯 생성
        spawnPos    = PlayerZone.transform.position;
        spawnPos.x -= 50;
        //spawnPos.y -= 50;
        for (int i = 0; i < heros.Count; i++)
        {
            // 아군측
            heroSlots.Add(Instantiate(SlotPrefab, spawnPos, Quaternion.identity, PlayerZone.transform));
            BattleSlot slot = heroSlots[i].GetComponent <BattleSlot>();
            slot.Init(heros[i]);
            slot.SetSlotIndex(i);
        }

        spawnPos    = EnemyZone.transform.position;
        spawnPos.x += 50;
        //spawnPos.y -= 50;

        for (int i = 0; i < enemies.Count; i++)
        {
            // 적군측
            enemySlots.Add(Instantiate(SlotPrefab, spawnPos, Quaternion.identity, EnemyZone.transform));
            BattleSlot slot = enemySlots[i].GetComponent <BattleSlot>();
            slot.Init(enemies[i]);
            slot.SetSlotIndex(i);
        }
    }
Ejemplo n.º 3
0
    public void DropEvent()
    {
        Debug.Log("주사위 드랍");


        // 주사위를 쥐고있지 않을 경우 스킵한다
        if (bcm.GetDragDice() != null)
        {
            bcm.SetDragDice(null);

            // 드랍된 위치 체크. 전투슬롯의 위치인가?
            List <RaycastResult> results = new List <RaycastResult>();
            PointerEventData     ped     = new PointerEventData(null);
            ped.position = Input.mousePosition;

            graphicRaycaster.Raycast(ped, results);

            for (int i = 0; i < results.Count; i++)
            {
                BattleSlot bs = results[i].gameObject.GetComponent <BattleSlot>();
                if (bs)
                {
                    // 적쪽에 못올라가도록
                    if (bs.transform.parent.name == "EnemyZone")
                    {
                        break;
                    }

                    bcm.ResetDiceSlot();

                    // 전투 슬롯에 주사위 설정
                    bs.SetDice(this);

                    isOnBattleSlot = true;


                    // 타겟팅 시스템 설정
                    TargettingManager tm = FindObjectOfType <TargettingManager>();
                    if (tm)
                    {
                        bs.GetCurrentCommand().SetCaster(bs.gameObject);
                        tm.CreateTargetWindow(bs.GetCurrentCommand());
                    }



                    return;
                }
            }
        }

        //transform.position = defPos;
        bcm.ResetDiceSlot();
        bcm.SetDiceZone(this); // 주사위 존으로 되돌린다
        bcm.SetDragDice(null);
        isOnBattleSlot = false;
    }
Ejemplo n.º 4
0
    public BattleSlot[] GetEnemySlots()
    {
        BattleSlot[] res = new BattleSlot[enemySlots.Count];

        for (int i = 0; i < res.Length; i++)
        {
            res[i] = enemySlots[i].GetComponent <BattleSlot>();
        }

        return(res);
    }
Ejemplo n.º 5
0
 public void SlotClick(BagSlot bagSlot)
 {
     if (_selectBattleSlot == null)
     {
         if (_selectBagSlot != null)
         {
             _selectBagSlot.Deselect();
         }
         _selectBagSlot = bagSlot;
         _selectBagSlot.Select();
     }
     else
     {
         _selectBattleSlot.Deselect();
         ConcreteCard first = _selectBattleSlot.concreteCard, second = bagSlot.concreteCard;
         int          index = _selectBattleSlot.Index;
         _player.playCardSet [index] = second;
         _player.cardBag.Remove(second);
         if (first != null)
         {
             _player.cardBag.Add(first);
         }
         HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => {
             _shieldPanel.Activate();
         }).OnComplete(() => {
             _selectBattleSlot.LoadConcreteCard(second);
             HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => {
                 _shieldPanel.Deactivate();
                 _selectBattleSlot = null;
             }));
         }));
         Debug.Log(bagSlot.slotBody == null);
         HOTween.To(bagSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => {
             _shieldPanel.Activate();
         }).OnComplete(() => {
             if (first != null)
             {
                 bagSlot.LoadConcreteCard(first);
                 HOTween.To(bagSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => {
                     _shieldPanel.Deactivate();
                 }));
             }
             else
             {
                 _shieldPanel.Deactivate();
                 _grid.RemoveChild(bagSlot.transform);
                 _bagSlots.Remove(bagSlot);
                 Destroy(bagSlot.gameObject);
             }
         }));
     }
 }
Ejemplo n.º 6
0
    public override void EndTurn(BattleSlot bs)
    {
        // 턴종료시 인자값만큼 데미지 입는다. 취약효과 중첩 안되도록 도트피해함수 분리 필요
        bs.TakeTrueDmg(factor);

        // 인자값 감소
        factor -= 1;

        if (factor < 1)
        {
            // 디버프 소멸
            bs.RemoveBuff(this);
        }
    }
Ejemplo n.º 7
0
    public void EnemyAction(BattleSlot _bs)
    {
        Command curCommand = _bs.GetCurrentCommand();

        // 시전자 설정
        curCommand.SetCaster(_bs.gameObject);

        // 대상 자동 설정
        curCommand.SetAutoTarget(bcm.GetSlotObjects(), bcm.GetSlotObjects(false));

        // 전투 실행
        curCommand.GetCaster().GetComponent <BattleSlot>().PlaySkill();

        // 타겟팅 시스템 참조할 필요 없을 것.
    }
Ejemplo n.º 8
0
    void TargetClicked(BattleSlot slot, int id)
    {
        if (_selectedSkill?.targetCount != TargetAmount.Single)
        {
            return;
        }
        if (controller.allCharacters.ContainsKey(id))
        {
            _selectedTarget = controller.allCharacters[id];
        }
        _selectedSlot = slot;

        CurrentSkillStatus = SkillStatus.useSkill;
        UnhighlightEverything();
        HighLightPlayingField();
        HighlightTargetslot();
    }
Ejemplo n.º 9
0
    void SelectSkill(int selectedSkill)
    {
        _selectedTarget = null;
        _selectedSlot   = null;

        UnhighlightEverything();

        _selectedSkill = CurrentChar.Skills[selectedSkill];

        if (_selectedSkill.targetSite == TargetSite.Self)
        {
            CurrentSkillStatus = SkillStatus.useSkill;
        }
        else
        {
            if (_selectedSkill.targetCount == TargetAmount.Single)
            {
                switch (_selectedSkill.targetType)
                {
                case TargetType.Character:
                    CurrentSkillStatus = SkillStatus.selectCharacter;
                    break;

                case TargetType.Position:
                    CurrentSkillStatus = SkillStatus.selectPosition;
                    break;

                case TargetType.CharacterAndPosition:
                    CurrentSkillStatus = SkillStatus.selectCharAndPosition;
                    break;
                }
            }
            else
            {
                CurrentSkillStatus = SkillStatus.useSkill;
            }
        }

        for (int i = 0; i < skillEntries.Length; i++)
        {
            skillEntries[i].SetColor(i == selectedSkill && _selectedSkill.IsUsable(_currentChar) ? Colors.BATTLE_ACTIVE : Color.white);
        }
        HighLightPlayingField();
        ChangeSkillDescription();
    }
Ejemplo n.º 10
0
    public float[] GetObservations(BattleSlot parentSlot)
    {
        var obs = new float[10];

        for (var i = 0; i < heroSlots.Length; i++)
        {
            if (heroSlots[i].transform.childCount == 0)
            {
                obs[i] = 0f;
                continue;
            }
            obs[i] = ((Hero)heroSlots[i].transform.GetChild(0).GetComponent <BattleChar>().GetCharacter()).AverageToughness;
        }

        obs[9] = Array.IndexOf(enemySlots, parentSlot);

        return(obs);
    }
Ejemplo n.º 11
0
    GameObject SpawnEnemy(BattleSlot slot, string tag = "")
    {
        var position = enemyStartMedian.position;

        switch (slot)
        {
        case BattleSlot.Left: position.x += spacing; break;

        case BattleSlot.Right: position.x -= spacing; break;

        case BattleSlot.BackCenter: position.z -= spacing; break;

        case BattleSlot.BackLeft:
            position.x += spacing;
            position.z -= spacing;
            break;

        case BattleSlot.BackRight:
            position.x -= spacing;
            position.z -= spacing;
            break;

        default: break;
        }

        GameObject enemy;

        if (tag == "")
        {
            enemy = ObjectPool.Instance.Get("Enemy");
        }
        else
        {
            enemy = ObjectPool.Instance.Get(tag);
        }

        enemy.transform.position = position;
        enemy.transform.forward  = initiative == BattleInitiative.EnemyAmbushed ? -enemyStartMedian.forward : enemyStartMedian.forward;
        enemy.SetActive(true);

        return(enemy);
    }
Ejemplo n.º 12
0
    GameObject SpawnPlayer(BattleSlot slot, string tag = "")
    {
        var position = playerStartMedian.position;

        switch (slot)
        {
        case BattleSlot.Left: position.x += spacing; break;

        case BattleSlot.Right: position.x -= spacing; break;

        case BattleSlot.BackCenter: position.z -= spacing; break;

        case BattleSlot.BackLeft:
            position.x += spacing;
            position.z -= spacing;
            break;

        case BattleSlot.BackRight:
            position.x -= spacing;
            position.z -= spacing;
            break;

        default: break;
        }

        GameObject player;

        if (tag == "")
        {
            player = ObjectPool.Instance.Get("Player");
        }
        else
        {
            player = ObjectPool.Instance.Get(tag);
        }

        player.transform.position = position;
        player.transform.forward  = initiative == BattleInitiative.PlayerAmbushed ? -playerStartMedian.forward : playerStartMedian.forward;
        player.SetActive(true);

        return(player);
    }
Ejemplo n.º 13
0
    public BattleSlot[] GetAllSlots()
    {
        int length = enemySlots.Count + heroSlots.Count;

        BattleSlot[] res = new BattleSlot[length];

        int i = 0;

        for (int j = 0; i < heroSlots.Count; i++, j++)
        {
            res[i] = heroSlots[i].GetComponent <BattleSlot>();
        }

        for (int j = 0; j < enemySlots.Count; i++, j++)
        {
            res[i] = enemySlots[j].GetComponent <BattleSlot>();
        }

        return(res);
    }
Ejemplo n.º 14
0
 public void SlotShowDetail(BattleSlot battleSlot)
 {
     SlotShowDetail(battleSlot.concreteCard);
 }
Ejemplo n.º 15
0
 public virtual void EndTurn(BattleSlot bs)
 {
 }                                             // 턴 종료시 효과
Ejemplo n.º 16
0
 public void SlotClick(BattleSlot battleSlot)
 {
     if (_selectBattleSlot == null)
     {
         if (_selectBagSlot != null)
         {
             _selectBagSlot.Deselect();
             _selectBagSlot = null;
         }
         _selectBattleSlot = battleSlot;
         battleSlot.Select();
     }
     else                                                 //has selected a battleSlot
     {
         if (_selectBattleSlot.Index == battleSlot.Index) //Click the same slot,deselect
         {
             battleSlot.Deselect();
             _selectBattleSlot = null;
         }
         else if (_selectBattleSlot.concreteCard == null)
         {
             _selectBattleSlot.Deselect();
             _selectBattleSlot = battleSlot;
             _selectBattleSlot.Select();
         }
         else
         {
             _selectBattleSlot.Deselect();
             ConcreteCard first = _selectBattleSlot.concreteCard, second = battleSlot.concreteCard;
             int          indexFst = _selectBattleSlot.Index, indexSec = battleSlot.Index;
             _player.playCardSet [indexFst] = second;
             _player.playCardSet [indexSec] = first;
             HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => {
                 _shieldPanel.Activate();
             }).OnComplete(() => {
                 if (second != null)
                 {
                     _selectBattleSlot.LoadConcreteCard(second);
                     HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => {
                         _shieldPanel.Deactivate();
                         _selectBattleSlot = null;
                     }));
                 }
                 else
                 {
                     _shieldPanel.Deactivate();
                     _selectBattleSlot.Unload();
                     _selectBattleSlot = null;
                 }
             }));
             HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => {
                 _shieldPanel.Activate();
             }).OnComplete(() => {
                 battleSlot.LoadConcreteCard(first);
                 HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => {
                     _shieldPanel.Deactivate();
                 }));
             }));
         }
     }
 }
Ejemplo n.º 17
0
    }                                             // 턴 종료시 효과

    public virtual void Attack(BattleSlot bs)
    {
    }                                            //공격시 효과
Ejemplo n.º 18
0
 private void Start()
 {
     bs = transform.parent.GetComponent <BattleSlot>();
 }
Ejemplo n.º 19
0
    }                                            //공격시 효과

    public virtual void TakeDot(BattleSlot bs)
    {
    }                                             // 피격시 효과
Ejemplo n.º 20
0
 public override void TakeDot(BattleSlot bs)
 {
     bs.TakeTrueDmg(factor);
 }