Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (agent.enabled && !isFighter)
        {
            transform.forward = -(target - transform.position);
            agent.SetDestination(target);
            if (Vector3.Distance(target, transform.position) < 1.5f)
            {
                //target has reached its destination and must start building
                anim.SetBool("isBuilding", true);
                agent.enabled = false;
            }
        }

        if (isBuilding)
        {
            timeMachine.Build();
        }
    }