c# - 我希望我的对象自动出现而不增加他的比例
问题描述
我希望我的对象自动出现而不增加他的比例,只是出现随机的地方而不是与硬币碰撞(就像被叠加)。这是硬币的生成器:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Object_Spawner : MonoBehaviour
{
public GameObject player;
public GameObject[] coins;
private float coinSpawnTimer = 1.0f;
// Update is called once per frame
void Update()
{
coinSpawnTimer -= Time.deltaTime;
if (coinSpawnTimer < 0.01)
{
SpawnCoins();
}
}
void SpawnCoins()
{
Instantiate(coins[(Random.Range(0, coins.Length))], new Vector3(player.transform.position.x + 30, Random.Range(2, 8), 0), Quaternion.identity);
coinSpawnTimer = Random.Range(1.0f, 3.0f);
}
}
解决方案
推荐阅读
- r - 在 R Shiny 中动态创建表时出错
- python - 通过 pip 安装 pygame
- swift - Swift 中的 UiSearchController 到 UiCollectionView
- opencv - opencv决策树回归,预测看不见的反应?
- azure-servicebusrelay - Azure Servicebus WCF 中继,地址已被具有不同设置的现有侦听器使用
- c# - 插入/删除/插入导致跟踪错误
- jquery - 使用 Bootstrap 3.3.7 将嵌入式 div 推送到其祖父母下方
- android - 根据移动设备 ID 对用户进行身份验证
- python - Statsmodels plot_simultaneous comparriosn_name 不起作用
- tensorflow - 预训练张量流神经网络模型