Beispiel #1
0
    private void Awake()
    {
        if (statsPanel == null)
        {
            statsPanel = FindObjectOfType <StatsPanel> ();
        }

        if (inventory == null)
        {
            inventory = FindObjectOfType <Inventory> ();
        }

        if (equipmentPanel == null)
        {
            equipmentPanel = FindObjectOfType <EquipmentPanel> ();
        }

        if (activeItemSlot == null)
        {
            activeItemSlot = FindObjectOfType <ActiveItemSlot> ();
        }

        statsPanel.SetStats(Power, Defanse, Range);
        statsPanel.UpdateStatValues();
        statsPanel.UpdateStatNames();

        SetStats();

        inventory.OnItemClickEvent      += EquipFromInventory;
        equipmentPanel.OnItemClickEnvet += UnequipFromEquipPanel;
    }
    private void Awake()
    {
        statsPanel.SetStats(GameObject.FindGameObjectWithTag("CharacterStat").GetComponent <CharacterStats>());
        statsPanel.UpdateStatValues();

        // Setup Events
        // RightClick
        inventory.OnRightClickEvent      += InventoryRightClick;
        equipmentPanel.OnRightClickEvent += EquipmentPanelRightClick;
        // Pointer Enter
        inventory.OnPointerEnterEvent      += ShowTooltip;
        equipmentPanel.OnPointerEnterEvent += ShowTooltip;
        // Point Exit
        inventory.OnPointerExitEvent      += HideTooltip;
        equipmentPanel.OnPointerExitEvent += HideTooltip;
        // Begin Drag
        inventory.OnBeginDragEvent      += BeginDrag;
        equipmentPanel.OnBeginDragEvent += BeginDrag;
        // End Drag
        inventory.OnEndDragEvent      += EndDrag;
        equipmentPanel.OnEndDragEvent += EndDrag;
        // Drag
        inventory.OnDragEvent      += Drag;
        equipmentPanel.OnDragEvent += Drag;
        // Drop
        inventory.OnDropEvent      += Drop;
        equipmentPanel.OnDropEvent += Drop;

        itemSaveManager.LoadEquipment(this);
        itemSaveManager.LoadInventory(this);
    }
    private void Awake()
    {
        if (character == null)
        {
            DontDestroyOnLoad(gameObject);
            character = this;
        }
        else if (character != this)
        {
            Destroy(gameObject);
        }

        statPanel.SetStats(Strength, Agility, Fighting, Awareness, Stamina, Dexterity, Intelligence, Presence, Dodge, Parry, Fortitude, Toughness, Will);
        statPanel.UpdateStatValues();

        advantagePanel.SetStats(AccurateAttack, AgileFeint, AlloutAttack, AnimalEmpathy, Artificer, Assessment, Attractive, BeginnersLuck, Benefit0, Benefit1, Benefit2, Benefit3, Chokehold, CloseAttack, Connected, Contacts, Daze, DefensiveAttack, DefensiveRoll, Diehard, EideticMemory, EquipmentAdvantage, Evasion, ExtraordinaryEffort, Fascinate, FastGrab, FavoredEnvironment, FavoredFoe, Fearless, GrabbingFinesse, GreatEndurance, HideinPlainSight, ImprovedAim, ImprovedCritical, ImprovedDefense, ImprovedDisarm, ImprovedGrab, ImprovedHold, ImprovedInitiative, ImprovedSmash, ImprovedTrip, ImprovisedTools, ImprovisedWeapon, Inspire, InstantUp, Interpose, Inventor, Jackofalltrades, Languages, Leadership, Luck, Minion, MovebyAction, PowerAttack, PreciseAttack, ProneFighting, QuickDraw, RangedAttack, Redirect, Ritualist, SecondChance, SeizeInitiative, Setup, Sidekick, SkillMastery0, SkillMastery1, SkillMastery2, SkillMastery3, Startle, Takedown, Taunt, Teamwork, ThrowingMastery, Tracking, Trance, UltimateEffort, UncannyDodge, WeaponBind, WeaponBreak, Wellinformed);
        advantagePanel.UpdateStatValues();

        skillPanel.SetStats(Acrobatics, Athletics, CloseCombat0, CloseCombat1, CloseCombat2, CloseCombat3, Deception, Expertise0, Expertise1, Expertise2, Expertise3, Insight, Intimidation, Investigation, Perception, Persuasion, RangedCombat0, RangedCombat1, RangedCombat2, RangedCombat3, SleightOfHand, Stealth, Technology, Treatment, Vehicles);
        advantagePanel.UpdateStatValues();

        powerPanel.SetStats(Power0, Power1, Power2, Power3, Power4, Power5, Power6, Power7, Power8, Power9, Power10, Power11);
        powerPanel.UpdateStatValues();
        //powerPanel.UpdateStatDescriptions();

        // Setup Events:
        // Right Click:
        archetype.OnRightClickEvent      += Equip;
        equipmentPanel.OnRightClickEvent += Unequip;
        // Show Tooltip:
        archetype.OnPointerEnterEvent      += ShowToolTip;
        equipmentPanel.OnPointerEnterEvent += ShowToolTip;
        // Hide Tooltip:
        archetype.OnPointerExitEvent      += HideToolTip;
        equipmentPanel.OnPointerExitEvent += HideToolTip;
        //// Begin Drag
        //archetype.OnBeginDragEvent += BeginDrag;
        //equipmentPanel.OnBeginDragEvent+= BeginDrag;
        //// End Drag
        //archetype.OnEndDragEvent += EndDrag;
        //equipmentPanel.OnEndDragEvent += EndDrag;
        //// Drag
        //archetype.OnDragEvent += Drag;
        //equipmentPanel.OnDragEvent += Drag;
        //// Drop
        //archetype.OnDropEvent += Drop;
        //equipmentPanel.OnDropEvent += Drop;

        currentTable = "Archetypes";
    }
    public void Init(PlayerStats stats, PlayerInputGrabber input)
    {
        _stats = stats;
        _input = input;
        // Create static class to handle custom class serialization and call methods from him
        ItemSlotNetworkedData.RegisterSerialization();

        _statsPanel.SetStats(_stats.Strength, _stats.Armour, _stats.FreezeResistance, _stats.HeatResistance);
        _statsPanel.UpdateStatValues();
        Subscribe();
        _inventory.Init();
        _equipment.Init();
        UpdateInventoryMaxSlots();

        _networkedInventoryData.OnListChanged += changeEvent => OnNetworkedListChange(changeEvent.index, changeEvent.value, _inventory.itemSlots);
        _networkedEquipmentData.OnListChanged += changeEvent => OnNetworkedListChange(changeEvent.index, changeEvent.value, _equipment.equipmentSlots);
    }