示例#1
0
    private void HandleGridMovement()
    {
        gridMoveTimer += Time.deltaTime;

        if (gridMoveTimer >= gridMoveTimerMax)
        {
            gridMoveTimer -= gridMoveTimerMax;

            snakeMovePositionList.Insert(0, gridPosition);

            gridPosition += gridMoveDirection;

            // bool snakeAteFood = levelGrid.TrySnakeEatFood (gridPosition);
            // if (snakeAteFood) {
            //     snakeBodySize++;
            //   CreateSnakeBody();

            // }

            if (snakeMovePositionList.Count >= snakeBodySize + 1)
            {
                snakeMovePositionList.RemoveAt(snakeMovePositionList.Count - 1);
            }

            for (int i = 0; i < snakeMovePositionList.Count; i++)
            {
                Vector2Int   snakeMovePosition = snakeMovePositionList[i];
                World_Sprite worldSprite       = World_Sprite.Create(new Vector3(snakeMovePosition.x, snakeMovePosition.y), Vector3.one * .5f, Color.white);
                FunctionTimer.Create(worldSprite.DestroySelf, gridMoveTimerMax);
            }
            transform.position    = new Vector3(gridPosition.x, gridPosition.y);
            transform.eulerAngles = new Vector3(0, 0, GetAngleFromVector(gridMoveDirection) - 90);
        }
    }
示例#2
0
文件: CMDebug.cs 项目: RoscaS/YAARTS
 // Creates a Button in the World
 public static World_Sprite Button(Transform parent, Vector3 localPosition, string text,
                                   System.Action ClickFunc, int fontSize = 30,
                                   float paddingX = 5, float paddingY = 5)
 {
     return(World_Sprite.CreateDebugButton(
                parent,
                localPosition,
                text,
                ClickFunc,
                fontSize,
                paddingX,
                paddingY
                ));
 }
    private void PlayerAimWeapon_OnShoot(object sender, PlayerAimWeapon.OnShootEventArgs e)
    {
        //UtilsClass.ShakeCamera(.6f, .05f);
        WeaponTracer.Create(e.gunEndPointPosition, e.shootPosition);
        //Shoot_Flash.AddFlash(e.gunEndPointPosition);

        World_Sprite world_Sprite = World_Sprite.Create(e.gunEndPointPosition, GameAssets.i.s_ShootFlash);

        FunctionTimer.Create(world_Sprite.DestroySelf, .1f);

        Vector3 shootDir = (e.shootPosition - e.gunEndPointPosition).normalized;

        shootDir = UtilsClass.ApplyRotationToVector(shootDir, 90f);
        //ShellParticleSystemHandler.Instance.SpawnShell(e.shellPosition, shootDir);
    }
示例#4
0
    private void HandleMovement()
    {
        gridMoveTimer += Time.deltaTime;
        if (spell == Spell.TP)
        {
            gridPosition += gridMoveDirection;
            spell         = Spell.Nothing;
        }

        if (gridMoveTimer > gridMoveTimerMax)
        {
            movePositionGridList.Insert(0, gridPosition);

            gridPosition  += gridMoveDirection;
            gridMoveTimer -= gridMoveTimerMax;

            for (int i = 0; i < movePositionGridList.Count; i++)
            {
                Vector2Int   movePosition = movePositionGridList[i];
                World_Sprite worldSprite  = World_Sprite.Create(new Vector3(movePosition.x, movePosition.y), Vector3.one * .5f, Color.white);
            }

            foreach (Vector2Int movePosition in movePositionGridList)
            {
                if (gridPosition == movePosition)
                {
                    CMDebug.TextPopup("DEAD!", transform.position);
                    state = State.Dead;
                }
            }
            transform.position = new Vector3(gridPosition.x, gridPosition.y);
            if (!levelGrid.validateGridPosition(gridPosition))
            {
                CMDebug.TextPopup("DEAD", transform.position);
                state = State.Dead;
            }
            Debug.Log("removal tp");
            transform.eulerAngles = new Vector3(0, 0, getAngleFromVector(gridMoveDirection) - 90);
        }
    }
