28 lines
665 B
C#
28 lines
665 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class PlayerSetUp : MonoBehaviour
|
|||
|
{
|
|||
|
public GameObject PlayerPrefab;
|
|||
|
public float Speed = 1.0f;
|
|||
|
|
|||
|
private PlayerController pc;
|
|||
|
|
|||
|
void Awake()
|
|||
|
{
|
|||
|
if (GameObject.FindGameObjectWithTag("Player") == null)
|
|||
|
Instantiate(PlayerPrefab, transform.position, Quaternion.identity);
|
|||
|
}
|
|||
|
|
|||
|
private void Start()
|
|||
|
{
|
|||
|
if (PlayerPrefab.gameObject.GetComponent<PlayerController>())
|
|||
|
{
|
|||
|
pc = PlayerPrefab.gameObject.GetComponent<PlayerController>();
|
|||
|
pc.Speed = 2.0f;
|
|||
|
pc.Speed = Speed;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|