// Use this for initialization
    void Start()
    {
        if (currentTarget == null)
        {
            GameObject newTarget = GameObject.CreatePrimitive(PrimitiveType.Cube);
            currentTarget = newTarget.AddComponent <TargetDebug>();
            currentTarget.RepositionCurrentTargetTo(Vector3.zero);
        }

        currentTarget.posChangeEvent += TargetPositionUpdate;

        characterController = GetComponent <CharacterController>();
        lineRenderer        = GetComponent <LineRenderer>();
        lineRenderer.SetPosition(0, currentTarget.transform.position);
        currentAngle = Vector3.SignedAngle(Vector3.forward, transform.position, Vector3.up);
    }
Example #2
0
    public void AddTarget(TargetDebug target)
    {
        GameObject     go = Instantiate(Resources.Load <GameObject>("Prefabs/Particles/UI Particles/TrackedTarget"), Vector3.zero, Quaternion.identity, xform);
        ParticleSystem ps = go.GetComponent <ParticleSystem>();

        ParticleSystem.MainModule main = ps.main;
        main.simulationSpace       = ParticleSystemSimulationSpace.Custom;
        main.customSimulationSpace = xform;

        TargetTracker newTarget;

        newTarget.target           = target;
        newTarget.UIParticleSystem = go;

        targets.Add(newTarget);
    }
Example #3
0
    public void RemoveTarget(TargetDebug target)
    {
        TargetTracker removeTT = new TargetTracker();
        GameObject    removeGO = null;
        bool          found    = false;

        foreach (TargetTracker tt in targets)
        {
            if (tt.target == target)
            {
                found    = true;
                removeGO = tt.UIParticleSystem;
                removeTT = tt;
            }
        }
        if (removeGO)
        {
            targets.Remove(removeTT);
            StartCoroutine("DestroyObject", removeGO);
        }
    }
    // Use this for initialization
    public void OnEnable()
    {
        positions = new Vector3[] { Vector3.zero, new Vector3(2, 0, 2), new Vector3(2, 0, -2), new Vector3(-2, 0, -2), new Vector3(-2, 0, 2) };

        targetDebug = serializedObject.targetObject as TargetDebug;
    }