Пример #1
0
    public void Move()
    {
        if (path.Count > 0)
        {
            tutTile t      = path.Peek();
            Vector3 target = t.transform.position;

            //target.y += halfHeight + t.GetComponentInChildren<Collider>().bounds.extents.y; // Needed incase we have multi sized tiles otherwise we would cache it
            target.y += .25f;

            //All we need if no jumping/falling // Jumping part starts at 14:00 in section 4
            if (Vector3.Distance(transform.position, target) >= 0.25f)
            {
                CalculateHeading(target);
                SetHorizontalVelocity();

                transform.forward   = heading;
                transform.position += velocity * Time.deltaTime;
            }
            else
            {
                //Tile center reached
                transform.position = target;
                path.Pop();
            }
        }
        else
        {
            RemoveSelectableTiles();
            moving = false;
            unitAttack.BeginActionPhase();
        }
    }