Exemple #1
0
    public Seal DisplaySeal(bool focused = false)
    {
        if (!isOwned || seal != null)
        {
            return(null);
        }

        GameObject sealPrefab = Resources.Load <GameObject>("Prefabs/Seal");
        GameObject anchorObj  = GameObject.Instantiate <GameObject>(sealPrefab, anchor.position, Quaternion.identity);

        anchorObj.transform.localScale = new Vector3(sealScale, sealScale, sealScale);
        seal = anchorObj.GetComponent <Seal>();
        if (!seal.Init(sigils.ToArray()))
        {
            Destroy(seal);
            return(null);
        }

        if (focused)
        {
            seal.Focus();
        }

        if (sigils.Count > 0)
        {
            seal.CreateCoreSigil(AspectResources.GetComponentMaterial(sigils[0]));
            for (int i = 1; i < sigils.Count; i++)
            {
                seal.CreateOrbitSigil(AspectResources.GetComponentMaterial(sigils[i]));
            }
        }

        return(seal);
    }
Exemple #2
0
    public bool Init(Sigil[] in_sigils)
    {
        Transform playTransform      = VRTK_DeviceFinder.PlayAreaTransform();
        float     distanceToPlayArea = Vector3.Distance(transform.position, playTransform.position);

        if (distanceToPlayArea > ActivateDistance)
        {
            return(false);
        }

        baseScale = transform.localScale.x;

        foreach (Sigil sigil in in_sigils)
        {
            sigils.Add(sigil);
        }

        SphereCollider collider = gameObject.AddComponent <SphereCollider>();

        collider.isTrigger = true;
        collider.radius    = 5f;

        sealComponents.Clear();

        CreateCenterAspect(AspectResources.GetComponentMaterial(Aspect.Ring));
        CreateCenterAspect(AspectResources.GetComponentMaterial(Aspect.Triangle));

        return(true);
    }
Exemple #3
0
    public void Focus()
    {
        if (focused)
        {
            return;
        }

        focused = true;
        SealComponent component = CreateComponent("Focus", AspectResources.GetComponentMaterial(Aspect.Circle_Runes));

        component.Spin(SealComponent.SpinDirection.EITHER, 0.1f, 1f);
    }
Exemple #4
0
    public void CreateOrbitSigil(Material mat)
    {
        float   offsetDegrees = Random.Range(0, Mathf.PI * 2);
        Vector3 orbitPosition = new Vector3(Mathf.Cos(offsetDegrees), Mathf.Sin(offsetDegrees), 0) * OrbitDistance;

        float orbitDegrees = CreateOrbitAspect(mat.name, orbitPosition, AspectResources.GetComponentMaterial(Aspect.Circle));

        SealComponent component = CreateComponent("OrbitSigil_" + mat.name, mat);

        component.transform.Rotate(Vector3.up, (Mathf.Rad2Deg * offsetDegrees) - 90);
        component.transform.localScale = Vector3.one / (1.68f * OrbitingScaleFactor);

        component.Orbit(orbitPosition, Vector3.zero, orbitDegrees);
    }