Pin
下面展示一些 内联代码片
。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Pin : MonoBehaviour
{
public float speed = 20f;
private Rigidbody2D rb;
private float ready;
private bool Isready=true;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.up * speed;
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.tag =="Rotator")
{
rb.velocity = Vector2.zero;
if (Random.Range(0f, 1f) > 0.5f)
{
if (col.GetComponent<Rotato>().speed > 0)
{
col.GetComponent<Rotato>().speed = -90;
}
else
{
col.GetComponent<Rotato>().speed *= -1;
}
}
else if (col<