예제 #1
0
    //技が当たった時の処理
    private void CheckHitBox(BoxCollider _bCol, FighterSkill.CustomHitBox _cHit)
    {
        Transform t = _bCol.gameObject.transform;

        Collider[] col = Physics.OverlapBox(new Vector3(t.position.x + _bCol.center.x, t.position.y + _bCol.center.y, t.position.z + _bCol.center.z), _bCol.size / 2, Quaternion.identity, -1 - (1 << LayerMask.NameToLayer(CommonConstants.Layers.GetPlayerNumberLayer(core.PlayerNumber))));
        foreach (Collider c in col)
        {
            if (c.gameObject.tag == CommonConstants.Tags.GetTags(HitBoxMode.HurtBox))
            {
                FighterCore cr = GameManager.Instance.GetPlayFighterCore(c.gameObject.layer);
                //ダメージを与える
                cr.SetDamage(_cHit, _bCol);
                cr.SetEnemyNumber(core.PlayerNumber);                //現在フォーカス中の敵のセット(未使用)
                ////エフェクト再生 ※エフェクトは当たった側で管理
                //for (int i = 0; i < _cHit.hitEffects.Count; i++)
                //{
                //    if (_cHit.hitEffects[i].effect != null)
                //    {
                //        if (core.Direction == PlayerDirection.Right)
                //        {
                //            Object.Instantiate(_cHit.hitEffects[i].effect, new Vector3(t.position.x + _bCol.center.x + _cHit.hitEffects[i].position.x, t.position.y + _bCol.center.y + _cHit.hitEffects[i].position.y, t.position.z + _bCol.center.z + _cHit.hitEffects[i].position.z), Quaternion.identity);
                //        }
                //        else if (core.Direction == PlayerDirection.Left)
                //        {
                //            Object.Instantiate(_cHit.hitEffects[i].effect, new Vector3(t.position.x + _bCol.center.x + _cHit.hitEffects[i].position.x, t.position.y + _bCol.center.y + _cHit.hitEffects[i].position.y, t.position.z + _bCol.center.z + _cHit.hitEffects[i].position.z), Quaternion.Euler(0,180,0));
                //        }
                //    }
                //}

                attackHit = true;
                return;
            }
        }
    }
    //ヒットボックス個々(FoldOutした中身)
    private bool FoldOutHitBox(List <FighterSkill.FrameHitBox> frameHitBox, string label, ref bool frag, FighterSkill.CustomHitBox cus = null)
    {
        if (frag = CustomUI.Foldout(label, frag))
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(frameHitBox.Count.ToString());
            if (GUILayout.Button("判定作成", GUILayout.Width(80)))
            {
                frameHitBox.Add(new FighterSkill.FrameHitBox());
            }
            EditorGUILayout.EndHorizontal();
            //スライダーその他の作成
            for (int i = 0; i < frameHitBox.Count; i++)
            {
                EditorGUILayout.BeginVertical("Box");
                //数値の入れ替え
                float frameStart = frameHitBox[i].startFrame;
                float frameEnd   = frameHitBox[i].endFrame;
                EditorGUILayout.BeginHorizontal();
                //左
                frameStart = (int)EditorGUILayout.FloatField(frameStart, GUILayout.Width(30));
                if (frameStart > frameEnd)
                {
                    frameStart = frameEnd - 1;
                }
                if (frameStart < 0)
                {
                    frameStart = 0;
                }
                //スライダー
                EditorGUILayout.MinMaxSlider(ref frameStart, ref frameEnd, 0, rightValue);
                //右
                frameEnd = (int)EditorGUILayout.FloatField(frameEnd, GUILayout.Width(30));
                if (frameEnd < frameStart)
                {
                    frameEnd = frameEnd - 1;
                }
                if (frameEnd > rightValue)
                {
                    frameEnd = rightValue;
                }
                //削除
                bool f = false;
                if (GUILayout.Button("×", GUILayout.Width(20)))
                {
                    f = true;
                }
                EditorGUILayout.EndHorizontal();

                frameHitBox[i].startFrame = (int)frameStart;
                frameHitBox[i].endFrame   = (int)frameEnd;

                //当たり判定の設定
                HitFoldOut(frameHitBox[i]);

                EditorGUILayout.EndVertical();
                if (f)
                {
                    frameHitBox.Remove(frameHitBox[i]);
                }
            }
        }
        return(frag);
    }
