summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Test/TestBucket.cs
blob: c3e28f4c6107949c8084b1d70f72f75688c0711a (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 TopDownTransform m_Coord;

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

	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()
    {
        
    }
}