Пример #1
0
    public void onObstacle(Player player)
    {
        Debug.Log("Walk on Obstacle");

        //// 播放机关开启音效
        if (GameManagerGlobalData.isFirstMeetObstacle)
        {
            // 第一次进行格挡
            PlayerAudioCtrl.getInstance().play(PlayerAudioData.SWITCH_OBSTACLE_CLIP, () => {
                PlayerAudioCtrl.getInstance().play(PlayerAudioData.HAVE_TO_PARRY_CLIP, () => {
                    player.setState(PlayerState.Parry);
                    ArrowDir _arrowDir = Parry.getInstance().startParry();
                    ObstacleAudioCtrl.getInstance().playAudio(_arrowDir);
                });
            });
        }
        else if (GameManagerGlobalData.isSecondMeetObstacle)
        {
            // 第二次进行格挡
            PlayerAudioCtrl.getInstance().play(PlayerAudioData.SWITCH_OBSTACLE_CLIP, () => {
                player.setState(PlayerState.Parry);
                ArrowDir _arrowDir = Parry.getInstance().startParry();
                ObstacleAudioCtrl.getInstance().playAudio(_arrowDir);
            });
        }
        else
        {
            PlayerAudioCtrl.getInstance().play(PlayerAudioData.SWITCH_OBSTACLE_CLIP, () => {
                player.setState(PlayerState.Parry);
                ArrowDir _arrowDir = Parry.getInstance().startParry();
                ObstacleAudioCtrl.getInstance().playAudio(_arrowDir);
            });
        }
        player.setState(PlayerState.Idle);
    }
Пример #2
0
    private String selectedDir(ArrowDir dir)
    {
        String name = "";

        switch (dir)
        {
        // case ArrowDir.BACK: name = "back"; break;
        case ArrowDir.FRONT: name = "front"; break;

        case ArrowDir.LEFT: name = "left"; break;

        case ArrowDir.RIGHT: name = "right"; break;
            // case ArrowDir.CENTER: name = "center"; break;
        }

        return(name);
    }
Пример #3
0
    public ArrowDir startParry()
    {
        _arrowDir = getArrowDir();

        // slider state
        _sliderBar.value       = 1;
        _curTime               = 0;
        _sliderFillImage.color = Color.white;

        if (!GameManagerGlobalData.isFirstMeetObstacle && !GameManagerGlobalData.isSecondMeetObstacle)
        {
            _isParry = true;
        }

        // 设置格挡手势功能调用
        setGestureToParry();

        return(_arrowDir);
    }
Пример #4
0
        private string GetTurnAnim(ArrowDir from, Vector2 dirTo)
        {
            ArrowDir to = ArrowDir.Down;

            if (dirTo == -Vector2.UnitX)
            {
                to = ArrowDir.Left;
            }
            if (dirTo == Vector2.UnitX)
            {
                to = ArrowDir.Right;
            }
            if (dirTo == -Vector2.UnitY)
            {
                to = ArrowDir.Up;
            }

            arrowDir = to;
            return(GetAnimName(from, to));
        }
Пример #5
0
 public BVector(ArrowDir arrowDir)
 {
     if (arrowDir.Equals(ArrowDir.SW))
     {
         x = -1f;
         y = 1f;
     }
     if (arrowDir.Equals(ArrowDir.SE))
     {
         x = 1f;
         y = 1f;
     }
     if (arrowDir.Equals(ArrowDir.NW))
     {
         x = -1f;
         y = -1f;
     }
     if (arrowDir.Equals(ArrowDir.NE))
     {
         x = 1f;
         y = -1f;
     }
 }
Пример #6
0
        public void Attach(Node node)
        {
            IsAttachedToTrack = true;
            CurrentNode       = node;

            if (node.NodeUp != null)
            {
                arrowDir = ArrowDir.Up;
            }
            else if (node.NodeRight != null)
            {
                arrowDir = ArrowDir.Right;
            }
            else if (node.NodeLeft != null)
            {
                arrowDir = ArrowDir.Left;
            }
            else if (node.NodeDown != null)
            {
                arrowDir = ArrowDir.Down;
            }

            arrowSprite.Play("Idle" + Enum.GetName(typeof(ArrowDir), arrowDir), true);
        }
Пример #7
0
    public void playAudio(ArrowDir dir)
    {
        String name = selectedDir(dir);

        System.String clipName = "";
        AudioPlayObj  obj      = null;

        if (dir == ArrowDir.FRONT)
        {
            clipName = "frontSword";
            obj      = new AudioPlayObj(selectClip(clipName), this, selectSource(name));
        }
        else
        {
            clipName = "bow";
            obj      = new AudioPlayObj(selectClip(clipName), this, selectSource(name));
        }

        AudioPlayCtrl.getInstance().addEffectObj(obj);

        // 教学音频设计需要
        if (GameManagerGlobalData.isFirstMeetObstacle)
        {
            PlayerAudioCtrl.getInstance().play(PlayerAudioData.PARRY_TO_FRONT_TIPS, () => {
                Parry.getInstance().setParry(true);
                GameManagerGlobalData.isFirstMeetObstacle = false;
            });
        }
        else if (GameManagerGlobalData.isSecondMeetObstacle)
        {
            PlayerAudioCtrl.getInstance().play(PlayerAudioData.PARRY_TO_LEFT_TIPS, () => {
                Parry.getInstance().setParry(true);
                GameManagerGlobalData.isSecondMeetObstacle = false;
            });
        }
    }
