Ejemplo n.º 1
0
        //무기 휘두르기 : 키입력을 먼저한 쪽이 공격, 늦게한 쪽이 방어가 된다.
        public void Wield_Weapon(uint inputPNum)
        {
            const uint PLAYERNUM_1P = 1;
            const uint PLAYERNUM_2P = 2;

            Judgment.Result jResult = _judgment.GetResult();
            DebugWide.LogGreen(jResult.state_1p + "   " + jResult.state_2p);                      //chamto test

            if (inputPNum == PLAYERNUM_1P)
            {
                if (true == _2pInfo.IsAttacking())
                {
                    //방어 성공시 공격행동으로 전환 시킨다
                    if (Judgment.eState.BlockSucceed == jResult.state_1p)
                    {
                        _1pInfo.NextState(CharacterInfo.eState.Attack);
                        _skillMgr.InsertInterval(inputPNum, SkillMgr.eGestureKind.Attack_Sword);
                    }
                    else
                    {
                        _1pInfo.NextState(CharacterInfo.eState.Block);
                        _skillMgr.InsertInterval(inputPNum, SkillMgr.eGestureKind.Block_Sword);
                    }
                }
                else
                {
                    _1pInfo.NextState(CharacterInfo.eState.Attack);
                    _skillMgr.InsertInterval(inputPNum, SkillMgr.eGestureKind.Attack_Sword);
                }
            }
            if (inputPNum == PLAYERNUM_2P)
            {
                if (true == _1pInfo.IsAttacking())
                {
                    if (Judgment.eState.BlockSucceed == jResult.state_2p)
                    {
                        _2pInfo.NextState(CharacterInfo.eState.Attack);
                        _skillMgr.InsertInterval(inputPNum, SkillMgr.eGestureKind.Attack_Sword);
                    }
                    else
                    {
                        _2pInfo.NextState(CharacterInfo.eState.Block);
                        _skillMgr.InsertInterval(inputPNum, SkillMgr.eGestureKind.Block_Sword);
                    }
                }
                else
                {
                    _2pInfo.NextState(CharacterInfo.eState.Attack);
                    _skillMgr.InsertInterval(inputPNum, SkillMgr.eGestureKind.Attack_Sword);
                }
            }
        }