예제 #3
0
    //ガード開始
    public void GuardStart()
    {
        isGuard    = false;
        isGuardEnd = false;
        FighterSkill.CustomHitBox box = stateBase.core.GetDamage;
        //硬直
        hitRigor = box.hitRigor;
        hitCount = 0;
        //ヒットストップ
        GameManager.Instance.SetHitStop(stateBase.core.PlayerNumber, box.hitStop);
        //相打ち時に受けたほうを優先する
        if (GameManager.Instance.GetHitStop(stateBase.core.EnemyNumber) <= 0)
        {
            GameManager.Instance.SetHitStop(stateBase.core.EnemyNumber, box.hitStop);
        }

        Direction inp = stateBase.input.GetPlayerMoveDirection(stateBase);

        if (inp == Direction.Back)
        {
            stateBase.ChangeSkillConstant(SkillConstants.Stand_Guard, 0);
        }
        else if (inp == Direction.DownBack)
        {
            stateBase.ChangeSkillConstant(SkillConstants.Crouching_Guard, 0);
        }
        //ノックバックのセット
        PlayerDirection tmpDir;

        //右向きにノックバックするか左向きにノックバックするか
        if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Right)
        {
            tmpDir = PlayerDirection.Left;
        }
        else
        {
            tmpDir = PlayerDirection.Right;
        }

        //エフェクト再生
        BoxCollider _bCol = stateBase.core.GetDamageCollider;
        Transform   t     = _bCol.gameObject.transform;

        for (int i = 0; i < box.hitEffects.Count; i++)
        {
            if (box.hitEffects[i].guardEffect != null)
            {
                if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Right)
                {
                    Object.Instantiate(box.hitEffects[i].guardEffect, new Vector3(t.position.x + _bCol.center.x + box.hitEffects[i].position.x, t.position.y + _bCol.center.y + box.hitEffects[i].position.y, t.position.z + _bCol.center.z + box.hitEffects[i].position.z), Quaternion.identity);
                }
                else if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Left)
                {
                    Object.Instantiate(box.hitEffects[i].guardEffect, new Vector3(t.position.x + _bCol.center.x + box.hitEffects[i].position.x, t.position.y + _bCol.center.y + box.hitEffects[i].position.y, t.position.z + _bCol.center.z + box.hitEffects[i].position.z), Quaternion.Euler(0, 180, 0));
                }
            }
        }

        stateBase.core.SetKnockBack(box.guardKnockBack, stateBase.core.EnemyNumber, tmpDir);
        //ダメージを受けたのでリセット
        stateBase.core.SetDamage(new FighterSkill.CustomHitBox(), null);
    }
