Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     // Take the current position = new position (0,0,0);
     transform.position = new Vector3(0, 0, 0);
     _spawnManager      = GameObject.Find("Spawn_manager").GetComponent <SpawnManager>();
     _manager           = GameObject.Find("Canvas").GetComponent <UI_manager>();
     laserSource        = GetComponent <AudioSource>();
     _anim = GetComponent <Animator>();
     if (_spawnManager == null)
     {
         Debug.LogError("SpawnManager is null");
     }
     if (_manager == null)
     {
         Debug.LogError("Manager is null");
     }
     if (laserSource == null)
     {
         Debug.LogError("audiosource is null");
     }
     else
     {
         laserSource.clip = laserClip;
         //explosionSource.clip = explosionClip;
         //powerupSource.clip = explosionClip;
     }
 }
Beispiel #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    void PickUp(Collider2D player)
    {
        UI_manager ui = player.GetComponent <UI_manager>();

        ui.UpdateScore(playerScore);
        Destroy(gameObject);
        Debug.Log("Picked Up");
    }
Beispiel #4
0
 private void Awake()
 {
     if (manager_instance == null)
     {
         manager_instance = this;
     }
     else if (manager_instance != this)
     {
         Destroy(this);
     }
     DontDestroyOnLoad(gameObject);
 }
Beispiel #5
0
    void Start()
    {
        transform.position = new Vector3(0, -2, 0);
        _spawnManager      = GameObject.Find("Spawn_manager").GetComponent <SpawnManager>();
        _uiManager         = GameObject.Find("Canvas").GetComponent <UI_manager>();

        if (_spawnManager == null)
        {
            Debug.Log("SpawnManager is NULL.");
        }
        if (_uiManager == null)
        {
            Debug.Log("UIManager is NULL");
        }
    }
Beispiel #6
0
    // Start is called before the first frame update
    void Start()
    {
        _Manager    = GameObject.Find("Canvas").GetComponent <UI_manager>();
        rigidbody   = GetComponent <Rigidbody2D>();
        randomValue = Random.Range(1, 4);
        health      = health * randomValue;
        Vector3 localScale = transform.localScale;

        localScale          *= randomValue;
        localScale.x        *= -direction;
        transform.localScale = localScale;

        speed                = Random.Range(4, 6);
        savedSpeed           = speed;
        animator             = GetComponent <Animator>();
        transform.localScale = localScale;
    }
 private void Start()
 {
     _uiManager = GameObject.Find("Canvas").GetComponent <UI_manager>();
 }
 void Awake()
 {
     S = this;
 }