public GameObject AddPlayerSegment(GameObject objectToFollow)
    {
        // Spawn a new player segment.
        Vector3       spawnLocation        = objectToFollow.transform.position;
        Vector3       roundedSpawnLocation = new Vector3(Mathf.Round(spawnLocation.x), Mathf.Round(spawnLocation.y), Mathf.Round(spawnLocation.z));
        PlayerSegment playerSegment        = Instantiate(playerSegmentPrefab, roundedSpawnLocation, Quaternion.identity);

        playerSegment.Instantiate(objectToFollow);

        return(playerSegment.gameObject);
    }
Exemplo n.º 2
0
 private void Start()
 {
     player   = FindObjectOfType <PlayerMovement>();
     segment  = GetComponent <PlayerSegment>();
     canShoot = true;
 }