// Start is called before the first frame update
 void Start()
 {
     //init all RTs and update the sizes
     CPUFOW       = WorldController._worldController.GetComponentInChildren <CPU_FOW>();
     DecalMat     = new Material(DecalMat);//instance the material
     DecalPro.Mat = DecalMat;
     ClearRT(ref DarkRT, true);
     ClearRT(ref LightRT, false);
     UpdateCamSizes();
 }
Beispiel #2
0
    void SelectObject(GameObject GO, SelectObjectFilter Filter = SelectObjectFilter.All, bool final = false)
    {
        SelectionData SD = new SelectionData();

        SD._Object = GO.GetComponent <SelectableObject>();
        if (!SD.IsValid())
        {
            SD._Object = GO.GetComponentInParent <SelectableObject>();
            if (!SD.IsValid())
            {
                return;
            }
        }
        SD._Worker  = GO.GetComponent <Worker>();
        SD._Vehicle = GO.GetComponent <Vehicle>();
        if (Filter == SelectObjectFilter.Workers)
        {
            if (!SD.IsWorker() && !SD.IsVehicle())
            {
                return;
            }
        }
        SD._Building = GO.GetComponentInParent <Building>();
        SD._Rock     = GO.GetComponentInParent <RockScript>();
        if (SD.ShouldBeCulled())
        {
            if (!CPU_FOW.Get().MultiSampleFOW(GO.transform.position, MSSampleDistance))
            {
                return;
            }
        }
        SD._Object.SetSelectionState(true);
        if (final && SD.IsWorker() && ShouldPlaySound())
        {
            SD._Worker.PlaySelectionSound();
        }
        if (final && SD.IsVehicle() && ShouldPlaySound())
        {
            SD._Vehicle.PlaySelectionSound();
        }
        CurrentSelectionObjects.Add(SD);
    }
Beispiel #3
0
    void ApplyOrderToTargetTile()
    {
        //prevent repeat!
        if (!IsHitValid())
        {
            return;
        }
        Tile t = null;

        try
        {
            t = _hit.transform.gameObject.GetComponentInParent <Tile>();
            if (t == null)
            {
                return;
            }
        }
        catch
        {
            return;
        }
        if (!CPU_FOW.Get().MultiSampleFOW(t.transform.position, MSSampleDistance))
        {
            return;
        }
        if (CurrentBrush == UnitTask.TaskType.Mine)
        {
            if (TryAddOrder(t, CurrentBrush))
            {
                TryAddOrder(t, UnitTask.TaskType.ClearRubble);
            }
        }
        else
        {
            TryAddOrder(t, CurrentBrush);
        }
    }
 private void Start()
 {
     Cam = Camera.main;
     FOW = CPU_FOW.Get();
 }
Beispiel #5
0
 // Start is called before the first frame update
 void Start()
 {
     FOW = CPU_FOW.Get();
 }