コード例 #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);
                        });
                    });
                }
            }
        }
コード例 #2
0
        private void AddDisplay(FollowerDisplay display, FollowerData d)
        {
            display.transform.SetAsFirstSibling();
            Vector2 r = ((RectTransform)display.transform).sizeDelta;

            r.x = d.SizeOfSprite.x;
            r.y = d.SizeOfSprite.y;
            ((RectTransform)display.transform).sizeDelta = r;

            display.SetData(d);
            display.FollowerClicked -= FollowerClicked;
            display.FollowerClicked += FollowerClicked;
        }
コード例 #3
0
        private void ResetFollowers()
        {
            FollowerPool.Reset();

            for (int i = 0; i < ListOfCurrentFollowers.Value.Count; i++)
            {
                FollowerData    fd = ListOfCurrentFollowers[i];
                GameObject      go = FollowerPool.GetObject();
                FollowerDisplay d  = go.GetComponent <FollowerDisplay>();
                AddDisplay(d, fd);
            }

            FollowerLayoutController.Instance.ChangeLayout();
        }