コード例 #1
0
    // 전투
    // 적을 목표로 이동한다 (이동방향에 적이 있으면 공격한다)
    // 적이 없어지면 기본 상태로 돌아간다
    // 영웅 캐릭터는 체력이 한번에 2 이상 깎이면 도주 상태에 들어간다
    // 적 캐릭터도 도주 조건이 있을수도?
    // 적 캐릭터는 지정위치에서 일정이상 멀어지면 복귀 상태에 들어간다
    void Combat_NextTurn()
    {
        if (targetToCombat == null)
        {
            nextCondition = ConditionType.EXPLORE;
            return;
        }

        if (character.HP <= combarHPOnLastTurn - 2)
        {
            nextCondition   = ConditionType.RUNAWAY;
            targetToRunAway = new CharacterOrCoord(targetToCombat);
        }

        var targetCoord = Coord.Round(targetToCombat.transform.position);
        var dir         = curPathFinder.FindPath(character.coord, targetCoord);

        if (dir == Dir.Stay)
        {
            nextCondition = ConditionType.EXPLORE;
            return;
        }

        character.TryToMove(dir);
    }
コード例 #2
0
    public void TransferToCondition(ConditionType next)
    {
        character.condition = next;

        if (next != ConditionType.GATHER)
        {
            targetToGather = null;
        }
        if (next != ConditionType.COMBAT)
        {
            targetToCombat = null;
        }
        if (next != ConditionType.RUNAWAY)
        {
            targetToRunAway = null;
        }

        switch (next)
        {
        case ConditionType.PARALYZED:
            Paralyzed_OnEnter();
            return;

        case ConditionType.PANIC:
            Panic_OnEnter();
            return;
        }
    }
コード例 #3
0
 public void ForceRunAway(Coord from, int turns)
 {
     nextCondition   = ConditionType.RUNAWAY;
     targetToRunAway = new CharacterOrCoord(from);
     countdown       = turns;
 }