Exemplo n.º 1
0
    void OnDrawGizmos()
    {
        List <Vector3> positions = FibonacciSphere.GeneratePoints(numberFlares, radius);

        foreach (Vector3 v in positions)
        {
            Gizmos.color = Color.red;
            Gizmos.DrawSphere(v, 0.01f);
        }
    }
Exemplo n.º 2
0
    private void ActivatePrimitives()
    {
        var points = FibonacciSphere.Sample((uint)Primitives.Count);

        for (var i = 0; i < Primitives.Count; i++)
        {
            var ps = Primitives[i].GetComponent <PointingSwarm>();
            ps.SetInteractRange(InteractRange);
            ps.OffsetTarget       = points[i];
            ps.DistanceFromTarget = DistanceFromTarget;
            ps.SetActive(true);
        }
    }
Exemplo n.º 3
0
    protected override void RepositionPrimitives()
    {
        var points = FibonacciSphere.Sample((uint)Primitives.Count);

        for (var i = 0; i < Primitives.Count; i++)
        {
            var ps = Primitives[i].GetComponent <PointingSwarm>();
            ps.transform.position = transform.position + points[i] * DistanceFromTarget;
            ps.transform.LookAt(transform.position);
            ps.GetComponent <PointingSwarm>().SetIdleLootAtTarget(transform.position);
            RpcSetLocation(ps.GetComponent <NetworkIdentity>(), ps.transform.position, transform.position);
        }

        UpdateInteractRange();
    }
Exemplo n.º 4
0
    IEnumerator SpawnParticles()
    {
        positions = FibonacciSphere.GeneratePoints(numberFlares, radius - 0.025f);
        float currentFlares = 0f;

        foreach (Vector3 p in positions)
        {
            currentFlares++;
            Quaternion rotation      = Quaternion.LookRotation(-p, Vector3.up);
            GameObject flareInstance = Instantiate(flarePrefab, p, rotation);
            flareInstance.transform.parent = gameObject.transform;

            yield return(new WaitForSeconds(delaySeconds));
        }
    }
Exemplo n.º 5
0
 void Start()
 {
     planet = GameObject.Find("Planet").GetComponent <FibonacciSphere>();
 }