1234567891011121314151617181920212223242526272829 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CoinManagement : MonoBehaviour
- {
- public GameObject coin = null;
- // Start is called before the first frame update
- void Start()
- {
- Vector3 start = new Vector3(298.9206f, 0.5000005f, -0.1749458f);
- Vector3 finish = new Vector3(400f, 0.5000005f, -0.1749458f);
- PlaceCoins(start, finish, 20);
- }
- // Update is called once per frame
- void Update()
- {
- }
- void PlaceCoins(Vector3 start, Vector3 finish, float number)
- {
- float space = System.Math.Abs(start.x - finish.x)/number;
- for (int i=0; i < number; ++i)
- {
- Instantiate(coin, new Vector3(start.x + i*space, start.y, start.z), Quaternion.Euler(0f, 0f, 90f));
- }
- }
- }
|