Exemple #1
0
    void Start()
    {
        Vector3           spawnPosition;
        GameObject        bot       = null;
        SteeringForArrive arriveCom = null;

        if (botPrefab == null)
        {
            return;
        }
        for (int i = 0; i < botCount; i++)
        {
            spawnPosition = new Vector3(Random.Range(minX, maxX), Yvalue, Random.Range(minZ, maxZ));
            bot           = Instantiate(botPrefab, spawnPosition, Quaternion.identity) as GameObject;

            if (bot != null)
            {
                arriveCom = bot.GetComponent <SteeringForArrive>();
            }

            if (arriveCom != null)
            {
                arriveCom.target = target;
            }
        }
    }
Exemple #2
0
 // Start is called before the first frame update
 void Start()
 {
     m_vehicle                    = GetComponent <Vehicle>();
     maxSpeed                     = m_vehicle.maxSpeed;
     isPlanar                     = m_vehicle.isPlanar;
     leaderVehicle                = leader.GetComponent <Vehicle>();
     arriveScript                 = GetComponent <SteeringForArrive>();
     arriveScript.target          = new GameObject("arriveTarget").transform;
     arriveScript.target.position = leader.transform.position;
 }
Exemple #3
0
    private void Start()
    {
        m_vehicle        = GetComponent <Vehicle>();
        maxSpeed         = m_vehicle.maxSpeed;
        IsPlanar         = m_vehicle.isPlanar;
        leaderController = leader.GetComponent <Vehicle>();

        //為抵達行為指定目標點
        arriveScript        = GetComponent <SteeringForArrive>();
        arriveScript.target = new GameObject("arriveTarget");
        arriveScript.target.transform.position = leader.transform.position;
    }
 void Start()
 {
     m_vehicle           = GetComponent <Vehicle>();
     maxSpeed            = m_vehicle.maxSpeed;
     isPlanar            = m_vehicle.isPlanar;
     leaderController    = leader.GetComponent <Vehicle>();
     arriveScript        = GetComponent <SteeringForArrive>();
     arriveScript.target = new GameObject("arriveTarget");
     //arriveScript.target = leader;
     arriveScript.target.transform.position = leader.transform.position;        //new Vector3(0,0,0);
     //randomOffset = new Vector3(0,0,0);//(Random.Range(0,3),Random.Range(0,3),Random.Range(0,3));
 }
 // Use this for initialization
 void Start()
 {
     aI = GetComponent <AILocomotion>();
     steeringForArrive = GetComponent <SteeringForArrive>();
 }