Exemplo n.º 1
0
    public void CreatePointer(Transform targets, int questNumber)
    {
        Window_QuestPointer.QuestPointer questPointers = windowQuestPointer.CreatePointer(new Vector3(targets.position.x, targets.position.y, targets.position.z));
        FunctionUpdater.Create(() =>
        {
            #region
            float xDistancia = Camera.main.transform.position.x - targets.position.x;
            float yDistancia = Camera.main.transform.position.y - targets.position.y;
            #endregion
            float distancia = Mathf.Sqrt(xDistancia * xDistancia + yDistancia * yDistancia);
            #region

            /*Debug.Log(distancia);
             * Debug.Log(distance);
             * Debug.Log("Cam Distance: " + (distancia < distance));
             * Debug.Log("middleQuest: " + (theQM.middleQuestCompleted[questNumber]));
             * Debug.Log("Quest: " + (theQM.questCompleted[questNumber]));
             * Debug.Log("Everything: " + (Input.GetKeyDown(KeyCode.E) && (distancia < distance)));*/
            #endregion
            if (Input.GetKeyDown(KeyCode.E) && (distancia < distance))
            {
                windowQuestPointer.DestroyPointer(questPointers);
                return(true);
            }
            else
            {
                return(false);
            }
        });
    }
Exemplo n.º 2
0
 private void Start()
 {
     //创建新的任务箭头图标
     Window_QuestPointer.QuestPointer questPointer_1 = windowQuestPointer.CreatePointer(new Vector3(-101, 60));
     //创建新的委托
     FunctionUpdater.Create(() =>
     {
         //如果到达目标范围40m左右就删除任务图标
         if (Vector3.Distance(Camera.main.transform.position, new Vector3(-101, 60)) < 20f)
         {
             windowQuestPointer.DestroyPointer(questPointer_1);
             return(true);
         }
         else
         {
             return(false);
         }
     });
     //创建新的任务箭头图标
     Window_QuestPointer.QuestPointer questPointer_2 = windowQuestPointer.CreatePointer(new Vector3(57, 55));
     //创建新的委托
     FunctionUpdater.Create(() =>
     {
         //如果到达目标范围40m左右就删除任务图标
         if (Vector3.Distance(Camera.main.transform.position, new Vector3(57, 55)) < 15f)
         {
             windowQuestPointer.DestroyPointer(questPointer_2);
             return(true);
         }
         else
         {
             return(false);
         }
     });
     //创建新的任务箭头图标
     Window_QuestPointer.QuestPointer questPointer_3 = windowQuestPointer.CreatePointer(new Vector3(120, 30));
     //创建新的委托
     FunctionUpdater.Create(() =>
     {
         //如果到达目标范围40m左右就删除任务图标
         if (Vector3.Distance(Camera.main.transform.position, new Vector3(120, 30)) < 20f)
         {
             windowQuestPointer.DestroyPointer(questPointer_3);
             return(true);
         }
         else
         {
             return(false);
         }
     });
 }
Exemplo n.º 3
0
    public static void Play_Shop(Character shopCharacter)
    {
        if (GameData.state == GameData.State.HealerJoined)
        {
            Window_QuestPointer.DestroyPointer(GameAssets.i.Map.Find("shop").position);
            GameData.state = GameData.State.LeavingTown;
            Window_QuestPointer.Create(GameAssets.i.Map.Find("letsLeaveTown").position, Color.white, Color.white);
        }


        UIBlack.Show();
        OvermapHandler.StopOvermapRunning();
        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_VendorPortrait, false);
                dialogue.ShowRightCharacterName(GameData.GetCharacterName(Character.Type.Shop));
                dialogue.ShowRightText("Greetings! Care to browse my wares?");
            },
            () => {
                dialogue.Hide();

                Window_Shop.Show_Static(shopCharacter.shopContents, () => {
                    UIBlack.Hide();
                    OvermapHandler.StartOvermapRunning();
                });
            },
        }, true);
    }
