summaryrefslogtreecommitdiff
path: root/AlienSurvival/Assets/Test/Scripts/TestBucket.cs
blob: 010df5e959510048f25b7b08eb630d19b0396342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestBucket : MonoBehaviour
{
	[SerializeField] private TestBrokenPiece m_Piece;

	private TestFakeHeight m_Coord;

	private void Awake()
	{
		m_Coord = GetComponent<TestFakeHeight>();
	}

	public void Broken()
	{
		for(int i  = 0; i < 10; ++i)
		{
			TestBrokenPiece piece = Instantiate<TestBrokenPiece>(m_Piece);
			piece.Set(m_Coord.position + new Vector3(0,0,1f), 
				new Vector3(Random.Range(-1f,1f), Random.Range(-1f, 1f), Random.Range(0.5f, 2f)).normalized, Random.Range(1f, 3f)
				, i);
		}

		this.gameObject.SetActive(false);
		Destroy(this.gameObject);
	}

    // Update is called once per frame
    void Update()
    {
        
    }
}