Beispiel #1
0
    private string CurrentStateDialog()
    {
        myQuest = QuestComponent.GetQuestFromID(questID);
        if (myQuest == null)
        {
            return("There is no quest");
        }

        if (QuestComponent.IsCompleted(questID))
        {
            return(myQuest.QuestCompleteDescription);
        }
        else if (QuestComponent.IsCompleted(questIDRecuirement) == false && QuestComponent.IsCompleted(alternativeIDRequired))
        {
            return("You don't meet the requirements for the quest");
        }
        else if (started != true)
        {
            return(myQuest.QuestDescription);
        }
        else if (started == true)
        {
            return(myQuest.QuestActiveDescription);
        }
        return("");
    }
Beispiel #2
0
 private void MakeQuestAvalible(EventInfo eventinfo)
 {
     //Debug.Log("This is the current active status: " + enabled);
     if (QuestComponent.IsCompleted(alternativeIDRequired) && QuestComponent.IsCompleted(questIDRecuirement) && started != true)
     {
         lampRenderer.material = avalibleQuest;
     }
 }
Beispiel #3
0
 private void TriggerNextQuest(EventInfo eventInfo)
 {
     if (QuestComponent.IsCompleted(questIDRecuirement) == true || QuestComponent.IsCompleted(alternativeIDRequired) == false && started == false)
     {
         lampRenderer          = lamp.GetComponent <Renderer>();
         lampRenderer.material = avalibleQuest;
         Debug.Log("");//skriv ut ID på den questen som lyssnar på denna
     }
 }
Beispiel #4
0
    private void Update() {
        if (clientData == null) {
            return;
        }
        switch (state) {
            case UIState.creating:

                rewardText.GetComponent<TextMeshProUGUI>().text = Language.GetString(PickupCatalog.GetPickupDef(clientData.reward).nameToken);
                rewardText.GetComponent<RectTransform>().sizeDelta = rewardText.GetComponent<TextMeshProUGUI>().GetPreferredValues();
                rewardText.GetComponent<TextMeshProUGUI>().color = PickupCatalog.GetPickupDef(clientData.reward).baseColor;
                reward.GetComponent<RawImage>().texture = PickupCatalog.GetPickupDef(clientData.reward).iconTexture;

                questComponents = new List<QuestComponent>();
                for (int i = 0; i < clientData.questComponents.Count; i++) {
                    QuestComponent questComponent = rewardText.AddComponent<QuestComponent>();
                    questComponent.index = i;
                    questComponents.Add(questComponent);
                }

                questUI.transform.SetParent(this.transform);
                questUI.GetComponent<RectTransform>().sizeDelta = new Vector2(300, questTitle.GetComponent<RectTransform>().sizeDelta.y + 13.5f + rewardBacking.GetComponent<RectTransform>().sizeDelta.y + (55 * clientData.questComponents.Count) + rewardText.GetComponent<RectTransform>().sizeDelta.y);
                questUI.GetComponent<RectTransform>().localPosition = new Vector3(0,0,0);
                questUI.GetComponent<RectTransform>().anchoredPosition = new Vector2(UI.Utils.screenSize.x * Config.UI.questPositionX + 60, UI.Utils.screenSize.y * Config.UI.questPositionY);
                questUI.GetComponent<RectTransform>().localScale = new Vector3(UI.Utils.hudScale,UI.Utils.hudScale,UI.Utils.hudScale);

                state = UIState.updating;

                break;
            case UIState.updating:

                if ((clientData?.complete ?? false) && !finished) {
                    startTime = Run.instance.GetRunStopwatch();
                    targetAlpha = 0;
                    targetX = UI.Utils.screenSize.x * Config.UI.questPositionX + 60;
                    finished = true;
                }

                for (int i = questComponents.Count - 1; i >= 0; i--) {
                    questComponents[i].UpdateData(clientData.questComponents[questComponents[i].index], i);
                    if (clientData.questComponents[questComponents[i].index].complete) {
                        questComponents[i].Destroy();
                        Destroy(questComponents[i]);
                        questComponents.RemoveAt(i);
                    }
                }

                questUI.GetComponent<RectTransform>().anchoredPosition = new Vector2(Mathf.SmoothDamp(questUI.GetComponent<RectTransform>().anchoredPosition.x, targetX, ref moveVel, fadeTime), UI.Utils.screenSize.y * Config.UI.questPositionY);
                questUI.GetComponent<CanvasGroup>().alpha = Mathf.SmoothDamp(questUI.GetComponent<CanvasGroup>().alpha, targetAlpha, ref alphaVel, fadeTime);
                questUI.GetComponent<RectTransform>().sizeDelta = new Vector2(300, Mathf.SmoothDamp(questUI.GetComponent<RectTransform>().sizeDelta.y, questTitle.GetComponent<RectTransform>().sizeDelta.y + 13.5f + rewardBacking.GetComponent<RectTransform>().sizeDelta.y + (55 * questComponents.Count) + rewardText.GetComponent<RectTransform>().sizeDelta.y, ref backgroundVel, 0.7f));
                questUI.transform.Find("border").GetComponent<RectTransform>().sizeDelta = new Vector2(questUI.GetComponent<RectTransform>().sizeDelta.x + 2, questUI.GetComponent<RectTransform>().sizeDelta.y + 2);

                break;
        }
        if (finished && Run.instance.GetRunStopwatch() - startTime >= fadeTime + 0.5f) {
            Destroy();
        }
    }