Exemplo n.º 4
0
    public static void Play_DoppelGanger()
    {
        Window_QuestPointer.DestroyPointer(OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.PlayerDoppelganger)).GetPosition() + new Vector3(0, 10));
        UIBlack.Show();
        OvermapHandler.StopOvermapRunning();
        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.ShowRightCharacter(GameAssets.i.s_PlayerDialogueSprite, true);
                dialogue.ShowLeftText("Greetings, can you tell me where the Tavern is?");
                dialogue.HideRightText();
                dialogue.HideRightCharacterName();
            },
            () => { dialogue.ShowRightActiveTalkerHideLeft("It's just over there"); },
            () => { dialogue.ShowLeftActiveTalkerHideRight("Ok thank you!"); },
            () => {
                dialogue.Hide();
                UIBlack.Hide();
                OvermapHandler.StartOvermapRunning();
                Window_QuestPointer.Create(GameAssets.i.Map.Find("tavern").position, Color.white, Color.white);
                GameData.state = GameData.State.GoingToTavern;
            },
        }, true);
    }
Exemplo n.º 5
0
    public static void Play_ArrivedAtTownCenter()
    {
        Window_QuestPointer.DestroyPointer(GameAssets.i.Map.Find("townCenter").position);
        GameData.state = GameData.State.GoingToAskDoppelGanger;
        UIBlack.Show();
        OvermapHandler.StopOvermapRunning();
        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.ShowRightCharacter(GameAssets.i.s_TankPortrait, false);
                dialogue.ShowRightCharacterName(GameData.GetCharacterName(Character.Type.Tank));
                dialogue.HideLeftText();
                dialogue.ShowRightText("We should get some refreshments before going on our Quest");
            },
            () => { dialogue.ShowLeftActiveTalkerHideRight("Good idea, let's find the tavern"); },
            () => {
                dialogue.Hide();
                UIBlack.Hide();
                OvermapHandler.StartOvermapRunning();
                Window_QuestPointer.Create(OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.PlayerDoppelganger)).GetPosition() + new Vector3(0, 10), Color.yellow, Color.yellow, crossSprite: GameAssets.i.s_ExclamationPoint);
            },
        }, true);
    }
Exemplo n.º 6
0
    private void Start()
    {
        Window_QuestPointer.QuestPointer questPointer_1 = windowQuestPointer.CreatePointer(new Vector3(200, 45), UtilsClass.GetColorFromString("FF0000"), UtilsClass.GetColorFromString("FFFFFF"));
        FunctionUpdater.Create(() => {
            if (Vector3.Distance(Camera.main.transform.position, new Vector3(200, 45)) < 40f)
            {
                windowQuestPointer.DestroyPointer(questPointer_1);
                return(true);
            }
            else
            {
                return(false);
            }
        });

        Window_QuestPointer.QuestPointer questPointer_2 = windowQuestPointer.CreatePointer(new Vector3(190, -32), UtilsClass.GetColorFromString("00FF00"), UtilsClass.GetColorFromString("00FF00"), customArrowSprite, customCrossSprite);
        FunctionUpdater.Create(() => {
            if (Vector3.Distance(Camera.main.transform.position, new Vector3(190, -32)) < 40f)
            {
                windowQuestPointer.DestroyPointer(questPointer_2);
                return(true);
            }
            else
            {
                return(false);
            }
        });

        Window_QuestPointer.QuestPointer questPointer_3 = windowQuestPointer.CreatePointer(new Vector3(-70, 200), UtilsClass.GetColorFromString("FFFFFF"), UtilsClass.GetColorFromString("FFFF00"), customArrowSprite, exclamationPointSprite);
        FunctionUpdater.Create(() => {
            if (Vector3.Distance(Camera.main.transform.position, new Vector3(-70, 200)) < 40f)
            {
                windowQuestPointer.DestroyPointer(questPointer_3);
                return(true);
            }
            else
            {
                return(false);
            }
        });
    }
