示例#1
0
    public List <Directions> GetMoveDirections()
    {
        List <Directions> moveActions = new List <Directions>();

        for (int i = 0; i < actionList.Count; i++)
        {
            if (actionList[i].GetComponent <MoveAction>())
            {
                moveActions.Add(actionList[i].GetComponent <MoveAction>().GetDirection());
            }

            else if (actionList[i].GetComponent <RepeatAction>())
            {
                RepeatAction repeatAction = actionList[i].GetComponent <RepeatAction>();
                for (int k = 0; k < repeatAction.TimesRepeating; k++)
                {
                    //moveActions.Add(repeatAction.GetMoveActions()[k].GetDirection());
                    for (int j = 0; j < repeatAction.GetMoveActions().Count; j++)
                    {
                        moveActions.Add(repeatAction.GetMoveActions()[j].GetDirection());
                    }
                }
            }
        }

        return(moveActions);
    }
示例#2
0
    public void OnDrop(PointerEventData eventData)
    {
        if (eventData.pointerDrag.GetComponent <Action>())
        {
            eventData.pointerDrag.transform.SetParent(transform);

            if (emptyGameObject)
            {
                eventData.pointerDrag.transform.SetSiblingIndex(emptyGameObject.transform.GetSiblingIndex());
                Destroy(emptyGameObject);
                repeatAction.GetMoveActions().Insert(eventData.pointerDrag.transform.GetSiblingIndex(), eventData.pointerDrag.GetComponent <MoveAction>());
                eventData.pointerDrag.GetComponent <Action>().assigned         = true;
                eventData.pointerDrag.GetComponent <Action>().repeatActionList = this;
            }
        }
    }