Exemplo n.º 1
0
    Vector2Int GetDirection()
    {
        if (currentIndex >= movementPattern.Count)
        {
            if (patternLoopType == PatternLoopType.loop)
            {
                currentIndex = 0;
            }
            else if (patternLoopType == PatternLoopType.pingPong)
            {
                patternDir   = -1;
                currentIndex = movementPattern.Count - 1;
            }
        }
        else if (currentIndex == -1)
        {
            if (patternLoopType == PatternLoopType.loop)
            {
                currentIndex = movementPattern.Count - 1;
            }
            else if (patternLoopType == PatternLoopType.pingPong)
            {
                currentIndex = 0;
                patternDir   = 1;
            }
        }

        return(GridUtility.DirToV2(movementPattern[currentIndex]));
    }
Exemplo n.º 2
0
    public override TurnInfo TakeTurn()
    {
        TurnInfo info = new TurnInfo(this);
        //check any objects that are here, and if they have playerInput (better player check?)
        //push em.
        List <GridElement> itemsHereNow = new List <GridElement>(gridElement.tileNode.itemsHere);

        //clone the list becuase we may modify it when we move things that are in the lsit
        foreach (GridElement ge in itemsHereNow)
        {
            if (ge.GetComponent <Agent>() != null)
            {
                Debug.Log("floor trap on " + ge.gameObject.name);
                ge.GetComponent <Agent>().Move(GridUtility.DirToV2(pushDirection), false);                //false is not using up a turn when pushing
            }
        }

        return(info);
    }