Exemplo n.º 7
0
    public static void Play_Tavern()
    {
        Window_QuestPointer.DestroyPointer(GameAssets.i.Map.Find("tavern").position);
        UIBlack.Show();
        OvermapHandler.StopOvermapRunning();
        Dialogue  dialogue = Dialogue.GetInstance();
        Character tavernAmbushCharacter = GameData.GetCharacter(Character.Type.TavernAmbush);

        dialogue.SetDialogueActions(new List <Action>()
        {
            () => {
                dialogue.Show();
                dialogue.ShowLeftCharacter(GameAssets.i.s_PlayerDialogueSprite, false);
                dialogue.ShowLeftCharacterName(GameData.GetCharacterName(Character.Type.Player));
                dialogue.ShowLeftText("Greetings!");
                dialogue.HideRightCharacter();
                dialogue.HideRightText();
                dialogue.HideRightCharacterName();
            },
            () => { dialogue.ShowLeftText("May we have some refreshments?"); },
            () => {
                UIBlack.Hide();
                dialogue.Hide();

                Vector3 playerPosition = OvermapHandler.GetInstance().GetPlayer().GetPosition();
                OvermapHandler.GetInstance().GetPlayer().GetUnitAnimation().PlayAnimForced(UnitAnim.GetUnitAnim("dSwordTwoHandedBack_IdleDown"), 1f, null);

                NPCOvermap enemyOvermap         = OvermapHandler.GetInstance().GetNPC(tavernAmbushCharacter);
                enemyOvermap.transform.position = playerPosition + new Vector3(0, -17f);
                enemyOvermap.GetUnitAnimation().PlayAnimForced(UnitAnim.GetUnitAnim("dMinion_IdleUp"), 1f, null);
                OvermapHandler.GetInstance().SpawnSmoke(enemyOvermap.GetPosition(), .3f, Vector3.one);

                NPCOvermap enemyOvermap_2         = OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.TavernAmbush_2));
                enemyOvermap_2.transform.position = playerPosition + new Vector3(14f, -12f);
                enemyOvermap_2.GetUnitAnimation().PlayAnimForced(UnitAnim.GetUnitAnim("dMinion_IdleUp"), 1f, null);
                OvermapHandler.GetInstance().SpawnSmoke(enemyOvermap_2.GetPosition(), .3f, Vector3.one);

                NPCOvermap enemyOvermap_3         = OvermapHandler.GetInstance().GetNPC(GameData.GetCharacter(Character.Type.TavernAmbush_3));
                enemyOvermap_3.transform.position = playerPosition + new Vector3(-14, -12f);
                enemyOvermap_3.GetUnitAnimation().PlayAnimForced(UnitAnim.GetUnitAnim("dMinion_IdleUp"), 1f, null);
                OvermapHandler.GetInstance().SpawnSmoke(enemyOvermap_3.GetPosition(), .3f, Vector3.one);

                enemyOvermap.gameObject.SetActive(false);
                enemyOvermap_2.gameObject.SetActive(false);
                enemyOvermap_3.gameObject.SetActive(false);
                FunctionTimer.Create(() => {
                    enemyOvermap.gameObject.SetActive(true);
                    enemyOvermap_2.gameObject.SetActive(true);
                    enemyOvermap_3.gameObject.SetActive(true);
                }, .45f);

                FunctionTimer.Create(() => {
                    UIBlack.Show();
                    dialogue.Show();
                    dialogue.PlayNextAction();
                }, 1.2f);
            },
            () => {
                dialogue.HideLeftText();
                dialogue.FadeLeftCharacter();
                dialogue.ShowRightCharacter(GameAssets.i.s_EnemyMinionRedPortrait, false);
                dialogue.ShowRightText("That's the one! Get him!");
            },
            () => {
                GameData.GetCharacter(Character.Type.TavernAmbush_2).isDead = true;
                GameData.GetCharacter(Character.Type.TavernAmbush_3).isDead = true;
                GameData.state = GameData.State.FightingTavernAmbush;
                BattleHandler.LoadEnemyEncounter(tavernAmbushCharacter, tavernAmbushCharacter.enemyEncounter);
            },
        }, true);
    }
