Exemplo n.º 1
0
    public void PickUp(PickUpTrigger pickedTrigger)
    {
        StartCoroutine(MoveMatToUI(pickedTrigger.transform));

        AudioManager.PlaySound(SoundType.GetMaterial);

        var matType = pickedTrigger.type;
        //var randomOffset = new Vector3(Random.Range(-0.15f, 0.15f), 0 ,Random.Range(-0.3f, 0.3f));
        var randomRotation = Quaternion.Euler(0, Random.Range(0, 90), 0);

        var position = matsParent.transform.position;

        if (materials.Count != 0)
        {
            var lastMat = materials[materials.Count - 1];
            position = lastMat.matGO.transform.position + Vector3.up * matSize;
        }

        // Debug.Log(randomOffset);
        var matGO = Instantiate(matPrefab, position, randomRotation, matsParent);

        materials.Add(new PickedUpBlock {
            matType = matType, matGO = matGO
        });
    }
Exemplo n.º 2
0
 protected override void Awake()
 {
     base.Awake();
     //Determines if it is an item
     pickUpTrigger = GetComponent <PickUpTrigger>();
     //Determines if it is a player
     playerScript = GetComponent <PlayerScript>();
 }