コード例 #1
0
    // Use this for initialization
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
        inventoryUI      = FindObjectOfType <Tapestry_Level>().inventoryUI;
        if (ReferenceEquals(inventory, null))
        {
            inventory = (Tapestry_Inventory)ScriptableObject.CreateInstance("Tapestry_Inventory");
        }
        if (damageProfile == null)
        {
            damageProfile = new Tapestry_DamageProfile();
        }
        if (attributeProfile == null)
        {
            attributeProfile = new Tapestry_AttributeProfile();
        }
        if (skillProfile == null)
        {
            skillProfile = new Tapestry_SkillProfile();
        }
        if (keywords == null)
        {
            keywords = (Tapestry_KeywordRegistry)ScriptableObject.CreateInstance("Tapestry_KeywordRegistry");
        }
        if (effects == null)
        {
            effects = new List <Tapestry_Effect>();
        }

        for (int i = 0; i < transform.childCount; i++)
        {
            if (transform.GetChild(i).name == "T_Points")
            {
                GameObject pointContainer = transform.GetChild(i).gameObject;
                for (int j = 0; j < pointContainer.transform.childCount; j++)
                {
                    if (pointContainer.transform.GetChild(j).name == "P_Attach")
                    {
                        attachPoint = pointContainer.transform.GetChild(j).gameObject;
                    }
                }
            }
        }
        isRunning           = true;
        heldItemStartingPos = equippedItemContainer.transform.localPosition;
        heldItemStartingRot = equippedItemContainer.transform.localRotation;
    }
コード例 #2
0
    protected override void Reset()
    {
        if (ReferenceEquals(inventory, null))
        {
            inventory = (Tapestry_Inventory)ScriptableObject.CreateInstance("Tapestry_Inventory");
        }
        if (damageProfile == null)
        {
            damageProfile = new Tapestry_DamageProfile();
        }
        if (attributeProfile == null)
        {
            attributeProfile = new Tapestry_AttributeProfile();
        }
        if (skillProfile == null)
        {
            skillProfile = new Tapestry_SkillProfile();
        }
        if (keywords == null)
        {
            keywords = (Tapestry_KeywordRegistry)ScriptableObject.CreateInstance("Tapestry_KeywordRegistry");
        }
        if (effects == null)
        {
            effects = new List <Tapestry_Effect>();
        }

        for (int i = 0; i < transform.childCount; i++)
        {
            if (transform.GetChild(i).name == "T_Points")
            {
                GameObject pointContainer = transform.GetChild(i).gameObject;
                for (int j = 0; j < pointContainer.transform.childCount; j++)
                {
                    if (transform.GetChild(i).name == "P_Attach")
                    {
                        attachPoint = pointContainer.transform.GetChild(j).gameObject;
                    }
                }
            }
        }

        base.Reset();
    }