示例#5
0
    public static void Play_LostToEvilMonster_2()
    {
        UIBlack.Show();
        OvermapHandler.StopOvermapRunning();

        List <World_Sprite> ropeWorldSpriteList = new List <World_Sprite>();

        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetPlayer().GetPosition(), Vector3.one * 1f, GameAssets.i.s_Rope, Color.white, 100));
        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Healer)).GetPosition(), Vector3.one * 1f, GameAssets.i.s_Rope, Color.white, 100));
        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Tank)).GetPosition(), Vector3.one * 1.2f, GameAssets.i.s_Rope, Color.white, 100));
        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Sleezer)).GetPosition(), Vector3.one * 0.7f, GameAssets.i.s_Rope, Color.white, 100));

        NPCOvermap randyOvermap = OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.Randy));

        randyOvermap.GetUnitAnimation().PlayAnimForced(UnitAnim.GetUnitAnim("dBareHands_IdleUp"), 1f, null);
        Vector3 randyStartingPosition = randyOvermap.GetPosition();

        randyOvermap.overrideOvermapRunning = true;

        Dialogue dialogue = Dialogue.GetInstance();

        dialogue.SetDialogueActions(new List <Action>()
        {
            () => {
                dialogue.Show();
                dialogue.ShowLeftCharacter(GameAssets.i.s_PlayerDialogueSprite, true);
                dialogue.ShowLeftCharacterName(GameData.GetCharacterName(Character.Type.Player));
                dialogue.HideLeftText();
                dialogue.ShowRightCharacter(GameAssets.i.s_RandyPortrait, false);
                dialogue.ShowRightCharacterName(GameData.GetCharacterName(Character.Type.Randy));
                dialogue.ShowRightText("Oh my, this is my lucky day");
            },
            () => {
                dialogue.ShowLeftActiveTalkerHideRight("Oh no, you again");
            },
            () => {
                dialogue.ShowRightActiveTalkerHideLeft("What's wrong, not happy to see me?");
            },
            () => { dialogue.ShowLeftActiveTalkerHideRight("It seems we miraculously lost again"); },
            () => { dialogue.ShowLeftText("It's very annoying to get the Evil Monster almost near death and suddenly he wins"); },
            () => { dialogue.ShowRightActiveTalkerHideLeft("Oh dear that is a real bother"); },
            () => { dialogue.ShowLeftActiveTalkerHideRight("Yes it is, are you going to let us go?"); },
            () => { dialogue.ShowRightActiveTalkerHideLeft("Huhuhu maybe"); },
            () => { dialogue.ShowRightText("My oh my, you are truly precious"); },
            () => { dialogue.ShowRightText("If you really want to defeat him you need the Sword of Thousand Truths"); },
            () => { dialogue.ShowRightText("And would you look at that, I have it right here!"); },
            () => { dialogue.ShowRightText("Have fun! Huhuhu!"); },
            () => {
                // Randy Disappears in Smoke
                // Drop Sword

                /*
                 * NPCOvermap npcOvermap = OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.Randy));
                 * Transform objectTractorTransform = UnityEngine.Object.Instantiate(GameAssets.i.pfObjectTractor, npcOvermap.GetPosition(), Quaternion.identity);
                 * objectTractorTransform.GetComponent<TractorBehaviour>().Setup(OvermapHandler.GetInstance().GetPlayer(), 20f, 8f, () => {
                 *  GameData.GetCharacter(Character.Type.Player).hasSwordThousandTruths = true;
                 *  OvermapHandler.GetInstance().GetPlayer().RefreshTexture();
                 * });
                 *
                 * npcOvermap.Hide();
                 * UIBlack.Hide();
                 * dialogue.Hide();
                 * FunctionTimer.Create(() => {
                 *  UIBlack.Show();
                 *  dialogue.Show();
                 *  dialogue.PlayNextAction();
                 * }, 1f);
                 */


                Transform objectTractorTransform        = UnityEngine.Object.Instantiate(GameAssets.i.pfObjectTractor, randyOvermap.GetPosition(), Quaternion.identity);
                objectTractorTransform.localEulerAngles = new Vector3(0, 0, -45);
                objectTractorTransform.GetComponent <TractorBehaviour>().Setup(OvermapHandler.GetInstance().GetPlayer(), 20f, 8f, () => {
                    GameData.GetCharacter(Character.Type.Player).hasSwordThousandTruths = true;
                    OvermapHandler.GetInstance().GetPlayer().RefreshTexture();
                    SoundManager.PlaySound(SoundManager.Sound.Coin);
                });

                // Randy Disappears in Smoke
                UIBlack.Hide();
                dialogue.Hide();

                // Untie Player
                randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetPlayer().GetPosition() + new Vector3(0, -5));
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[0].DestroySelf();
                }, 1f);

                // Untie Healer
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Healer)).GetPosition() + new Vector3(+5, 0));
                }, 1f);
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[1].DestroySelf();
                }, 2f);

                // Untie Tank
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Tank)).GetPosition() + new Vector3(-5, 0));
                }, 2f);
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[2].DestroySelf();
                }, 3f);

                // Untie Sleezer
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Sleezer)).GetPosition() + new Vector3(-5, 0));
                }, 3f);
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[3].DestroySelf();
                }, 4f);

                // Go to disappear
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(randyStartingPosition);
                }, 4f);
                FunctionTimer.Create(() => {
                    OvermapHandler.GetInstance().SpawnSmoke(randyOvermap.GetPosition(), .0f, Vector3.one);
                }, 5f);
                FunctionTimer.Create(() => {
                    randyOvermap.Hide();
                }, 5.5f);

                FunctionTimer.Create(() => {
                    UIBlack.Show();
                    dialogue.Show();
                    dialogue.PlayNextAction();
                }, 6.5f);
            },
            () => {
                dialogue.ShowLeftActiveTalkerHideRight("He's very odd but somehow very helpful");
                dialogue.HideRightCharacter();
                dialogue.HideRightCharacterName();
            },
            () => { dialogue.ShowLeftText("Why would the Evil Monster keep him around?"); },
            () => { dialogue.ShowLeftText("Anyways who cares we have the Sword of a Thousand Truths!"); },
            () => {
                dialogue.ShowLeftText("Let's get him once and for all!");
            },
            () => {
                dialogue.Hide();
                UIBlack.Hide();
                OvermapHandler.StartOvermapRunning();
                GameData.state = GameData.State.MovingToEvilMonster_3;
                Window_QuestPointer.Create(GameAssets.i.Map.Find("evilMonster_3").position, Color.white, Color.white);
            },
        }, true);
    }
