Exemplo n.º 1
0
        protected void Start()
        {
            radarModel = GetModelFromProvider <FieldOfViewModel>(radarModelProvider);
            sightModel = GetModelFromProvider <FieldOfViewModel>(sightModelProvider);

            cameraModel = Camera.main.GetComponent <CameraModel>();

            rootParent = transform.parent.gameObject;

            while (rootParent.transform.parent != null)
            {
                rootParent = rootParent.transform.parent.gameObject;
            }
        }
Exemplo n.º 2
0
        void OnSceneGUI()
        {
            FieldOfViewUnit  fow      = (FieldOfViewUnit)target;
            FieldOfViewModel fovModel = (FieldOfViewModel)fow.Model;

            foreach (FieldOfViewUnit unit in fovModel.units)
            {
                Handles.color = Color.yellow;
                if (unit != fow)
                {
                    Handles.DrawWireArc(unit.transform.position, Vector3.up, Vector3.forward, 360, unit.revealRadius);
                }
            }
            Handles.color = Color.white;
            Handles.DrawWireArc(fow.transform.position, Vector3.up, Vector3.forward, 360, fow.revealRadius);

            foreach (Transform target in fovModel.visibleTargets)
            {
                Handles.color = Color.red;

                Handles.DrawWireCube(target.transform.position, target.transform.localScale * 1.2f);
            }
        }