Beispiel #1
0
    public IEnumerator PlaybackQue()
    {
        if (shotTargets.Count > 0)
        {
            triangleLook.Target(shotTargets[0]);
        }

        GameObject trailClone = GameObject.Find("trailHolder(Clone)");

        trailClone.transform.parent = null;
        Destroy(GameObject.Find("GhostHolder(Clone)"));
        GetComponent <Rigidbody>().velocity = Vector3.zero;
        playingBack = true;
        StopCoroutine("Queueing");
        playerControl.canMove = false;
        int i        = 0;
        int numSteps = queuedStepList.Count;

        while (i <= numSteps - 1)
        {
            if (queuedStepList[i] == shootSignalVector)
            {
                triangleLook.Target(shotTargets[currentShotIterator]);

                yield return(new WaitForSeconds(delayWhileShooting / 2));

                playerAttack.Shoot(transform.position, shotTargets[currentShotIterator]);

                Destroy(placeholderLines[currentShotIterator].gameObject);
                yield return(new WaitForSeconds(delayWhileShooting / 2));

                currentShotIterator++;
                i++;
            }
            else
            {
                transform.position = queuedStepList[i];
                i++;
                yield return(new WaitForSeconds(stepDelay));
            }
        }

        Destroy(trailClone);
        queuedStepList.Clear();
        shotTargets.Clear();
        placeholderLines.Clear();
        currentShotIterator   = 0;
        playerControl.canMove = true;
        playingBack           = false;
        yield break;
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        Ray        cursorRay    = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit cursorRayHit = new RaycastHit();


        if (Physics.Raycast(cursorRay, out cursorRayHit, 1000f))
        {
            targetPos   = cursorRayHit.point;
            targetPos.y = 0f;

            if (Input.GetMouseButton(0))
            {
                attacks.Shoot(transform.position, targetPos);
            }
        }

        //	transform.LookAt(targetPos);
    }