Exemplo n.º 1
0
    protected void TraverseCells()
    {
        isMoving = true;

        animator.Play("Run");

        var cellCenter = movePath[cellIndex];

        if (!rotationSet)
        {
            Quaternion newRotation = Quaternion.Euler(transform.eulerAngles.x, directionToLook(cellCenter), transform.eulerAngles.z);
            transform.rotation = newRotation;
            rotationSet        = true;
        }

        Vector3 currentPosition = this.transform.position;

        if (Vector3.Distance(currentPosition, cellCenter) > .1f)
        {
            string direction = currentlyLooking();
            float  step      = moveSpeed * Time.deltaTime;

            transform.position = Vector3.MoveTowards(transform.position, cellCenter, step);
        }
        else
        {
            rotationSet = false;

            if (cellIndex < movePath.Count - 1)
            {
                cellIndex += 1;
            }
            else
            {
                animator.Play("Idle");

                cellIndex          = 0;
                movePath           = new List <Vector3>();
                transform.position = Vector3.Lerp(transform.position, cellCenter, 0.5f);

                Cell occupyingCell = TGSInterface.CellAtPosition(cellCenter);
                currentCellIndex = occupyingCell.index;

                int mask = TGSInterface.CELL_MASKS[EntityType.ToUpper()];
                tgs.CellSetGroup(occupyingCell.index, mask);

                isMoving = false;
                OnReachedDestination.Invoke();
            }
        }
    }
Exemplo n.º 2
0
    protected virtual void Awake()
    {
        BASE_STATS["HEALTH"]       = new Stat(healthStat);
        BASE_STATS["STRENGTH"]     = new Stat(strengthStat);
        BASE_STATS["SPEED"]        = new Stat(speedStat);
        BASE_STATS["SKILL"]        = new Stat(skillStat);
        BASE_STATS["MAGIC"]        = new Stat(magicStat);
        BASE_STATS["LUCK"]         = new Stat(luckStat);
        BASE_STATS["RESISTANCE"]   = new Stat(resistanceStat);
        BASE_STATS["DEFENSE"]      = new Stat(defenseStat);
        BASE_STATS["FOLLOW_UP"]    = new Stat(followupCritMultiplierStat);
        BASE_STATS["CONSTITUTION"] = new Stat(constitutionStat);
        BASE_STATS["MOVE"]         = new Stat(moveRadius);
        BASE_STATS["BIORHYTHM"]    = new Stat(biorhythmStat);

        if (canLead)
        {
            BASE_STATS["LEAD"] = new Stat(leadershipStat);
        }

        if (axeRank != "")
        {
            WEAPON_RANKS["AXE"] = Weapon.RANKS[axeRank];
        }
        if (swordRank != "")
        {
            WEAPON_RANKS["SWORD"] = Weapon.RANKS[swordRank];
        }
        if (lanceRank != "")
        {
            WEAPON_RANKS["LANCE"] = Weapon.RANKS[lanceRank];
        }
        if (grimioreRank != "")
        {
            WEAPON_RANKS["GRIMIORE"] = Weapon.RANKS[grimioreRank];
        }
        if (staffRank != "")
        {
            WEAPON_RANKS["STAFF"] = Weapon.RANKS[staffRank];
        }

        equippedWeapon.SetStats();
        currentCellIndex = TGSInterface.CellAtPosition(transform.position).index;
    }