예제 #1
0
    public void Initiate()
    {
        StrategicPoint stratPoint = GetComponentInParent <StrategicPoint> ();

        Collider[] colliders = Physics.OverlapSphere(transform.position, searchRadius, LayerMask.GetMask(new string[] { "BuildingArea" }));
        foreach (Collider cL in colliders)
        {
            BuildingSlot bS        = cL.GetComponent <BuildingSlot> ();
            Vector3      disVector = cL.transform.position - transform.position;
            if (bS && !Physics.Raycast(transform.position, disVector.normalized, disVector.magnitude, LayerMask.GetMask(new string[] { "NavMesh" })))
            {
                buildingSlots.Add(bS);
                bS.Initiate(stratPoint);
            }
        }
        gameObject.SetActive(false);
    }