コード例 #1
0
    public override void OnGUI(Rect position, SerializedProperty a_Property, GUIContent a_Label)
    {
        position.height = EditorHelp.c_LineHeight;
        EditorGUI.BeginProperty(position, a_Label, a_Property);

        SerializedProperty foldOutProperty = a_Property.FindPropertyRelative("m_IsFoldingOut");
        SerializedProperty prefabProperty  = a_Property.FindPropertyRelative("m_AbilityModulePrefab");
        AbilityModule      prefab          = null;
        string             nameString      = "Ability slot empty";

        if (prefabProperty.objectReferenceValue != null)
        {
            prefab     = prefabProperty.objectReferenceValue as AbilityModule;
            nameString = prefab.GetName();
        }
        foldOutProperty.boolValue = EditorGUI.Foldout(position, foldOutProperty.boolValue, nameString, true);

        Rect pos = position;

        if (foldOutProperty.boolValue)
        {
            EditorGUI.indentLevel++;
            EditorHelp.PropertyDrawerLineWithVar(a_Property, "m_AbilityModulePrefab", ref pos, "", "Prefab");
            if (prefabProperty.objectReferenceValue != null)
            {
                if (EditorHelp.PropertyDrawerButton("Edit", ref pos))
                {
                    Selection.activeGameObject = prefab.gameObject;
                }
            }
            EditorGUI.indentLevel--;
        }

        EditorGUI.EndProperty();
    }
コード例 #2
0
 public void ForceExitModules()
 {
     if (m_CurrentlyUsedModule != null)
     {
         m_CurrentlyUsedModule.EndModule();
         m_CurrentlyUsedModule = null;
     }
 }
コード例 #3
0
 public void InstantiateAbilities()
 {
     for (int i = 0; i < abilitiesCount; i++)
     {
         AbilityModule ability = Instantiate(abilitySlots[i]);
         abilitySlots[i] = ability;
     }
 }
コード例 #4
0
ファイル: AbilityDraggable.cs プロジェクト: coconut1z/GDS1
 // Use this for initialization
 void Start()
 {
     if (!equipped)
     {
         slot = -1;
     }
     ability = abilityPrefab.GetComponent <AbilityModule>();
     moused  = false;
     info    = (GameObject)(Resources.Load("InventoryPrefabs/AbilityInfoPanelHover"));
 }
コード例 #5
0
    public void PostFixedUpdateModuleSelection()
    {
        AbilityModule preSelectMod = GetCurrentModule();

        UpdateBestApplicableModule();
        AbilityModule postSelectMod = GetCurrentModule();

        if (preSelectMod != postSelectMod && postSelectMod != null)
        {
            m_CharacterController.GetCollider().ClearColPoints();
            postSelectMod.PlaceMovingColPoint();
        }
    }
コード例 #6
0
 void FixedUpdate()
 {
     if (m_AbilityModuleManager != null)
     {
         AbilityModule module = m_AbilityModuleManager.GetCurrentModule();
         if (module != null)
         {
             m_TextMesh.text = module.GetName();
         }
         else
         {
             m_TextMesh.text = "Default";
         }
     }
 }
コード例 #7
0
 public void ApplyAbilityUnlockList(AbilityUnlockList a_List)
 {
     for (int i = 0; i < a_List.m_List.Length; i++)
     {
         AbilityModule module = GetModuleWithName(a_List.m_List[i].m_AbilityName);
         if (module != null)
         {
             module.SetLocked(a_List.m_List[i].m_Lock);
         }
         else
         {
             Debug.Log("Trying to unlock module with name " + a_List.m_List[i].m_AbilityName + " but this ability cannot be found on the character");
         }
     }
 }
コード例 #8
0
    void SetNewModule(AbilityModule a_Module)
    {
        if (a_Module == m_CurrentlyUsedModule)
        {
            return;
        }

        if (m_CurrentlyUsedModule != null)
        {
            m_CurrentlyUsedModule.EndModule();
        }
        if (a_Module != null)
        {
            a_Module.StartModule();
        }
        m_CurrentlyUsedModule = a_Module;
    }
