Example #1
0
    void SpawnAllButtons()
    {
        LoopPoint       lastPoint   = null;
        LoopPointButton firstButton = null;
        LoopPointButton lastButton  = null;
        int             index       = 0;

        foreach (LoopPoint lp in PlayerLoop.inst.GetLoopPoints())
        {
            LoopPointButton b = Instantiate(m_prefab_loopPointButton, m_LoopPointsButtonContainer);
            b.Init(lp, lp.GetPosition());

            if (lastPoint != null && PlayerLoop.inst.GetSize() < m_maxLoopPoint)
            {
                Vector3 position = (lastPoint.GetPosition() - lp.GetPosition()) * .5f + lp.GetPosition();
                Instantiate(m_prefab_addLoopPointButton, m_LoopPointsButtonContainer).Init(lastPoint, position, true, b);
            }

            if (lastButton != null)
            {
                lastButton.SetAngle(b);
            }
            else
            {
                firstButton = b;
            }

            lastPoint  = lp;
            lastButton = b;
            index++;
        }
        if (PlayerLoop.inst.GetSize() < m_maxLoopPoint)
        {
            Vector3 position0 = (lastPoint.GetPosition() - PlayerLoop.inst.GetPointAt(0).GetPosition()) * .5f + PlayerLoop.inst.GetPointAt(0).GetPosition();
            Instantiate(m_prefab_addLoopPointButton, m_LoopPointsButtonContainer).Init(lastPoint, position0, true, firstButton);
        }
        lastButton.SetAngle(firstButton);
    }
Example #2
0
 void FindMiddleFromTarget()
 {
     SetPosition((m_target.m_loopPoint.GetPosition() - m_loopPoint.GetPosition()) * .5f + m_loopPoint.GetPosition());
 }