Exemple #1
0
    void checkPoint(float pX, float pY)
    {
        int XX = pX < 0 ? -1 : (int)(pX / TheMap.cellSize);
        int YY = pY < 0 ? -1 : (int)(pY / TheMap.cellSize);

        // сначала проверяем не ударилось ли в препятствие
        hitType ht = hitType.NONE;

        if (XX < 0 || XX > 7 || YY < 0 || YY > 5)
        {
            ht = hitType.FOREST;
        }
        else
        {
            ht = TheMap.instance.rows [YY].columns[XX].hit(playerBy);
        }

        if (playerBy)
        {
            switch (ht)
            {
            case hitType.FOREST:
                Sounds.Play(SoundType.DIE);
                Destroy(gameObject);
                break;

            case hitType.NONE:
                break;

            case hitType.PIRATE:
                TheMap.instance.Score += 1;
                Destroy(gameObject);
                break;
            }
        }
        else
        {
            if (flying)
            {
                switch (ht)
                {
                case hitType.FOREST:
                    Sounds.Play(SoundType.DIE);
                    flying = false;
                    break;

                case hitType.NONE:
                    break;

                case hitType.PIRATE:
                    break;
                }

                if (Intersection(Player.instance.Position, Position))
                {
                    TheMap.PlayerDie();
                    Sounds.Play(SoundType.DIE);
                    Destroy(gameObject);
                }
            }
            else
            {
                if (Intersection(Player.instance.Position, Position))
                {
                    Player.instance.HaveSword = true;
                    Sounds.Play(SoundType.SCORE);
                    playerBy = true;
                    if (myOwner != null)
                    {
                        myOwner.nextState();
                    }
                    Destroy(gameObject);
                }
            }
        }
    }
Exemple #2
0
        public moveData(sourceMove aMoveData)
        {
            name = aMoveData.name;


            switch (aMoveData.height)
            {
            case "low":
                moveHeight = hitHeight.low;
                break;

            case "mid":
                moveHeight = hitHeight.mid;
                break;

            case "high":
                moveHeight = hitHeight.high;
                break;

            default:
                moveHeight = hitHeight.invalid;
                break;
            }

            switch (aMoveData.type)
            {
            case "thrust":
                moveType = hitType.thrust;
                break;

            case "vertical":
                moveType = hitType.vertical;
                break;

            case "horizontal":
                moveType = hitType.horizontal;
                break;

            default:
                moveType = hitType.invalid;
                break;
            }

            switch (aMoveData.style)
            {
            case "forsaken":
                style = moveStyle.forsaken;
                break;

            case "kahlt":
                style = moveStyle.kahlt;
                break;

            case "windfall":
                style = moveStyle.windfall;
                break;

            case "stagger":
                style = moveStyle.stagger;
                break;

            case "faejin":
                style = moveStyle.faejin;
                break;

            default:
                style = moveStyle.invalid;
                break;
            }

            startBarehands = new moveQuadrants(aMoveData.stance.barehands);
            startSword     = new moveQuadrants(aMoveData.stance.sword);

            moveQuadrants endBarehands = new moveQuadrants(aMoveData.stance.barehands, true);
            moveQuadrants endSword     = new moveQuadrants(aMoveData.stance.sword, true);

            switchSide = getChangeSide(startBarehands, endBarehands) || getChangeSide(startSword, endSword);

            hitDiffSide         = aMoveData.hits == "diff";
            frameStartup        = aMoveData.frames.startup;
            switchFront         = getChangeFront(aMoveData.stance.barehands) || getChangeFront(aMoveData.stance.sword);
            frameAdvantageGuard = aMoveData.frames.advantage.guard;
            frameAdvantageHit   = aMoveData.frames.advantage.hit;

            isStop      = aMoveData.modifiers.Contains("stop");
            isBreak     = aMoveData.modifiers.Contains("break");
            isDuck      = aMoveData.modifiers.Contains("duck");
            isJump      = aMoveData.modifiers.Contains("jump");
            isStrafe    = aMoveData.modifiers.Contains("strafe");
            isParry     = aMoveData.modifiers.Contains("parry");
            isCharge    = aMoveData.modifiers.Contains("charge");
            isDoubleHit = aMoveData.modifiers.Contains("double");
        }