Beispiel #5
0
 // Start is called before the first frame update
 void Start()
 {
     if (QuestComponent.IsCompleted(requiredQuestID))
     {
         gameObject.SetActive(false);
     }
     else
     {
         EventHandeler.Current.RegisterListener(EventHandeler.EVENT_TYPE.CompleteQuest, RemoveDoor);
     }
 }
Beispiel #6
0
    /// <summary>
    /// This method is called when the player wants to save their game.
    /// It will register all the data that the save file requires and then write that down to a save file that later can be read.-
    /// </summary>
    public void MakeNewSave()
    {
        //Hämtar hem de värden den behöver från spelet och sedan skriver ner dem på en txt fil så man kan läsa in dem senare
        playerPosition  = GetComponent <PlayerStateMashine>().transform.position;
        playerHealth    = GetComponent <PlayerStateMashine>().Health;
        completedQuests = QuestComponent.GetCompletedQuestList();
        sunPosition     = celestialHolder.GetComponent <DayAndNightSM>().Sun.transform.position;
        moonPosition    = celestialHolder.GetComponent <DayAndNightSM>().Moon.transform.position;
        //idex 1, (Spawner.transform.position, spawner.object.transform.position).

        //spara ner värden i en fil
    }
Beispiel #7
0
    private void Update()
    {
        if (Input.GetButtonDown("Quest log"))
        {
            book.SetActive(false);
            if (questIndex.Count != 0)
            {
                questLogText.text = QuestComponent.GetQuestName(questIndex[currentIndex]) + "\n" + QuestComponent.GetQuestDescription(questIndex[currentIndex]);
            }
            else
            {
                questLogText.text = "You have no quests at the moment";
            }

            if (questPanel.active == true)
            {
                questPanel.SetActive(false);
            }
            else
            {
                questPanel.SetActive(true);
            }
        }
        else if (Input.GetButtonDown("Flip pages keys") || Input.GetAxisRaw("Flip pages axis") > 0)
        {
            currentIndex++;
            if (questIndex.Count == 0)
            {
                currentIndex = 0;
                return;
            }
            else if (currentIndex > questIndex.Count - 1)
            {
                currentIndex = 0;
            }
            questLogText.text = QuestComponent.GetQuestName(questIndex[currentIndex]) + "\n" + QuestComponent.GetQuestDescription(questIndex[currentIndex]);
        }
        else if (Input.GetButtonDown("Flip pages keys") || Input.GetAxisRaw("Flip pages axis") < 0)
        {
            currentIndex--;
            if (questIndex.Count == 0)
            {
                currentIndex = 0;
                return;
            }
            else if (currentIndex < 0)
            {
                currentIndex = questIndex.Count - 1;
            }
            questLogText.text = QuestComponent.GetQuestName(questIndex[currentIndex]) + "\n" + QuestComponent.GetQuestDescription(questIndex[currentIndex]);
        }
    }
Beispiel #8
0
    private void Awake()
    {
        if (enabled == false)
        {
            return;
        }
        EventHandeler.Current.RegisterListener(EventHandeler.EVENT_TYPE.QuestGoalReached, QuestCompleted);
        EventHandeler.Current.RegisterListener(EventHandeler.EVENT_TYPE.AvailableQuest, MakeQuestAvalible);
        //EventHandeler.Current.RegisterListener(EventHandeler.EVENT_TYPE.ActivateNextQuest, TriggerNextQuest);
        lampRenderer     = lamp.GetComponent <Renderer>();
        standardMaterial = lampRenderer.material;

        if (QuestComponent.IsCompleted(questIDRecuirement) && QuestComponent.IsCompleted(alternativeIDRequired))
        {
            lampRenderer.material = avalibleQuest;
        }
        if (nextQuestInLine != null)
        {
            nextQuestInLine.enabled = false;
        }
    }