Ejemplo n.º 2
0
        void Update_UI()
        {
            Judgment.Result jResult = _judgment.GetResult();
            _1pHpBar.value = _1pInfo.GetHP();
            _2pHpBar.value = _2pInfo.GetHP();

            //====//====//====//====//====//====

            _1pExplanation1.text =
                "  " + JudgmentToString(jResult.state_1p);
            _2pExplanation1.text =
                "  " + JudgmentToString(jResult.state_2p);


            _1pExplanation2.text =
                StateToString(_1pInfo.CurrentState()) + "  " +
                _1pInfo.GetTimeDelta().ToString("0.0");
            _2pExplanation2.text =
                StateToString(_2pInfo.CurrentState()) + "   " +
                _2pInfo.GetTimeDelta().ToString("0.0");


            //====//====//====//====//====//====

            _1pSprite_02.gameObject.SetActive(false);
            _1pSprite_03.gameObject.SetActive(false);
            _2pSprite_02.gameObject.SetActive(false);
            _2pSprite_03.gameObject.SetActive(false);

            _1pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P1_IDLE);
            _2pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P2_IDLE);

            //1p
            if (CharacterInfo.eState.Attack_Before == _1pInfo.CurrentState())
            {
                _1pSprite_02.gameObject.SetActive(true);
                _1pSprite_02.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P1_ATTACK_BEFORE);
            }
            if (CharacterInfo.eState.Attack_After == _1pInfo.CurrentState())
            {
                //_1pSprite_02.gameObject.SetActive (true);
                _1pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P1_ATTACK_AFTER);
            }
            if (CharacterInfo.eState.Block_Before == _1pInfo.CurrentState())
            {
                _1pSprite_02.gameObject.SetActive(true);
                _1pSprite_02.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P1_BLOCK_BEFORE);
            }
            if (CharacterInfo.eState.Block_After == _1pInfo.CurrentState())
            {
                //_1pSprite_02.gameObject.SetActive (true);
                _1pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P1_BLOCK_AFTER);
            }
            if (CharacterInfo.eState.Hit == _1pInfo.CurrentState())
            {
                //_1pSprite_02.gameObject.SetActive (true);
                _1pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.EMPTY_CARD);
            }

            //2p
            if (CharacterInfo.eState.Attack_Before == _2pInfo.CurrentState())
            {
                _2pSprite_02.gameObject.SetActive(true);
                _2pSprite_02.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P2_ATTACK_BEFORE);
            }
            if (CharacterInfo.eState.Attack_After == _2pInfo.CurrentState())
            {
                //_2pSprite_02.gameObject.SetActive (true);
                _2pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P2_ATTACK_AFTER);
            }
            if (CharacterInfo.eState.Block_Before == _2pInfo.CurrentState())
            {
                _2pSprite_02.gameObject.SetActive(true);
                _2pSprite_02.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P2_BLOCK_BEFORE);
            }
            if (CharacterInfo.eState.Block_After == _2pInfo.CurrentState())
            {
                //_2pSprite_02.gameObject.SetActive (true);
                _2pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P2_BLOCK_AFTER);
            }
            if (CharacterInfo.eState.Hit == _2pInfo.CurrentState())
            {
                //_2pSprite_02.gameObject.SetActive (true);
                _2pSprite_01.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.EMPTY_CARD);
            }


            //====//====//====//====//====//====

            _1pImage.color        = Color.black;
            _2pImage.color        = Color.black;
            _1pExplanation2.color = Color.black;
            _2pExplanation2.color = Color.black;
            _1pSprite_01.color    = Color.white;
            _1pSprite_02.color    = Color.white;
            _1pSprite_03.color    = Color.white;
            _2pSprite_01.color    = Color.white;
            _2pSprite_02.color    = Color.white;
            _2pSprite_03.color    = Color.white;
            if (true == _1pInfo.Valid_Attack())
            {
                _1pImage.color        = Color.red;
                _1pExplanation2.color = Color.red;

                _1pSprite_03.gameObject.SetActive(true);
                _1pSprite_03.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P1_ATTACK_VALID);


                if (Judgment.eState.AttackSucceed == jResult.state_1p)
                {
                    _2pSprite_01.color = Color.red;
                    _2pSprite_02.color = Color.red;
                    _2pSprite_03.color = Color.red;
                }
            }
            if (true == _2pInfo.Valid_Attack())
            {
                _2pImage.color        = Color.red;
                _2pExplanation2.color = Color.red;

                _2pSprite_03.gameObject.SetActive(true);
                _2pSprite_03.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P2_ATTACK_VALID);

                if (Judgment.eState.AttackSucceed == jResult.state_2p)
                {
                    _1pSprite_01.color = Color.red;
                    _1pSprite_02.color = Color.red;
                    _1pSprite_03.color = Color.red;
                }
            }

            if (true == _1pInfo.Valid_Block())
            {
                _1pImage.color        = Color.blue;
                _1pExplanation2.color = Color.blue;

                _1pSprite_03.gameObject.SetActive(true);
                _1pSprite_03.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P1_BLOCK_VALID);

                if (Judgment.eState.BlockSucceed == jResult.state_1p)
                {
                    _1pSprite_01.color = Color.blue;
                    _1pSprite_02.color = Color.blue;
                    _1pSprite_03.color = Color.blue;
                }
            }
            if (true == _2pInfo.Valid_Block())
            {
                _2pImage.color        = Color.blue;
                _2pExplanation2.color = Color.blue;

                _2pSprite_03.gameObject.SetActive(true);
                _2pSprite_03.sprite = _refResourceMgr.GetSprite(ResourceMgr.eSPRITE_NAME.P2_BLOCK_VALID);

                if (Judgment.eState.BlockSucceed == jResult.state_2p)
                {
                    _2pSprite_01.color = Color.blue;
                    _2pSprite_02.color = Color.blue;
                    _2pSprite_03.color = Color.blue;
                }
            }


            if (0 == _1pInfo.GetHP())
            {
                _1pSprite_01.gameObject.SetActive(false);
            }
            if (0 == _2pInfo.GetHP())
            {
                _2pSprite_01.gameObject.SetActive(false);
            }
            //====//====//====//====//====//====
        }