Example #1
0
    protected SingleEffect CreateRandomEffect(Transform targetTransform)
    {
        SingleEffect effect1 = ObjectRecycler.Singleton.GetObject <SingleEffect>(Random.Range(1, 2));

        effect1.transform.position = targetTransform.position - (targetTransform.position - transform.position) * 0.2f;
        effect1.transform.right    = transform.right;
        effect1.setTarget(targetTransform);
        effect1.gameObject.SetActive(true);

        if (effects.Length == 0)
        {
            return(null);
        }


        SingleEffect effect = ObjectRecycler.Singleton.GetObject <SingleEffect>(effects[Random.Range(0, effects.Length)]);

        effect.transform.position   = targetTransform.position - (targetTransform.position - transform.position) * 0.2f;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(targetTransform);
        effect.gameObject.SetActive(true);


        return(effect);
    }
Example #2
0
    public SingleEffect GetSingleEffect(int id, Transform target, Vector3 positionOffset)
    {
        SingleEffect effect = GetObject <SingleEffect>(id);

        effect.transform.position   = target.position + positionOffset;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(target);
        effect.gameObject.SetActive(true);


        return(effect);
    }
Example #3
0
    public SingleEffect GetSingleEffect(int id, Vector3 position)
    {
        SingleEffect effect = GetObject <SingleEffect>(id);

        effect.transform.position   = position;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(null);
        effect.gameObject.SetActive(true);


        return(effect);
    }
Example #4
0
    protected SingleEffect CreateEffect(Transform targetTransform, int index = 0)
    {
        if (index < 0 || index >= effects.Length)
        {
            return(null);
        }


        SingleEffect effect = ObjectRecycler.Singleton.GetObject <SingleEffect>(effects[index]);

        effect.transform.position   = targetTransform.position - (targetTransform.position - transform.position) * 0.2f;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(targetTransform);
        effect.gameObject.SetActive(true);


        return(effect);
    }