Beispiel #9
0
    public void ControllInput()
    {
        if (enabled == true)
        {
            QuestDialogEventInfo questDialogEvent = new QuestDialogEventInfo {
                questText = CurrentStateDialog(), show = true
            };
            EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.QuestDialog, questDialogEvent);
        }

        if (QuestComponent.IsCompleted(questID))
        {
            TurnInQuest();
        }
        else if (QuestComponent.IsCompleted(questIDRecuirement) == false || QuestComponent.IsCompleted(alternativeIDRequired) == false && this.enabled == true)
        {
            return;
        }
        else if (started == false)
        {
            StartTheQuest();
        }
    }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory = new NPCFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            NpcAIComponent = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            NPCComponent = new NPCComponent();
            QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent = new SoundComponent();
            ActorTextComponent = new ActorTextComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            #region Initialize Effect Components
            AgroDropComponent = new AgroDropComponent();
            AgroGainComponent = new AgroGainComponent();
            BuffComponent = new BuffComponent();
            ChanceToSucceedComponent = new ChanceToSucceedComponent();
            CoolDownComponent = new CoolDownComponent();
            DamageOverTimeComponent = new DamageOverTimeComponent();
            DirectDamageComponent = new DirectDamageComponent();
            DirectHealComponent = new DirectHealComponent();
            FearComponent = new FearComponent();
            HealOverTimeComponent = new HealOverTimeComponent();
            InstantEffectComponent = new InstantEffectComponent();
            KnockBackComponent = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent = new ReduceAgroRangeComponent();
            ResurrectComponent = new ResurrectComponent();
            StunComponent = new StunComponent();
            TimedEffectComponent = new TimedEffectComponent();
            #endregion

            base.Initialize();
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory   = new AggregateFactory(this);
            WeaponFactory      = new WeaponFactory(this);
            DoorFactory        = new DoorFactory(this);
            RoomFactory        = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory        = new WallFactory(this);
            EnemyFactory       = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory         = new NPCFactory(this);

            // Initialize Components
            PlayerComponent          = new PlayerComponent();
            LocalComponent           = new LocalComponent();
            RemoteComponent          = new RemoteComponent();
            PositionComponent        = new PositionComponent();
            MovementComponent        = new MovementComponent();
            MovementSpriteComponent  = new MovementSpriteComponent();
            SpriteComponent          = new SpriteComponent();
            DoorComponent            = new DoorComponent();
            RoomComponent            = new RoomComponent();
            HUDSpriteComponent       = new HUDSpriteComponent();
            HUDComponent             = new HUDComponent();
            InventoryComponent       = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen    = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent       = new EquipmentComponent();
            WeaponComponent          = new WeaponComponent();
            BulletComponent          = new BulletComponent();
            PlayerInfoComponent      = new PlayerInfoComponent();
            WeaponSpriteComponent    = new WeaponSpriteComponent();
            StatsComponent           = new StatsComponent();
            EnemyAIComponent         = new EnemyAIComponent();
            NpcAIComponent           = new NpcAIComponent();

            CollectibleComponent     = new CollectibleComponent();
            CollisionComponent       = new CollisionComponent();
            TriggerComponent         = new TriggerComponent();
            EnemyComponent           = new EnemyComponent();
            NPCComponent             = new NPCComponent();
            QuestComponent           = new QuestComponent();
            LevelManager             = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent        = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent           = new SoundComponent();
            ActorTextComponent       = new ActorTextComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            #region Initialize Effect Components
            AgroDropComponent          = new AgroDropComponent();
            AgroGainComponent          = new AgroGainComponent();
            BuffComponent              = new BuffComponent();
            ChanceToSucceedComponent   = new ChanceToSucceedComponent();
            CoolDownComponent          = new CoolDownComponent();
            DamageOverTimeComponent    = new DamageOverTimeComponent();
            DirectDamageComponent      = new DirectDamageComponent();
            DirectHealComponent        = new DirectHealComponent();
            FearComponent              = new FearComponent();
            HealOverTimeComponent      = new HealOverTimeComponent();
            InstantEffectComponent     = new InstantEffectComponent();
            KnockBackComponent         = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent   = new ReduceAgroRangeComponent();
            ResurrectComponent         = new ResurrectComponent();
            StunComponent              = new StunComponent();
            TimedEffectComponent       = new TimedEffectComponent();
            #endregion

            base.Initialize();
        }
Beispiel #12
0
 public static bool getComplete(QuestComponent questComponent)
 {
     return questComponent.complete;
 }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            base.Initialize();
        }