Beispiel #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.layer == LayerMask.NameToLayer("Ground"))
        {
            GameObject        scrapInstance = Instantiate <GameObject>(scrapPrefab, transform.position, Quaternion.identity);
            CollectFromGround script        = scrapInstance.GetComponent <CollectFromGround>();
            script.Init(character, distanceThreshold, acceleration);

            Destroy(gameObject);
        }
    }
Beispiel #2
0
 private void configurePrefab()
 {
     CollectFromGround script = scrapPrefab.GetComponent<CollectFromGround>();
     script.Init(character, distanceThreshold, acceleration);
 }