我有 2 个按钮“A”和“B”。单击按钮“A”时,我想更改C# 中按钮“B”脚本的颜色有帮助吗?
我有一个总点数的浮点数,它由计时器自动增加,但在总点数达到一定数量后,它似乎不再增加。我没有设置任何限制,所以我不确定为什么会发生这种情况。
因此,totalPoints 在达到“2097152”值时停止增加。
这是我的代码的一部分:
public float totalPoins;
void AccumulatePoints()
{
timer += Time.deltaTime * miningPowerValue;
if (timer > 1f)
{
totalPoints += someValue;
timer = 0;
}
}
Run Code Online (Sandbox Code Playgroud)
所以基本上它会根据挖矿PowerValue来累积积分。如果较低,积累速度会较慢,较高则积累速度较快。请帮忙。我很困惑。
我在 unity 2D 中使用此代码:
float nilaiRandom;
void Start()
{
nilaiRandom = Random.Range(1.11f, -1.88f);
transform.position = new Vector2(transform.position.x, nilaiRandom);
}
Run Code Online (Sandbox Code Playgroud)
Unity count 错误它说:Assets\Go.cs(14,23): error CS0104: 'Random' is an ambiguous reference between 'UnityEngine.Random' and 'System.Random'
我的团结实际上发生了什么,解决方案是什么?请帮我
我正在尝试声明一个字符串列表并向其添加 DateTime。但是,cannot convert from 'System.Collections.Generic.List<string>' to 'string'当我执行以下操作时出现错误:
public List<string> AllTime_ = new List<string>();
void Start () {
AllTime_.Add(Data.Select (d => DateTime.ParseExact (d, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture).ToString ("HH")).ToList ());
AllTime_.Add(Data.Select (d => DateTime.ParseExact (d, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture).ToString ("mm")).ToList ());
}
Run Code Online (Sandbox Code Playgroud)
但是当我通过声明如下所示的 List 来做同样的事情时,它不会抛出任何错误并且运行良好。唯一的问题是重新定义了列表并且列表的大小发生了变化。如何通过添加到列表来尝试解决问题的第一种方法?
public List<string> AllTime_ = new List<string>();
void Start () {
AllTime_ = new List<string> (Data.Select (d => DateTime.ParseExact (d, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture).ToString ("HH")).ToList ());
AllTime_ = new List<string> (Data.Select (d => DateTime.ParseExact (d, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.InvariantCulture).ToString ("mm")).ToList …Run Code Online (Sandbox Code Playgroud) 在我的游戏中,我有一个用于切换武器的脚本。该脚本依赖于gameObjects您所选择的激活和停用。截至目前,gameObjectsget 在 unity 中设置为非活动状态,但activeSelf无论实际状态如何,该函数都会返回 true。附上我的脚本的一部分。If 语句运行良好,我可以监视 中的状态Debug.Log。
这不应该发生,我不知道原因是什么。
我刚开始学习团结和游戏开发以及编码,今天才开始。我只是想让我的玩家加入WALK,但我遇到了我的第一个问题,我一直收到此错误消息,但是没有我的代码有任何错误的迹象(在我看来,这对您可能很明显),但我确实需要帮助
我尝试过许多不同的方法来重做它。我正在关注角色移动教程,但这是从2018年开始的另一版本的Visual Studio代码。
public class PlayerMovement : MonoBehaviour {};
public CharacterController2D controller;
Run Code Online (Sandbox Code Playgroud)
这是链接https://www.youtube.com/watch?v=dwcT-Dch0bA&t=341s我是一个非常新的人,所以如果您可以发送链接到一个有用的2D游戏设计教程,那将是非常棒的。
我正在使用3D老虎机。对于卷轴,我试图弄清楚如何计算X,Y,Z位置以及Y旋转以放置诸如樱桃,橘子等对象。总的来说,一共有28件。
我以为计算周长会有所帮助,但我不确定如何。