コード例 #9
0
    AbilityModule GetBestApplicableModule()
    {
        int           bestPriority = int.MinValue;
        AbilityModule returnModule = null;

        for (int i = 0; i < m_AbilityModules.Length; i++)
        {
            if (m_AbilityModules[i].GetPriority() > bestPriority)
            {
                if (!m_AbilityModules[i].IsLocked() && m_AbilityModules[i].IsApplicable())
                {
                    returnModule = m_AbilityModules[i];
                    bestPriority = m_AbilityModules[i].GetPriority();
                }
            }
        }

        return(returnModule);
    }
コード例 #10
0
    public void UpdateBestApplicableModule()
    {
        if (m_CurrentlyUsedModule != null && (!m_CurrentlyUsedModule.IsApplicable() || m_CurrentlyUsedModule.IsLocked()))
        {
            if (m_CurrentlyUsedModule.CanEnd())
            {
                m_CurrentlyUsedModule.EndModule();
                m_CurrentlyUsedModule = null;
            }
        }
        AbilityModule bestApplicableModule = GetBestApplicableModule();

        if (m_CurrentlyUsedModule != null && bestApplicableModule != m_CurrentlyUsedModule)
        {
            if (!m_CurrentlyUsedModule.CanEnd())
            {
                return;
            }
        }
        SetNewModule(bestApplicableModule);
    }
コード例 #11
0
    public void ReplaceAbility(GameObject abi, int slot)
    {
        GameObject abilityObj = Instantiate(abi) as GameObject;


        AbilityModule ability = abilityObj.GetComponent <AbilityModule>();
        AbilityModule unequip = abilitySlots[slot - 1];

        if (unequip.passive)
        {
            PassiveAbility unequipPassive = unequip.GetComponent <PassiveAbility>();
            unequipPassive.Detach();
        }

        Destroy(unequip.gameObject);

        if (ability.passive)
        {
            PassiveAbility equipPassive = ability.GetComponent <PassiveAbility>();
            equipPassive.Attach();
        }

        abilitySlots[slot - 1] = ability;

        abilitySlots[slot - 1].cooldownImage     = abilityCooldownImages[slot - 1];
        abilityCooldownImages[slot - 1].sprite   = abilitySlots[slot - 1].abilityCircleIcon;
        abilityOnCooldownImages[slot - 1].sprite = abilitySlots[slot - 1].abilityCircleIcon;
        abilitySlots[slot - 1].abilityText       = abilityNameTexts[slot - 1];

        abilitySlots[slot - 1].bottomImage   = abilityBottomImages[slot - 1];
        abilityBottomImages[slot - 1].sprite = abilitySlots[slot - 1].abilitySquareIcon;

        abilitySlots[slot - 1].bottomText = abilityBottomTexts[slot - 1];

        //abilitySlots[slot - 1].abilityIcon = abilityIconImages[slot - 1];

        abilitySlots[slot - 1].abilityButtonText = abilityButtonTexts[slot - 1];
    }
コード例 #12
0
    void Update()
    {
        AbilityModule moduleObject = m_ModuleManager.GetModuleWithName("Dash");

        if (moduleObject == null || moduleObject.GetType() != typeof(DashModule))
        {
            return;
        }
        DashModule module = moduleObject as DashModule;

        if (module.CanStartDash() && m_PlayerInput.GetDirectionInput("Aim") != null)
        {
            m_Arrow.gameObject.SetActive(true);
            Vector2 aimDir   = m_PlayerInput.GetDirectionInput("Aim").m_ClampedInput;
            Vector3 aimDir3d = new Vector3(aimDir.x, aimDir.y, 0.0f);
            aimDir3d.Normalize();
            m_Arrow.LookAt(m_Arrow.transform.position + aimDir3d, Vector3.back);
            m_Arrow.localScale = new Vector3(1.0f, 1.0f, m_MaxLength * aimDir.magnitude);
        }
        else
        {
            m_Arrow.gameObject.SetActive(false);
        }
    }