Example #1
0
 public void BindNodeWithAction(HeroActionEvent action)
 {
     nodeRequest((Node theNode) =>
     {
         action.GetHeroActionInfo().GiveNode(theNode);
     });
 }
    public HeroActionEvent Clone()
    {
        HeroActionEvent clone = (MemberwiseClone() as HeroActionEvent);

        clone.PostCloneCleanup();
        return(clone);
    }
    void Update()
    {
        transform.position = Input.mousePosition;


        if (tempList.pointerListener.isIn)
        {
            int c = GetIndexInTempList();

            GetEmptySpot().transform.SetParent(tempList.container);
            GetEmptySpot().transform.SetSiblingIndex(c);
        }
        else if (loopList.pointerListener.isIn)
        {
            int c = GetIndexInLoopList();

            GetEmptySpot().transform.SetParent(loopList.container);
            GetEmptySpot().transform.SetSiblingIndex(c);
        }

        if (Input.GetMouseButtonDown(1))
        {
            //Cancel
            Close();
        }
        else if (Input.GetMouseButtonDown(0))
        {
            if (tempList.pointerListener.isIn)
            {
                int c = GetIndexInTempList();

                HeroActionEvent action = DeliveredEvent();

                hb.AddTemporaryActionAt(action, c);

                if (action.GetHeroActionInfo().RequiresNode())
                {
                    display.BindNodeWithAction(action);
                }

                Close();
            }
            else if (loopList.pointerListener.isIn)
            {
                int c = GetIndexInLoopList();

                HeroActionEvent action = DeliveredEvent();

                hb.AddActionAt(action, c);

                if (action.GetHeroActionInfo().RequiresNode())
                {
                    display.BindNodeWithAction(action);
                }

                Close();
            }
        }
    }
    public void ShowAndFill(HeroActionEvent clone)
    {
        actionClone = clone;

        gameObject.SetActive(true);
        displayText.text = clone.GetHeroActionInfo().GetDisplayName();
        SetColor(clone.GetHeroActionInfo().GetNodeColor());
    }
Example #5
0
 public virtual void ExecuteAll()
 {
     if (characterActions.Count <= 0)
     {
         return;
     }
     currentAction = characterActions[0];
     currentAction.Execute(hero, ReadyForNextAction);
 }
Example #6
0
    protected virtual void ExecuteNextTemporaryAction()
    {
        if (temporaryCharacterActions.Count < 1)
        {
            return;
        }

        currentTemporaryAction = temporaryCharacterActions[0];
        currentTemporaryAction.Execute(hero, ReadyForNextTemporaryAction);
    }
Example #7
0
    public virtual void RemoveActionFromTemporaryList(HeroActionEvent theAction)
    {
        theAction.ForceCompletion();
        temporaryCharacterActions.Remove(theAction);

        if (onTemporaryListChange != null)
        {
            onTemporaryListChange();
        }
    }
Example #8
0
    public virtual void RemoveActionFromLoopList(HeroActionEvent theAction)
    {
        theAction.ForceCompletion();
        characterActions.Remove(theAction);

        if (onListChange != null)
        {
            onListChange.Invoke();
        }
    }
Example #9
0
    public void ShowAndFill(HeroActionEvent action)
    {
        this.action = action;
        gameObject.SetActive(true);

        //Remplir information
        displayName.text = action.GetHeroActionInfo().GetDisplayName();

        SetColor(action.GetHeroActionInfo().GetNodeColor());
    }
    public void Fill(HeroBehaviorDisplay display, HeroBehavior hb, HBD_ActionList tempList, HBD_ActionList loopList, HBD_Action action)
    {
        existingAction = action.action;
        this.loopList  = loopList;
        this.tempList  = tempList;
        this.display   = display;
        this.hb        = hb;
        createNew      = false;

        SharedFill();
    }
    public void Fill(HeroBehaviorDisplay display, HeroBehavior hb, HBD_ActionList tempList, HBD_ActionList loopList, HBD_TemplateAction templateAction)
    {
        existingAction = templateAction.actionClone;
        this.loopList  = loopList;
        this.tempList  = tempList;
        this.display   = display;
        this.hb        = hb;
        createNew      = true;

        SharedFill();
    }
Example #12
0
    public virtual void AddTemporaryAction(HeroActionEvent newAction)
    {
        temporaryCharacterActions.Add(newAction);
        if (temporaryCharacterActions.Count <= 1)
        {
            readyForNext = true;
        }

        if (onTemporaryListChange != null)
        {
            onTemporaryListChange();
        }
    }
Example #13
0
    public virtual void AddActionAt(HeroActionEvent newAction, int index)
    {
        characterActions.Insert(index, newAction);
        if (characterActions.Count <= 1)
        {
            readyForNext = true;
        }

        if (onListChange != null)
        {
            onListChange.Invoke();
        }
    }
Example #14
0
    public virtual void MoveTemporaryAction(HeroActionEvent actionToMove, int position)
    {
        if (position > temporaryCharacterActions.Count || position < 0)
        {
            return;
        }
        temporaryCharacterActions.Insert(position, actionToMove);

        if (onTemporaryListChange != null)
        {
            onTemporaryListChange.Invoke();
        }
    }
Example #15
0
    public virtual void AddAction(HeroActionEvent newAction)
    {
        characterActions.Add(newAction);
        if (characterActions.Count <= 1)
        {
            readyForNext = true;
        }

        if (onListChange != null)
        {
            onListChange.Invoke();
        }
    }
Example #16
0
    protected virtual void ExecuteNext()
    {
        if (temporaryCharacterActions.Count > 0)
        {
            ExecuteNextTemporaryAction();
            return;
        }

        if (characterActions.Count <= characterActions.FindIndex(IsCurrentAction) + 1)
        {
            if (looping)
            {
                ExecuteAll();
            }
            return;
        }
        currentAction = characterActions[characterActions.FindIndex(IsCurrentAction) + 1];
        currentAction.Execute(hero, ReadyForNextAction);
    }
Example #17
0
    public virtual void AddTemporaryActionAt(HeroActionEvent newAction, int index)
    {
        //...
        //print("insert at: " + index);
        temporaryCharacterActions.Insert(index, newAction);

        if (temporaryCharacterActions.Count <= 1)
        {
            readyForNext = true;
        }

        if (index == 0)
        {
            readyForNext = true;
            ExecuteNextTemporaryAction();
        }

        if (onTemporaryListChange != null)
        {
            onTemporaryListChange.Invoke();
        }
    }
Example #18
0
 protected virtual bool IsCurrentAction(HeroActionEvent action)
 {
     return(action == currentAction);
 }
Example #19
0
 protected virtual bool IsCurrentSpecialAction(HeroActionEvent action)
 {
     return(action == currentTemporaryAction);
 }