コード例 #1
0
        // We use LateUpdate to ensure the animation has updated before updating attachment positions
        void LateUpdate()
        {
            // Here we cache the SpriteAnimNodes component for efficiency
            if (m_nodes == null)
            {
                m_nodes = GetComponent <SpriteAnimNodes>();
            }

            // Loop through the list of attachment names, and attach to the corresponding node's index
            for (int i = 0; i < m_attachments.Length; ++i)
            {
                m_nodes.SetTransformFromNode(m_attachments[i], i);
            }
        }
コード例 #2
0
    protected override void Start()
    {
        base.Start();

        if (!isLocalPlayer)
        {
            return;
        }

        playerCamera  = GameManager.mainCamera.GetComponent <PlayerCamera>();
        animatorNodes = GetComponentInChildren <SpriteAnimNodes>();

        queuedInputStates   = new List <InputState>();
        playerCamera.target = this;

        // Spawn equipped items for testing purposes
        mainHandItem = Instantiate(GameManager.instance.swordItem, transform, false);
        offHandItem  = Instantiate(GameManager.instance.shieldItem, transform, false);
    }