unity c# 改变物体贴图,颜色,透明度,缩放,碰撞检测
using UnityEngine;
using UnityEngine.UI;
using System;
using Color = UnityEngine.Color;
public class Danbscontro : MonoBehaviour
{
public Texture linetype1;
public Texture linetype2;
public Texture linetype3;
public Texture linetype4;
public Texture linetype5;
public GameObject GOBJDanBoShu;
public GameObject GOBJDanBoShuHbo;
float f_alpha=1;
float f_range;
void Start()
{
transform.GetComponent<InputField>().onEndEdit.AddListener(AlphaEnd_Value);
transform.GetComponent<InputField>().onEndEdit.AddListener(RangeEnd_Value);
}
private void Update()
{
anim.speed = 1f;
}
public void GetTypeValue(int i)
{
switch (i)
{
case 0:
GOBJDanBoShu.GetComponent<Renderer>().material.mainTexture = linetype1;
GOBJDanBoShuHbo.GetComponent<Renderer>().material.mainTexture = linetype1;
break;
case 1:
GOBJDanBoShu.GetComponent<Renderer>().material.mainTexture = linetype2;
GOBJDanBoShuHbo.GetComponent<Renderer>().material.mainTexture = linetype2