예제 #4
0
 public void SetDamage(FighterSkill.CustomHitBox _s, BoxCollider _col)
 {
     applyDamageSkill    = _s;
     applyDamageCollider = _col;
 }
    public void DownHitStart()
    {
        isEndStun = false;
        FighterSkill.CustomHitBox box = stateBase.core.GetDamage;
        //ヒット硬直(空中受け身まで)
        hitRigor = box.hitRigor;
        hitCount = 0;

        //ヒットストップ
        GameManager.Instance.SetHitStop(stateBase.core.PlayerNumber, box.hitStop);
        //相打ち時に受けたほうを優先する
        if (GameManager.Instance.GetHitStop(stateBase.core.EnemyNumber) <= 0)
        {
            GameManager.Instance.SetHitStop(stateBase.core.EnemyNumber, box.hitStop);
        }
        //ダウンやられ
        if (stateBase.core.GetDamage.frameHitBoxes.Count > 0)
        {
            //ダメージ処理
            stateBase.core.HP -= box.damage;
            if (stateBase.core.HP < 0)
            {
                stateBase.core.HP = 0;
            }
            stateBase.ChangeSkillCustomMoveConstant(SkillConstants.Damage_Fly_HitMotion, 0, box.movements, box.gravityMoves, box.isContinue);
        }
        PlayerDirection tmpDir;

        //ノックバックのセット
        if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Right)
        {
            tmpDir = PlayerDirection.Left;
        }
        else
        {
            tmpDir = PlayerDirection.Right;
        }

        //エフェクト再生
        BoxCollider _bCol = stateBase.core.GetDamageCollider;
        Transform   t     = _bCol.gameObject.transform;

        for (int i = 0; i < box.hitEffects.Count; i++)
        {
            if (box.hitEffects[i].effect != null)
            {
                if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Right)
                {
                    Object.Instantiate(box.hitEffects[i].effect, new Vector3(t.position.x + _bCol.center.x + box.hitEffects[i].position.x, t.position.y + _bCol.center.y + box.hitEffects[i].position.y, t.position.z + _bCol.center.z + box.hitEffects[i].position.z), Quaternion.identity);
                }
                else if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Left)
                {
                    Object.Instantiate(box.hitEffects[i].effect, new Vector3(t.position.x + _bCol.center.x + box.hitEffects[i].position.x, t.position.y + _bCol.center.y + box.hitEffects[i].position.y, t.position.z + _bCol.center.z + box.hitEffects[i].position.z), Quaternion.Euler(0, 180, 0));
                }
            }
        }

        //ノックバックのセット
        stateBase.core.SetKnockBack(box.airKnockBack, stateBase.core.EnemyNumber, tmpDir, 6);
        stateBase.core.SetDamage(new FighterSkill.CustomHitBox(), null);
    }
    //やられ
    public void HitStunStart()
    {
        isEndStun = false;
        FighterSkill.CustomHitBox box = stateBase.core.GetDamage;
        //硬直
        hitRigor = box.hitRigor;
        hitCount = 0;

        //ヒットストップ
        GameManager.Instance.SetHitStop(stateBase.core.PlayerNumber, box.hitStop);
        //相打ち時に受けたほうを優先する
        if (GameManager.Instance.GetHitStop(stateBase.core.EnemyNumber) <= 0)
        {
            GameManager.Instance.SetHitStop(stateBase.core.EnemyNumber, box.hitStop);
        }
        //立ちやられ
        if (stateBase.core.GetDamage.frameHitBoxes.Count > 0)
        {
            //ダメージ処理
            stateBase.core.HP -= box.damage;
            if (stateBase.core.HP < 0)
            {
                stateBase.core.HP = 0;
            }
            switch (box.hitPoint)
            {
            case HitPoint.Bottom:
                switch (box.hitStrength)
                {
                case HitStrength.Light:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Light_Bottom_HitMotion, 0);
                    break;

                case HitStrength.Middle:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Middle_Bottom_HitMotion, 0);
                    break;

                case HitStrength.Strong:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Strong_Bottom_HitMotion, 0);
                    break;
                }
                break;

            case HitPoint.Middle:
                switch (box.hitStrength)
                {
                case HitStrength.Light:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Light_Middle_HitMotion, 0);
                    break;

                case HitStrength.Middle:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Middle_Middle_HitMotion, 0);
                    break;

                case HitStrength.Strong:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Strong_Middle_HitMotion, 0);
                    break;
                }
                break;

            case HitPoint.Top:
                switch (box.hitStrength)
                {
                case HitStrength.Light:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Light_Top_HitMotion, 0);
                    break;

                case HitStrength.Middle:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Middle_Top_HitMotion, 0);
                    break;

                case HitStrength.Strong:
                    stateBase.ChangeSkillConstant(SkillConstants.Stand_Strong_Top_HitMotion, 0);
                    break;
                }
                break;
            }
        }
        //ノックバックのセット
        PlayerDirection tmpDir;

        //右向きにノックバックするか左向きにノックバックするか
        if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Right)
        {
            tmpDir = PlayerDirection.Left;
        }
        else
        {
            tmpDir = PlayerDirection.Right;
        }
        //エフェクト再生
        BoxCollider _bCol = stateBase.core.GetDamageCollider;
        Transform   t     = _bCol.gameObject.transform;

        for (int i = 0; i < box.hitEffects.Count; i++)
        {
            if (box.hitEffects[i].effect != null)
            {
                if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Right)
                {
                    Object.Instantiate(box.hitEffects[i].effect, new Vector3(t.position.x + _bCol.center.x + box.hitEffects[i].position.x, t.position.y + _bCol.center.y + box.hitEffects[i].position.y, t.position.z + _bCol.center.z + box.hitEffects[i].position.z), Quaternion.identity);
                }
                else if (GameManager.Instance.GetPlayFighterCore(stateBase.core.EnemyNumber).Direction == PlayerDirection.Left)
                {
                    Object.Instantiate(box.hitEffects[i].effect, new Vector3(t.position.x + _bCol.center.x + box.hitEffects[i].position.x, t.position.y + _bCol.center.y + box.hitEffects[i].position.y, t.position.z + _bCol.center.z + box.hitEffects[i].position.z), Quaternion.Euler(0, 180, 0));
                }
            }
        }

        stateBase.core.SetKnockBack(box.knockBack, stateBase.core.EnemyNumber, tmpDir);
        //ダメージを受けたのでリセット
        stateBase.core.SetDamage(new FighterSkill.CustomHitBox(), null);
    }