Exemplo n.º 8
0
    public void Update()
    {
        overmapFtnDewHandler.Update();

        switch (GameData.state)
        {
        case GameData.State.GoingToTownCenter:
            //Vector3 townCenterPosition = GameAssets.i.Map.Find("townCenter").position;
            List <Vector3> positionList = new List <Vector3> {
                GameAssets.i.Map.Find("townCenter").position,
                GameAssets.i.Map.Find("townCenter_2").position,
                GameAssets.i.Map.Find("townCenter_3").position,
            };
            bool reachedPosition = false;
            foreach (Vector3 position in positionList)
            {
                if (Vector3.Distance(playerOvermap.GetPosition(), position) < 30f)
                {
                    reachedPosition = true;
                }
            }
            if (reachedPosition)
            {
                GameData.state = GameData.State.ArrivedAtTownCenter;
                Cutscenes.Play_ArrivedAtTownCenter();
            }
            break;

        case GameData.State.GoingToTavern:
            Vector3 tavernPosition = GameAssets.i.Map.Find("tavern").position;
            if (Vector3.Distance(playerOvermap.GetPosition(), tavernPosition) < 20f)
            {
                GameData.state = GameData.State.InTavern;
                Cutscenes.Play_Tavern();
            }
            break;

        case GameData.State.LeavingTown:
            //Vector3 leaveTownPosition = GameAssets.i.Map.Find("letsLeaveTown").position;
            positionList = new List <Vector3> {
                GameAssets.i.Map.Find("letsLeaveTown").position,
                GameAssets.i.Map.Find("letsLeaveTown_2").position,
                GameAssets.i.Map.Find("letsLeaveTown_3").position,
            };
            reachedPosition = false;
            foreach (Vector3 position in positionList)
            {
                if (Vector3.Distance(playerOvermap.GetPosition(), position) < 30f)
                {
                    reachedPosition = true;
                }
            }
            if (reachedPosition)
            {
                GameData.state = GameData.State.GoingToFirstEvilMonsterEncounter;
                Window_QuestPointer.DestroyPointer(GameAssets.i.Map.Find("letsLeaveTown").position);

                Window_QuestPointer.Create(GameAssets.i.Map.Find("evilMonster").position, Color.white, Color.white);
            }
            break;

        case GameData.State.GoingToFirstEvilMonsterEncounter:
            Vector3 evilMonsterPosition = GetEnemy(Character.Type.EvilMonster).GetPosition();
            if (Vector3.Distance(playerOvermap.GetPosition(), evilMonsterPosition) < 90f)
            {
                GameData.state = GameData.State.GoingToFightEvilMonster;
                Window_QuestPointer.DestroyPointer(GameAssets.i.Map.Find("evilMonster").position);

                Cutscenes.Play_SpottedEvilMonster();
            }
            break;

        case GameData.State.MovingToEvilMonster_2:
            evilMonsterPosition = GetEnemy(Character.Type.EvilMonster_2).GetPosition();
            if (Vector3.Distance(playerOvermap.GetPosition(), evilMonsterPosition) < 80f)
            {
                GameData.state = GameData.State.GoingToFightEvilMonster_2;
                Window_QuestPointer.DestroyPointer(GameAssets.i.Map.Find("evilMonster_2").position);
            }
            break;

        case GameData.State.MovingToEvilMonster_3:
            evilMonsterPosition = GetEnemy(Character.Type.EvilMonster_3).GetPosition();
            if (Vector3.Distance(playerOvermap.GetPosition(), evilMonsterPosition) < 80f)
            {
                GameData.state = GameData.State.GoingToFightEvilMonster_3;
                Window_QuestPointer.DestroyPointer(GameAssets.i.Map.Find("evilMonster_3").position);
            }
            break;
        }
    }