示例#1
0
 //	remove them from me and all my descendants.
 public void RemoveITweenComponentsTree()
 {
     RemoveITweenComponents();
     foreach (Transform child in this.transform)
     {
         PositionToggler pt = child.GetComponent <PositionToggler>();
         if (pt != null)
         {
             pt.RemoveITweenComponentsTree();
         }
     }
 }
示例#2
0
    public void SwapBarSlotPositions()
    {
        Bar bar = this.GetComponent <Bar>();

        if (bar)
        {
            foreach (BarSlot slot in bar.barSlotList)
            {
                PositionToggler ptglr = slot.GetComponent <PositionToggler>();
                if (ptglr != null)
                {
                    ptglr.Swap01();
                }
            }
        }
    }
示例#3
0
文件: Bar.cs 项目: euming/FotP
 public void SetState(int stateIdx)
 {
     curState = stateIdx;
     if (childBar != null)
     {
         childBar.SetState(curState);                //	sets the location of the bar underneath us.
     }
     //	sets the positions of the slots beneath us to match our current state
     foreach (BarSlot bs in barSlotList)
     {
         PositionToggler tglr = bs.GetComponent <PositionToggler>();
         if (tglr != null)
         {
             tglr.SetState(curState);
         }
     }
 }
示例#4
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        PositionToggler myScript = (PositionToggler)target;

        if (GUILayout.Button("Set Keyframe"))
        {
            myScript.SetKeyframe();
        }

        if (GUILayout.Button("Align xpos"))
        {
            myScript.AlignXpos();
        }

        if (GUILayout.Button("Test Toggle"))
        {
            myScript.ToggleNext();
        }

#if QUICKHACK_EDITS
        //	iTween bug keeps creating iTween components in editor
        if (GUILayout.Button("Remove itween components"))
        {
            myScript.RemoveITweenComponentsTree();
        }
        //	hack: do this automatically
        myScript.RemoveITweenComponents();
#endif
#if false       //	one time edit hack
        if (GUILayout.Button("Swap BarSlot PositionToggler 0 and 1"))
        {
            myScript.SwapBarSlotPositions();
        }
#endif
    }
示例#5
0
 void Start()
 {
     posToggler = GetComponent <PositionToggler>();
     posToggler.AddOnToggleCallback(this);
 }