示例#1
0
        public void FollowerClicked(FollowerDisplay fd)
        {
            // Show some info on them.

            if (ListOfCurrentFollowers[0] == fd.Data)
            {
                if (fd.Data is EnemyData)
                {
                    EnemyData ed = (EnemyData)fd.Data;

                    string elemDmg   = ed.HasElementalDamage ? ed.ElementalDamage.ToString() : "0";
                    string elemColor = ed.HasElementalDamage ? "#" + ColorUtility.ToHtmlStringRGB(ed.ElementalDamageType.DamageColor) : "black";


                    string description = $@"Fight a level {ed.Level} {ed.DisplayName}?
<color=green>Health: {ed.MaxHealth}</color>
<color=red>Damage: {ed.Damage}</color>
Elemental Damage: <color={elemColor}>{elemDmg}</color>";

                    PopUp.SetPopUp(description, new[] { "Yes", "No" }, new Action[] {
                        () => {
                            InteractionController.Instance.EnemyFight(ed);
                        },
                        () => { }
                    });
                }
                else if (fd.Data is QuestGiver)
                {
                    WorldCameraLerper.StartLerping(() => {
                        PlayerAnimations.Instance.Spin();
                        QuestGiver.SetData(fd.Data);
                        QuestGiver.StartWalking();
                        QuestGiverWalk.StartLerping(() => {
                            QuestGiver.StopWalking();
                            QuestGiver.OnPointerClick(null);
                        });
                    });
                }
                else if (fd.Data is ShopFollower)
                {
                    WorldCameraLerper.StartLerping(() => {
                        PlayerAnimations.Instance.Spin();
                        Shopper.SetData(fd.Data);
                        Shopper.StartWalking();
                        ShopperWalk.StartLerping(() => {
                            Shopper.StopWalking();
                            Shopper.OnPointerClick(null);
                        });
                    });
                }
            }
        }
    public void EnemyFight(EnemyData enemy)
    {
        PlayerClickController.Instance.SetEnabled(false);
        QuickPopUp.QuickPopUpAllowed = false;
        World.Disable();
        BattleUi.gameObject.SetActive(true);
        BattleUi.SetAlphaOfAllChildren(0);

        // Scroll to fight area
        LerperToBattleArea.StartLerping(() => {
            PlayerAnimations.Instance.Spin();

            EnemyDisplay.Instance.gameObject.SetActive(true);
            EnemyDisplay.Instance.SetEnemy(enemy);
            EnemyDisplay.Instance.StartWalkingAnimation();
            EnemyPositionLerper.StartLerping(() => {
                // Start Combat
                EnemyDisplay.Instance.StopWalking();
                EnemyDisplay.Instance.StartAttacking();
                BattleUiLerper.StartLerping();
                AttackArea.SetActive(true);
                // Update enemy health bar?
            });
        });
    }