Exemplo n.º 1
0
 private void CheckNowPlaySkill()
 {
     //技の取得
     if (nowPlaySkill != animationPlayer.NowPlaySkill)
     {
         changeSkill  = true;
         nowPlaySkill = animationPlayer.NowPlaySkill;
     }
 }
    public void resetState()
    {
        this.curState = fighterState.GROUNDED;
        curSkill      = null;
        initialFrame  = 0;
        isDash        = false;
        isGlide       = false;

        resetSkills(normalSkill);
        resetSkills(crouchingSkill);
        resetSkills(jumpingSkill);
        resetSkills(skillList);
    }
 public static void Open(FighterSkill ps)
 {
     if (PlayerSkillEditorParameter.instance.window == null)
     {
         PlayerSkillEditorParameter.instance.window             = (PlayerSkillEditor)CreateInstance(typeof(PlayerSkillEditor));
         PlayerSkillEditorParameter.instance.window.playerSkill = ps;
         PlayerSkillEditorParameter.instance.window.Show();
     }
     else
     {
         PlayerSkillEditorParameter.instance.window.playerSkill = ps;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 再生する技の変更
 /// </summary>
 /// <param name="skill"></param>
 /// <param name="speed"></param>
 /// <param name="weightFrame"></param>
 public void SetSkillAnimation(FighterSkill skill, int weightFrame = 0)
 {
     nowPlaySkill       = skill;
     beforeNowPlaySkill = nowPlaySkill;
     if (nowPlaySkill == null)
     {
         return;
     }
     if (nowPlaySkill.animationClip != null)
     {
         SetPlayAnimation(skill.animationClip, skill.animationSpeed, weightFrame);
     }
 }
    public bool equals(FighterSkill f)
    {
        if (f == null)
        {
            return(false);
        }

        if (
            this.hitstun == f.getHitStun() &&
            this.basePow == f.getBasePow() &&
            this.FAF == f.firstActive() &&
            this.xPow == f.getXPow() &&
            this.yPow == f.getYPow()
            )
        {
            return(true);
        }
        return(false);
    }
Exemplo n.º 6
0
 public void UpdateGame()
 {
     //技の入れ替え
     if (nextAnimation != null)
     {
         animationPlayer.SetSkillAnimation(nextAnimation, changeWeightFrame);
         nextAnimation     = null;
         changeSkill       = true;
         changeWeightFrame = 0;
     }
     //技が入れ替わってから動作させたいのでanimationのアップデートは後
     animationPlayer.UpdateGame();
     //アニメーションが入れ替わってから入れ替わったかどうかチェック
     CheckNowPlaySkill();
     //移動のアップデート
     mover.UpdateGame();
     //当たり判定のアップデート
     hitJudgement.UpdateGame();
     //終了
     UpdateEnd();
 }
    // Performs attack that was last selected
    private void Attack(GameObject player, float minHeight, GameObject mySound)
    {
        int forward = (int)player.transform.localScale.x;

        if (curSkill == null)
        {
            AttackSel(player, minHeight, mySound);
        }

        // If the move is special cancelable, check if a special was inputted
        if (this.curSkill.isSpecialCancelable() && this.curSkill.getHasHit())
        {
            // Check the three most recent input
            bool      skillDetected = false;
            KeyCode[] inputChain    = { KeyCode.None, KeyCode.None, KeyCode.None };
            readBuffer(inputChain, 15);
            // Flip order of inputs
            inputChain[2] = inputChain[0];
            inputChain[0] = inputChain[1];
            inputChain[1] = inputChain[2];

            for (int i = 0; i < this.skillList.Count && i < (this.curLevel - 5) / 10 && !skillDetected; i++)
            {
                bool      correctInput = true;
                KeyCode[] input        = (KeyCode[])this.skillList[i].getInput().Clone();

                // Swap left and right keys if the player is facing the other way
                if (player.transform.localScale.x < 0)
                {
                    for (int j = 0; j < input.Length; j++)
                    {
                        if (input[j] == DataManager.savedOptions.controls[(int)key.LEFT])
                        {
                            input[j] = DataManager.savedOptions.controls[(int)key.RIGHT];
                        }
                        else if (input[j] == DataManager.savedOptions.controls[(int)key.RIGHT])
                        {
                            input[j] = DataManager.savedOptions.controls[(int)key.LEFT];
                        }
                    }
                }

                if (input[input.Length - 1] == DataManager.savedOptions.controls[(int)key.B1])
                {
                    correctInput = onPress[(int)key.B1];
                }
                else if (input[input.Length - 1] == DataManager.savedOptions.controls[(int)key.B2])
                {
                    correctInput = onPress[(int)key.B2];
                }
                else if (input[input.Length - 1] == DataManager.savedOptions.controls[(int)key.B3])
                {
                    correctInput = onPress[(int)key.B3];
                }
                for (int j = 0; j < inputChain.Length - 1 && correctInput; j++)
                {
                    if (j >= input.Length || input[j] != inputChain[j])
                    {
                        correctInput = false;
                        break;
                    }
                }

                if (correctInput)
                {
                    this.curSkill.resetAnims();
                    this.curSkill = this.skillList[i];
                    resetWait();
                    skillDetected = true;

                    // Play skill sound effect
                    if (curSkill != null)
                    {
                        mySound.GetComponent <AudioSource>().clip = curSkill.getSFX();
                        mySound.GetComponent <AudioSource>().Play();
                    }
                    break;
                }
            }
        }

        // Check for normal cancel
        if ((this.normalSkill.Contains(curSkill) || this.crouchingSkill.Contains(curSkill)) && this.curSkill.getHasHit())
        {
            int skillOrder = 0;
            if (this.normalSkill.Contains(curSkill))
            {
                skillOrder = this.normalSkill.IndexOf(curSkill);
            }
            else
            {
                skillOrder = this.crouchingSkill.IndexOf(curSkill);
            }

            // Find last attack input
            if (onPress[(int)key.B1] && skillOrder < 1)
            {
                this.curSkill.resetAnims();
                if (pressing[(int)key.DOWN])
                {
                    this.curSkill = crouchingSkill[0];
                }
                else
                {
                    this.curSkill = normalSkill[0];
                }
                resetWait();

                // Play skill sound effect
                if (curSkill != null)
                {
                    mySound.GetComponent <AudioSource>().clip = curSkill.getSFX();
                    mySound.GetComponent <AudioSource>().Play();
                }
            }
            else if (onPress[(int)key.B2] && skillOrder < 2)
            {
                this.curSkill.resetAnims();
                if (pressing[(int)key.DOWN])
                {
                    this.curSkill = crouchingSkill[1];
                }
                else
                {
                    this.curSkill = normalSkill[1];
                }
                resetWait();

                // Play skill sound effect
                if (curSkill != null)
                {
                    mySound.GetComponent <AudioSource>().clip = curSkill.getSFX();
                    mySound.GetComponent <AudioSource>().Play();
                }
            }
            else if (onPress[(int)key.B3] && skillOrder < 3)
            {
                this.curSkill.resetAnims();
                if (pressing[(int)key.DOWN])
                {
                    this.curSkill = crouchingSkill[2];
                }
                else
                {
                    this.curSkill = normalSkill[2];
                }
                resetWait();

                // Play skill sound effect
                if (curSkill != null)
                {
                    mySound.GetComponent <AudioSource>().clip = curSkill.getSFX();
                    mySound.GetComponent <AudioSource>().Play();
                }
            }
        }

        // Check if player has jump canceled the attack
        if (this.curSkill.isJumpCancelable() && pressing[(int)key.UP])
        {
            this.curSkill.resetAnims();
            this.curSkill = null;
            resetWait();
            this.curState = fighterState.GROUNDED;
        }
        // Otherwise play the move until the first active frame of the move
        else if (!WaitForXFrames(this.curSkill.firstActive()))
        {
            player.GetComponent <SpriteRenderer>().sprite = this.curSkill.playSkill(forward == 1);
            player.transform.Translate(forward * this.curSkill.getXShift() * Time.deltaTime, this.curSkill.getYShift() * Time.deltaTime, 0);

            if (this.curSkill.hitboxOut(player.transform.localScale.x == 1, Time.frameCount - initialFrame) && this.curSkill.isProjectile())
            {
                this.projectileOut = true;
            }

            // If jumping attack, apply gravity
            if (this.jumpingSkill.Contains(this.curSkill))
            {
                applyGravity(player);

                // Check if player touched the ground
                if (player.transform.localPosition.y <= minHeight)
                {
                    resetWait();
                    this.jumpCount = 0;
                    player.transform.localPosition = new Vector2(player.transform.localPosition.x, minHeight);
                    this.curState = fighterState.GROUNDED;
                    this.curSkill.resetAnims();
                    curSkill = null;
                }
            }
            else
            {
                // Slide back player
                if (slideBack > 0)
                {
                    player.transform.Translate(-1 * curSkill.getBasePow() * forward * slideBack * Time.deltaTime, 0, 0);
                    slideBack -= Time.deltaTime * 10;
                }
            }
        }
        // Reset everything once the attack is done
        else
        {
            this.curSkill.resetAnims();
            this.curSkill = null;

            if (player.transform.localPosition.y > minHeight)
            {
                player.GetComponent <SpriteRenderer>().sprite = chooseAnim(forward, this.inAir, this.inAirB);
                this.curState = fighterState.AERIAL;
            }
            else
            {
                this.curState = fighterState.GROUNDED;
            }
        }
    }
    private void AttackSel(GameObject player, float minHeight, GameObject mySound)
    {
        // Determine aerial attack
        if (player.transform.localPosition.y > minHeight)
        {
            if (onPress[(int)key.B1])
            {
                curSkill = this.jumpingSkill[0];
            }
            else if (onPress[(int)key.B2])
            {
                curSkill = this.jumpingSkill[1];
            }
            else
            {
                curSkill = this.jumpingSkill[2];
            }
        }
        else if (this.isCrouch)
        {
            if (onPress[(int)key.B1])
            {
                curSkill = this.crouchingSkill[0];
            }
            else if (onPress[(int)key.B2])
            {
                curSkill = this.crouchingSkill[1];
            }
            else
            {
                curSkill = this.crouchingSkill[2];
            }
        }
        // Go through the entire skillList and check for combination
        else
        {
            // Check the three most recent input
            bool      skillDetected = false;
            KeyCode[] inputChain    = { KeyCode.None, KeyCode.None, KeyCode.None };
            readBuffer(inputChain, 15);
            // Flip order of inputs
            inputChain[2] = inputChain[0];
            inputChain[0] = inputChain[1];
            inputChain[1] = inputChain[2];

            for (int i = 0; i < this.skillList.Count && i < (this.curLevel - 5) / 10; i++)
            {
                bool      correctInput = true;
                KeyCode[] input        = (KeyCode[])this.skillList[i].getInput().Clone();

                // Swap left and right keys if the player is facing the other way
                if (player.transform.localScale.x < 0)
                {
                    for (int j = 0; j < input.Length; j++)
                    {
                        if (input[j] == DataManager.savedOptions.controls[(int)key.LEFT])
                        {
                            input[j] = DataManager.savedOptions.controls[(int)key.RIGHT];
                        }
                        else if (input[j] == DataManager.savedOptions.controls[(int)key.RIGHT])
                        {
                            input[j] = DataManager.savedOptions.controls[(int)key.LEFT];
                        }
                    }
                }

                if (input[input.Length - 1] == DataManager.savedOptions.controls[(int)key.B1])
                {
                    correctInput = onPress[(int)key.B1];
                }
                else if (input[input.Length - 1] == DataManager.savedOptions.controls[(int)key.B2])
                {
                    correctInput = onPress[(int)key.B2];
                }
                else if (input[input.Length - 1] == DataManager.savedOptions.controls[(int)key.B3])
                {
                    correctInput = onPress[(int)key.B3];
                }
                for (int j = 0; j < inputChain.Length - 1 && correctInput; j++)
                {
                    if (j >= input.Length || input[j] != inputChain[j])
                    {
                        correctInput = false;
                        break;
                    }
                }

                if (correctInput)
                {
                    this.curSkill = this.skillList[i];
                    skillDetected = true;
                    break;
                }
            }

            if (!skillDetected)
            {
                if (onPress[(int)key.B1])
                {
                    curSkill = this.normalSkill[0];
                }
                else if (onPress[(int)key.B2])
                {
                    curSkill = this.normalSkill[1];
                }
                else
                {
                    curSkill = this.normalSkill[2];
                }
            }
        }

        // Play skill sound effect
        if (curSkill != null)
        {
            mySound.GetComponent <AudioSource>().clip = curSkill.getSFX();
            mySound.GetComponent <AudioSource>().Play();
        }

        this.curState = fighterState.ATTACK;
    }
 // Add a fighter skill to the character's skill list
 public void addSkill(FighterSkill s)
 {
     this.skillList.Add(s);
     return;
 }
Exemplo n.º 10
0
 public void Damage(FighterSkill _change, int _weightFrame)
 {
     fighter.SetDamage(new FighterSkill.CustomHitBox(), null);
     fighter.SetSkill(_change, _weightFrame);
 }
Exemplo n.º 11
0
 //スキル入れ替え
 public void ChangeSkill(FighterSkill _change, int _weightFrame)
 {
     fighter.SetSkill(_change, _weightFrame);
 }
    private Ally makeAlly(jankFile input, character duck)
    {
        List <string>          sheetP        = new List <string>();
        List <Sprite[]>        sheets        = new List <Sprite[]>();
        List <SpriteAnimation> RPGanims      = new List <SpriteAnimation>();
        List <Skill>           skillList     = new List <Skill>();
        List <FighterSkill>    fighterSkills = new List <FighterSkill>();

        bool hasBack;

        int[] battlestats = new int[7];
        // Determine number of spritesheets
        string s = input.ReadLine();

        string[] split = s.Split(' ');
        int      paths = 0;

        int.TryParse(split[split.Length - 1], out paths);
        // Read paths for spritesheets
        for (int i = 0; i < paths; i++)
        {
            string   sheetPath = input.ReadLine();
            Sprite[] sheet     = Resources.LoadAll <Sprite>(@sheetPath);
            sheets.Add(sheet);
            sheetP.Add(sheetPath);
        }
        input.ReadLine();

        // Check if the character as a back set of animations
        s     = input.ReadLine();
        split = s.Split(' ');
        bool.TryParse(split[split.Length - 1], out hasBack);

        // Read in stats of character
        s     = input.ReadLine();
        split = s.Split(' ');
        for (int i = 1; i < split.Length; i++)
        {
            int.TryParse(split[i], out battlestats[i - 1]);
        }
        input.ReadLine();

        // Read in RPG animations
        for (int i = 0; i < 7; i++)
        {
            input.ReadLine();
            float fps;
            int   spriteAmt;

            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out fps);
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out spriteAmt);

            Sprite[] anim  = new Sprite[spriteAmt];
            string[] pathS = new string[spriteAmt];
            string[] nameS = new string[spriteAmt];
            for (int j = 0; j < spriteAmt; j++)
            {
                int sheetNum;
                s     = input.ReadLine();
                split = s.Split('-');
                int.TryParse(split[0], out sheetNum);
                pathS[j] = sheetP[sheetNum];
                nameS[j] = split[split.Length - 1];

                anim[j] = getSprite(sheets[sheetNum], split[split.Length - 1]);
            }

            SpriteAnimation entry = new SpriteAnimation(anim, new int[0], fps, true);
            entry.saveSprites(pathS, nameS);
            RPGanims.Add(entry);
            input.ReadLine();
        }

        input.ReadLine();
        int skillAmt;

        s     = input.ReadLine();
        split = s.Split(' ');
        int.TryParse(split[split.Length - 1], out skillAmt);
        input.ReadLine();

        // Read in RPG skills
        for (int i = 0; i < skillAmt; i++)
        {
            skillType       skill;
            string          atkName, des;
            element         atkEle;
            int             basePower, mpCost, range, effectChance;
            bool            isMagical, animLoop;
            float           start, end, fps;
            SpriteAnimation anim;

            battleType support    = battleType.NULL;
            status     statusMod  = status.NULL;
            int        scalar     = 0;
            stat       statBoost  = stat.NULL;
            bool       selfTarget = false;
            bool       targetAlly = false;
            string     skillSFX;

            atkName = input.ReadLine();
            des     = input.ReadLine();

            s     = input.ReadLine();
            split = s.Split(' ');
            if (split[split.Length - 1].CompareTo("Offensive") == 0)
            {
                skill = skillType.OFFENSIVE;

                // Attack element
                s      = input.ReadLine();
                split  = s.Split(' ');
                atkEle = decideEle(split[split.Length - 1]);

                // base power
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out basePower);

                // mp cost
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out mpCost);

                // is magical
                s     = input.ReadLine();
                split = s.Split(' ');
                bool.TryParse(split[split.Length - 1], out isMagical);

                // effect chance
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out effectChance);
                if (effectChance > 0)
                {
                    // status variables
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    support   = decideSupport(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    statusMod = decideStatus(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    statBoost = decideStat(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out scalar);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out selfTarget);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out targetAlly);
                }

                // range
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out range);

                // positions
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out start);
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out end);

                // FPS
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out fps);

                // Sprite animation
                int spriteAmt;
                s     = input.ReadLine();
                split = s.Split(' ');
                if (split.Length > 2)
                {
                    int.TryParse(split[split.Length - 2], out spriteAmt);
                    animLoop = true;
                }
                else
                {
                    int.TryParse(split[split.Length - 1], out spriteAmt);
                    animLoop = false;
                }
                Sprite[] sprites = new Sprite[spriteAmt];
                string[] pathS   = new string[spriteAmt];
                string[] nameS   = new string[spriteAmt];
                for (int j = 0; j < spriteAmt; j++)
                {
                    int sheetNum;
                    s     = input.ReadLine();
                    split = s.Split('-');
                    int.TryParse(split[0], out sheetNum);

                    pathS[j] = sheetP[sheetNum];
                    nameS[j] = split[split.Length - 1];

                    sprites[j] = getSprite(sheets[sheetNum], split[split.Length - 1]);
                }
                anim = new SpriteAnimation(sprites, new int[0], fps, animLoop);
                anim.saveSprites(pathS, nameS);
            }
            else
            {
                skill        = skillType.SUPPORT;
                basePower    = 0;
                effectChance = 0;
                isMagical    = true;

                // Attack element
                s      = input.ReadLine();
                split  = s.Split(' ');
                atkEle = decideEle(split[split.Length - 1]);

                // mp cost
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out mpCost);

                // range
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out range);

                // positions
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out start);
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out end);

                // status variables
                s         = input.ReadLine();
                split     = s.Split(' ');
                support   = decideSupport(split[split.Length - 1]);
                s         = input.ReadLine();
                split     = s.Split(' ');
                statusMod = decideStatus(split[split.Length - 1]);
                s         = input.ReadLine();
                split     = s.Split(' ');
                statBoost = decideStat(split[split.Length - 1]);
                s         = input.ReadLine();
                split     = s.Split(' ');
                int.TryParse(split[split.Length - 1], out scalar);
                s     = input.ReadLine();
                split = s.Split(' ');
                bool.TryParse(split[split.Length - 1], out selfTarget);
                s     = input.ReadLine();
                split = s.Split(' ');
                bool.TryParse(split[split.Length - 1], out targetAlly);

                // FPS
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out fps);

                // Sprite animation
                int spriteAmt;
                s     = input.ReadLine();
                split = s.Split(' ');
                if (split.Length > 2)
                {
                    int.TryParse(split[split.Length - 2], out spriteAmt);
                    animLoop = true;
                }
                else
                {
                    int.TryParse(split[split.Length - 1], out spriteAmt);
                    animLoop = false;
                }
                Sprite[] sprites = new Sprite[spriteAmt];
                string[] pathS   = new string[spriteAmt];
                string[] nameS   = new string[spriteAmt];
                for (int j = 0; j < spriteAmt; j++)
                {
                    int sheetNum;
                    s     = input.ReadLine();
                    split = s.Split('-');
                    int.TryParse(split[0], out sheetNum);

                    pathS[j] = sheetP[sheetNum];
                    nameS[j] = split[split.Length - 1];

                    sprites[j] = getSprite(sheets[sheetNum], split[split.Length - 1]);
                }
                anim = new SpriteAnimation(sprites, new int[0], fps, animLoop);
                anim.saveSprites(pathS, nameS);
            }
            // Get SFX path
            input.ReadLine();
            skillSFX = input.ReadLine();
            input.ReadLine();

            Skill entry = new Skill(skill, atkName, des, atkEle, mpCost, range, start, end, anim, skillSFX);
            entry.setAttack(basePower, isMagical, effectChance);
            if (skill == skillType.SUPPORT || effectChance > 0)
            {
                entry.setSupport(support, statusMod, statBoost, scalar, selfTarget, targetAlly);
            }
            skillList.Add(entry);
        }

        input.ReadLine();
        s     = input.ReadLine();
        split = s.Split(' ');
        int.TryParse(split[split.Length - 1], out skillAmt);
        input.ReadLine();

        // Read fighter skills
        for (int i = 0; i < skillAmt; i++)
        {
            bool            hasProj;
            string          projPath = "";
            string          atkName = input.ReadLine();
            int             hitstun, basePower, faf, fps, rehit;
            float           xPow, yPow, xShift, yShift;
            bool            jc, sc, animLoop;
            SpriteAnimation anim, animB;
            string          skillSFX;

            // Projectile
            s     = input.ReadLine();
            split = s.Split(' ');
            bool.TryParse(split[split.Length - 1], out hasProj);
            if (hasProj)
            {
                projPath = input.ReadLine();
            }

            // Command Input
            int inputAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out inputAmt);
            KeyCode[] command = new KeyCode[inputAmt];
            s     = input.ReadLine();
            split = s.Split(' ');
            for (int j = 0; j < inputAmt; j++)
            {
                command[j] = decideKeyCode(split[j]);
            }

            // Hitstun
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out hitstun);

            // Base Power
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out basePower);

            // First Active Frame
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out faf);

            // Rehit
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out rehit);

            // Power and shift
            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out xPow);
            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out yPow);
            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out xShift);
            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out yShift);

            // Cancels
            s     = input.ReadLine();
            split = s.Split(' ');
            bool.TryParse(split[split.Length - 1], out jc);
            s     = input.ReadLine();
            split = s.Split(' ');
            bool.TryParse(split[split.Length - 1], out sc);

            // Hitbox Frames
            int frameAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out frameAmt);
            int[] hitFrames = new int[frameAmt];
            s = input.ReadLine();
            if (frameAmt == 1)
            {
                int.TryParse(s, out hitFrames[0]);
            }
            else if (frameAmt > 1)
            {
                split = s.Split('-');
                int min, max;
                int.TryParse(split[0], out min);
                int.TryParse(split[split.Length - 1], out max);
                for (int j = 0; j < hitFrames.Length; j++)
                {
                    hitFrames[j] = j + min;
                }
            }

            // Sprites
            int spriteAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            if (split.Length > 2)
            {
                int.TryParse(split[split.Length - 2], out spriteAmt);
                animLoop = true;
            }
            else
            {
                int.TryParse(split[split.Length - 1], out spriteAmt);
                animLoop = false;
            }
            Sprite[] sprites = new Sprite[spriteAmt];
            string[] pathS   = new string[spriteAmt];
            string[] nameS   = new string[spriteAmt];
            for (int j = 0; j < spriteAmt; j++)
            {
                int sheetNum;
                s     = input.ReadLine();
                split = s.Split('-');
                int.TryParse(split[0], out sheetNum);

                pathS[j] = sheetP[sheetNum];
                nameS[j] = split[split.Length - 1];

                sprites[j] = getSprite(sheets[sheetNum], split[split.Length - 1]);
            }

            // Sprites back
            Sprite[] spritesB = new Sprite[spriteAmt];
            string[] pathSB   = new string[spriteAmt];
            string[] nameSB   = new string[spriteAmt];
            if (hasBack)
            {
                for (int j = 0; j < spriteAmt; j++)
                {
                    int sheetNum;
                    s     = input.ReadLine();
                    split = s.Split('-');
                    int.TryParse(split[0], out sheetNum);

                    pathSB[j] = sheetP[sheetNum];
                    nameSB[j] = split[split.Length - 1];

                    spritesB[j] = getSprite(sheets[sheetNum], split[split.Length - 1]);
                }
            }

            // Hitboxes
            int hitboxAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out hitboxAmt);
            HitBox[] boxes = new HitBox[hitboxAmt];
            for (int j = 0; j < hitboxAmt; j++)
            {
                s     = input.ReadLine();
                split = s.Split(' ');
                float x, y, xs, ys;
                float.TryParse(split[0], out x);
                float.TryParse(split[1], out y);
                float.TryParse(split[2], out xs);
                float.TryParse(split[3], out ys);

                boxes[j] = new HitBox((x / 2) + xs, (y / 2) + ys, (-x / 2) + xs, (-y / 2) + ys);
            }

            // FPS
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out fps);
            anim = new SpriteAnimation(sprites, hitFrames, fps, animLoop);
            anim.saveSprites(pathS, nameS);
            animB = new SpriteAnimation(spritesB, hitFrames, fps, animLoop);
            animB.saveSprites(pathSB, nameSB);

            // Get SFX path
            input.ReadLine();
            skillSFX = input.ReadLine();

            FighterSkill entry = new FighterSkill(atkName, hitstun, basePower, faf, xPow, yPow, xShift, yShift, jc, sc, command, boxes, rehit, hitFrames, skillSFX);
            entry.setAnimation(anim);
            if (hasBack)
            {
                entry.setAnimationBack(animB);
            }
            if (hasProj)
            {
                entry.setProjectile(projPath, false);
            }
            fighterSkills.Add(entry);

            input.ReadLine();
        }
        float walkSpd, dashSpd, glideSpd, gravity;
        int   maxJumps;

        // Read in fighter variables
        s     = input.ReadLine();
        split = s.Split(' ');
        float.TryParse(split[split.Length - 1], out walkSpd);
        s     = input.ReadLine();
        split = s.Split(' ');
        float.TryParse(split[split.Length - 1], out dashSpd);
        s     = input.ReadLine();
        split = s.Split(' ');
        float.TryParse(split[split.Length - 1], out glideSpd);
        s     = input.ReadLine();
        split = s.Split(' ');
        float.TryParse(split[split.Length - 1], out gravity);
        s     = input.ReadLine();
        split = s.Split(' ');
        int.TryParse(split[split.Length - 1], out maxJumps);
        input.ReadLine();

        List <SpriteAnimation> fightAnims  = new List <SpriteAnimation>();
        List <SpriteAnimation> fightAnimsB = new List <SpriteAnimation>();

        for (int i = 0; i < 9; i++)
        {
            input.ReadLine();
            float fps;
            int   spriteCount;
            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out fps);
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out spriteCount);

            Sprite[] sprites = new Sprite[spriteCount];
            string[] pathS   = new string[spriteCount];
            string[] nameS   = new string[spriteCount];
            for (int j = 0; j < spriteCount; j++)
            {
                int sheetNum;
                s     = input.ReadLine();
                split = s.Split('-');
                int.TryParse(split[0], out sheetNum);
                pathS[j]   = sheetP[sheetNum];
                nameS[j]   = split[split.Length - 1];
                sprites[j] = getSprite(sheets[sheetNum], split[split.Length - 1]);
            }
            SpriteAnimation entry = new SpriteAnimation(sprites, new int[0], fps, true);
            entry.saveSprites(pathS, nameS);
            fightAnims.Add(entry);

            if (hasBack)
            {
                pathS = new string[spriteCount];
                nameS = new string[spriteCount];
                for (int j = 0; j < spriteCount; j++)
                {
                    int sheetNum;
                    s     = input.ReadLine();
                    split = s.Split('-');
                    int.TryParse(split[0], out sheetNum);
                    pathS[j]   = sheetP[sheetNum];
                    nameS[j]   = split[split.Length - 1];
                    sprites[j] = getSprite(sheets[sheetNum], split[split.Length - 1]);
                }
                entry = new SpriteAnimation(sprites, new int[0], fps, true);
                entry.saveSprites(pathS, nameS);
                fightAnimsB.Add(entry);
            }

            input.ReadLine();
        }

        // Read in icons
        input.ReadLine();
        Sprite[] icons = new Sprite[4];
        string[] pathF = new string[3];
        string[] nameF = new string[3];
        string   pathW = "", nameW = "";

        for (int i = 0; i < icons.Length; i++)
        {
            int sheetNum;
            s     = input.ReadLine();
            split = s.Split('-');
            int.TryParse(split[0], out sheetNum);
            if (i < 3)
            {
                pathF[i] = sheetP[sheetNum];
                nameF[i] = split[split.Length - 1];
            }
            else
            {
                pathW = sheetP[sheetNum];
                nameW = split[split.Length - 1];
            }
            icons[i] = getSprite(sheets[sheetNum], split[split.Length - 1]);
        }

        Fighter streetDuck = new Fighter(walkSpd, dashSpd, glideSpd, gravity, maxJumps);

        streetDuck.setAnimations(fightAnims[0], fightAnims[1], fightAnims[2], fightAnims[3], fightAnims[4], fightAnims[5], fightAnims[6], fightAnims[7], fightAnims[8]);
        if (hasBack)
        {
            streetDuck.setBackAnimations(fightAnimsB[0], fightAnimsB[1], fightAnimsB[2], fightAnimsB[3], fightAnimsB[4], fightAnimsB[5], fightAnimsB[6], fightAnimsB[7], fightAnimsB[8]);
        }

        streetDuck.setNormals(fighterSkills[0], fighterSkills[1], fighterSkills[2]);
        streetDuck.setCrouches(fighterSkills[3], fighterSkills[4], fighterSkills[5]);
        streetDuck.setJumps(fighterSkills[6], fighterSkills[7], fighterSkills[8]);
        for (int i = 9; i < fighterSkills.Count; i++)
        {
            streetDuck.addSkill(fighterSkills[i]);
        }

        Ally ducky = new Ally(duck, streetDuck, battlestats);

        for (int j = 0; j < skillList.Count; j++)
        {
            ducky.addSkill(skillList[j]);
        }
        ducky.setAnimations(RPGanims[0], RPGanims[1], RPGanims[2], RPGanims[3], RPGanims[4], RPGanims[5], RPGanims[6]);
        ducky.setIcons(icons[0], icons[1], icons[2], icons[3]);
        ducky.saveIcons(pathF, nameF, pathW, nameW);
        return(ducky);
    }
Exemplo n.º 13
0
 private void SSet(string _s, ref FighterSkill _fs)
 {
     _fs = (FighterSkill)EditorGUILayout.ObjectField(_s, _fs, typeof(FighterSkill), false);
 }
Exemplo n.º 14
0
 //技の設定
 public void SetSkill(FighterSkill _skill, int _weightFrame)
 {
     nextAnimation     = _skill;
     changeWeightFrame = _weightFrame;
 }