示例#6
0
    public static void Play_LostToEvilMonster_1()
    {
        UIBlack.Show();
        OvermapHandler.StopOvermapRunning();

        List <World_Sprite> ropeWorldSpriteList = new List <World_Sprite>();

        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetPlayer().GetPosition(), Vector3.one * 1f, GameAssets.i.s_Rope, Color.white, 100));
        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Healer)).GetPosition(), Vector3.one * 1f, GameAssets.i.s_Rope, Color.white, 100));
        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Tank)).GetPosition(), Vector3.one * 1.2f, GameAssets.i.s_Rope, Color.white, 100));
        ropeWorldSpriteList.Add(World_Sprite.Create(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Sleezer)).GetPosition(), Vector3.one * 0.7f, GameAssets.i.s_Rope, Color.white, 100));

        NPCOvermap randyOvermap = OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.Randy));

        randyOvermap.GetUnitAnimation().PlayAnimForced(UnitAnim.GetUnitAnim("dBareHands_IdleUp"), 1f, null);
        Vector3 randyStartingPosition = randyOvermap.GetPosition();

        randyOvermap.overrideOvermapRunning = true;

        Dialogue dialogue = Dialogue.GetInstance();

        dialogue.SetDialogueActions(new List <Action>()
        {
            () => {
                dialogue.Show();
                dialogue.ShowLeftCharacter(GameAssets.i.s_PlayerDialogueSprite, false);
                dialogue.ShowLeftCharacterName(GameData.GetCharacterName(Character.Type.Player));
                dialogue.ShowLeftText("Oh come on, we had him! What happened?");
                dialogue.ShowRightCharacter(GameAssets.i.s_TankPortrait, true);
                dialogue.ShowRightCharacterName(GameData.GetCharacterName(Character.Type.Tank));
                dialogue.HideRightText();
            },
            () => {
                dialogue.ShowRightActiveTalkerHideLeft("Seems he overpowered us somehow...");
            },
            () => {
                dialogue.ShowRightCharacter(GameAssets.i.s_RandyPortrait, false);
                dialogue.ShowRightCharacterName(GameData.GetCharacterName(Character.Type.Randy));
                dialogue.ShowRightActiveTalkerHideLeft("Oh my, aren't you precious");
            },
            () => { dialogue.ShowRightText("You boys are quite fancy huhuhu"); },
            () => { dialogue.ShowLeftActiveTalkerHideRight("Who are you? Are you here to torture us?"); },
            () => { dialogue.ShowRightActiveTalkerHideLeft("Oh my, I could never torture such delicate specimens"); },
            () => { dialogue.ShowRightText("You are too pretty to be tied up"); },
            () => { dialogue.ShowRightText("Allow me to help you huhuhu"); },
            () => {
                // Randy Disappears in Smoke
                UIBlack.Hide();
                dialogue.Hide();

                // Untie Player
                randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetPlayer().GetPosition() + new Vector3(0, -5));
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[0].DestroySelf();
                }, 1f);

                // Untie Healer
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Healer)).GetPosition() + new Vector3(+5, 0));
                }, 1f);
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[1].DestroySelf();
                }, 2f);

                // Untie Tank
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Tank)).GetPosition() + new Vector3(-5, 0));
                }, 2f);
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[2].DestroySelf();
                }, 3f);

                // Untie Sleezer
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(OvermapHandler.GetInstance().GetFollower(GameData.GetCharacter(Character.Type.Sleezer)).GetPosition() + new Vector3(-5, 0));
                }, 3f);
                FunctionTimer.Create(() => {
                    ropeWorldSpriteList[3].DestroySelf();
                }, 4f);

                // Go to disappear
                FunctionTimer.Create(() => {
                    randyOvermap.SetTargetMovePosition(randyStartingPosition);
                }, 4f);
                FunctionTimer.Create(() => {
                    OvermapHandler.GetInstance().SpawnSmoke(randyOvermap.GetPosition(), .0f, Vector3.one);
                }, 5f);
                FunctionTimer.Create(() => {
                    randyOvermap.Hide();
                }, 5.5f);

                FunctionTimer.Create(() => {
                    UIBlack.Show();
                    dialogue.Show();
                    dialogue.PlayNextAction();
                }, 7.5f);
            },
            () => {
                dialogue.ShowLeftActiveTalkerHideRight("Well that was weird...");
                dialogue.HideRightCharacterName();
                dialogue.HideRightCharacter();
            },
            () => {
                dialogue.ShowLeftText("But hey lets keep going! He's not getting away this time");
            },

            /*
             * () => {
             *  NPCOvermap npcOvermap = OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.Randy));
             *  npcOvermap.SetTargetMovePosition();
             *  dialogue.Hide();
             *  UIBlack.Hide();
             *  OvermapHandler.StartOvermapRunning();
             * },*/
            () => {
                dialogue.Hide();
                UIBlack.Hide();
                OvermapHandler.StartOvermapRunning();
                GameData.state = GameData.State.MovingToEvilMonster_2;
                Window_QuestPointer.Create(GameAssets.i.Map.Find("evilMonster_2").position, Color.white, Color.white);
            },
        }, true);
    }
    private void CreateShootFlash(Vector3 spawnPosition)
    {
        World_Sprite worldSprite = World_Sprite.Create(spawnPosition, shootFlashSprite, 10000);

        FunctionTimer.Create(worldSprite.DestroySelf, .05f);
    }