Пример #8
0
 public ArrowState(PictureBox TargetPicture, ArrowDir Direction)
 {
     this.TargetPicture = TargetPicture;
     this.Direction     = Direction;
 }
Пример #9
0
 private bool checkParry(ArrowDir _dir)
 {
     PlayerAudioCtrl.getInstance().play(PlayerAudioData.SWING_CLIP);
     _restTime = parryElapseTime;
     return(inTimeRange() && _dir == _arrowDir);
 }
Пример #10
0
        public StationBlock(EntityData data, Vector2 offset)
            : base(data.Position + offset, data.Width, data.Height, safe: true)
        {
            Depth = Depths.FGTerrain + 1;
            Add(new LightOcclude());

            this.offset   = new Vector2(Width, Height) / 2f;
            allowWavedash = data.Bool("allowWavedash", false);
            speedFactor   = Calc.Clamp(data.Float("speedFactor", 1f), .1f, 2f);

            buttonColor        = data.HexColor("wavedashButtonColor", deactivatedButton);
            buttonPressedColor = data.HexColor("wavedashButtonPressedColor", activatedButton);

            dashCornerCorrection = data.Bool("dashCornerCorrection", false);

            int    minSize = (int)Calc.Min(Width, Height);
            string size;

            if (minSize <= 16)
            {
                size = "small";
            }
            else if (minSize <= 24)
            {
                size = "medium";
            }
            else
            {
                size = "big";
            }

            string block = "objects/CommunalHelper/stationBlock/blocks/";
            string sprite;

            ReverseControls = data.Attr("behavior", "Pulling") == "Pushing";
            Theme           = data.Enum <Themes>("theme");

            string customBlockPath = data.Attr("customBlockPath").Trim();
            string customArrowPath = data.Attr("customArrowPath").Trim();
            string customTrackPath = data.Attr("customTrackPath").Trim();

            switch (Theme)
            {
            default:
            case Themes.Normal:
                if (ReverseControls)
                {
                    block += "alt_block";
                    sprite = size + "AltStationBlockArrow";
                }
                else
                {
                    block += "block";
                    sprite = size + "StationBlockArrow";
                }
                break;

            case Themes.Moon:
                Theme = Themes.Moon;
                if (ReverseControls)
                {
                    block += "alt_moon_block";
                    sprite = size + "AltMoonStationBlockArrow";
                }
                else
                {
                    block += "moon_block";
                    sprite = size + "MoonStationBlockArrow";
                }
                break;
            }

            if (allowWavedash)
            {
                block += "_button";
            }

            MTexture customBlock = null;
            Sprite   customArrow = null;

            p_sparks = Theme == Themes.Normal ? ZipMover.P_Sparks : (ReverseControls ? P_PurpleSparks : P_BlueSparks);

            if (customBlockPath != "")
            {
                customBlock = GFX.Game["objects/" + customBlockPath];
                p_sparks    = ZipMover.P_Sparks;
            }
            if (customArrowPath != "")
            {
                customArrow = LookForCustomSprite("objects/" + customArrowPath, size);
            }
            if (customTrackPath != "")
            {
                CustomNode   = GFX.Game["objects/" + customTrackPath + "/node"];
                CustomTrackV = GFX.Game["objects/" + customTrackPath + "/trackv"];
                CustomTrackH = GFX.Game["objects/" + customTrackPath + "/trackh"];
            }

            tileSlices = new MTexture[3, 3];
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    tileSlices[i, j] = (customBlock ?? GFX.Game[block]).GetSubtexture(i * 8, j * 8, 8, 8);
                }
            }

            /*
             * the first dimension here represents the part of the button (left, middle, right),
             * the second (0 or 1) will represent whether we want to draw the outline or the front.
             */
            buttonTiles = new MTexture[3, 2];
            for (int i = 0; i < 3; i++)
            {
                buttonTiles[i, 0] = GFX.Game["objects/CommunalHelper/stationBlock/button_outline"].GetSubtexture(i * 8, 0, 8, 8);
                buttonTiles[i, 1] = GFX.Game["objects/CommunalHelper/stationBlock/button"].GetSubtexture(i * 8, 0, 8, 8);
            }

            GenerateTiles();

            arrowSprite          = customArrow ?? CommunalHelperModule.SpriteBank.Create(sprite);
            arrowDir             = ArrowDir.Up;
            arrowSprite.Position = new Vector2(Width / 2, Height / 2);
            Add(arrowSprite);

            SurfaceSoundIndex = SurfaceIndex.Girder;
            Add(new Coroutine(Sequence()));
            Add(Sfx       = new SoundSource());
            Sfx.Position  = this.offset;
            OnDashCollide = OnDashed;
        }
Пример #11
0
 private string GetAnimName(ArrowDir from, ArrowDir to)
 {
     return(Enum.GetName(typeof(ArrowDir), from) + "To" + Enum.GetName(typeof(ArrowDir), to));
 }