CY@
2016年12月30日 星期五
2016年12月23日 星期五
161223
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour {
Text mytxt00;
Text mytxt1;
Text mytxt3;
Text mytxt5;
Text mytxt7;
Text mytxt9;
Text mytxt11;
Text mytxt13;
Text mytxtx;
int mymoney1=100;
// Use this for initialization
void Start () {
mytxt00= GameObject.Find("Canvas/Panel/Text00").GetComponent<Text>();
mytxt1 = GameObject.Find ("Canvas/Panel/Text1").GetComponent<Text> ();
mytxt3 = GameObject.Find ("Canvas/Panel/Text3").GetComponent<Text> ();
mytxt5 = GameObject.Find ("Canvas/Panel/Text5").GetComponent<Text> ();
mytxt7 = GameObject.Find ("Canvas/Panel/Text7").GetComponent<Text> ();
mytxt9 = GameObject.Find ("Canvas/Panel/Text9").GetComponent<Text> ();
mytxt11 = GameObject.Find ("Canvas/Panel/Text11").GetComponent<Text> ();
mytxt13 = GameObject.Find ("Canvas/Panel/Text13").GetComponent<Text> ();
mytxtx = GameObject.Find ("Canvas/Panel/Textx").GetComponent<Text> ();
mytxtx.text =mymoney1.ToString ();
}
// Update is called once per frame
void Update () {
}
public void myfun()
{
int num=0,num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,num7=0;
num=Random.Range(0,8);
if (num == 0) {
num1 = 1;num2 = 0;num3 = 0;num4 = 0;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+1;
}
if (num == 1) {
num1 = 0;num2 = 1;num3 = 0;num4 = 0;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+5;
}
if (num == 2) {
num1 = 0;num2 = 0;num3 = 1;num4 = 0;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+10;
}
if (num == 3) {
num1 = 0;num2 = 0;num3 = 0;num4 = 1;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+25;
}
if (num == 4) {
num1 = 0;num2 = 0;num3 = 0;num4 = 0;num5 = 1;num6 = 0;num7 = 0;
mymoney1 = mymoney1+50;
}
if (num == 5) {
num1 = 0;num2 = 0;num3 = 0;num4 = 0;num5 = 0;num6 = 1;num7 = 0;
mymoney1 = mymoney1+100;
}
if (num == 6) {
num1 = 0;num2 = 0;num3 = 0;num4 = 0;num5 = 0;num6 = 0;num7 = 1;
mymoney1 = mymoney1+200;
}
mytxt00.text = num.ToString ();
mytxt1.text = num1.ToString ();
mytxt3.text = num2.ToString ();
mytxt5.text = num3.ToString ();
mytxt7.text = num4.ToString ();
mytxt9.text = num5.ToString ();
mytxt11.text = num6.ToString ();
mytxt13.text = num7.ToString ();
mytxtx.text =mymoney1.ToString ();
//Image img = GameObject.Find ("Image").GetComponent<Image> ();
//img.color = UnityEngine.Color.red;
//mytxt1.text =Random.Range(1,2).ToString();
//float translation = Time.deltaTime * 10;
}
public void myfun1()
{
mymoney1 = mymoney1 - 1;
}
public void myfun2()
{
mymoney1 = mymoney1 - 5;
}
public void myfun3()
{
mymoney1 = mymoney1 - 10;
}
public void myfun4()
{
mymoney1 = mymoney1 - 25;
}
public void myfun5()
{
mymoney1 = mymoney1 - 50;
}
public void myfun6()
{
mymoney1 = mymoney1 - 100;
}
public void myfun7()
{
mymoney1 = mymoney1 - 200;
}
}
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour {
Text mytxt00;
Text mytxt1;
Text mytxt3;
Text mytxt5;
Text mytxt7;
Text mytxt9;
Text mytxt11;
Text mytxt13;
Text mytxtx;
int mymoney1=100;
// Use this for initialization
void Start () {
mytxt00= GameObject.Find("Canvas/Panel/Text00").GetComponent<Text>();
mytxt1 = GameObject.Find ("Canvas/Panel/Text1").GetComponent<Text> ();
mytxt3 = GameObject.Find ("Canvas/Panel/Text3").GetComponent<Text> ();
mytxt5 = GameObject.Find ("Canvas/Panel/Text5").GetComponent<Text> ();
mytxt7 = GameObject.Find ("Canvas/Panel/Text7").GetComponent<Text> ();
mytxt9 = GameObject.Find ("Canvas/Panel/Text9").GetComponent<Text> ();
mytxt11 = GameObject.Find ("Canvas/Panel/Text11").GetComponent<Text> ();
mytxt13 = GameObject.Find ("Canvas/Panel/Text13").GetComponent<Text> ();
mytxtx = GameObject.Find ("Canvas/Panel/Textx").GetComponent<Text> ();
mytxtx.text =mymoney1.ToString ();
}
// Update is called once per frame
void Update () {
}
public void myfun()
{
int num=0,num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,num7=0;
num=Random.Range(0,8);
if (num == 0) {
num1 = 1;num2 = 0;num3 = 0;num4 = 0;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+1;
}
if (num == 1) {
num1 = 0;num2 = 1;num3 = 0;num4 = 0;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+5;
}
if (num == 2) {
num1 = 0;num2 = 0;num3 = 1;num4 = 0;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+10;
}
if (num == 3) {
num1 = 0;num2 = 0;num3 = 0;num4 = 1;num5 = 0;num6 = 0;num7 = 0;
mymoney1 = mymoney1+25;
}
if (num == 4) {
num1 = 0;num2 = 0;num3 = 0;num4 = 0;num5 = 1;num6 = 0;num7 = 0;
mymoney1 = mymoney1+50;
}
if (num == 5) {
num1 = 0;num2 = 0;num3 = 0;num4 = 0;num5 = 0;num6 = 1;num7 = 0;
mymoney1 = mymoney1+100;
}
if (num == 6) {
num1 = 0;num2 = 0;num3 = 0;num4 = 0;num5 = 0;num6 = 0;num7 = 1;
mymoney1 = mymoney1+200;
}
mytxt00.text = num.ToString ();
mytxt1.text = num1.ToString ();
mytxt3.text = num2.ToString ();
mytxt5.text = num3.ToString ();
mytxt7.text = num4.ToString ();
mytxt9.text = num5.ToString ();
mytxt11.text = num6.ToString ();
mytxt13.text = num7.ToString ();
mytxtx.text =mymoney1.ToString ();
//Image img = GameObject.Find ("Image").GetComponent<Image> ();
//img.color = UnityEngine.Color.red;
//mytxt1.text =Random.Range(1,2).ToString();
//float translation = Time.deltaTime * 10;
}
public void myfun1()
{
mymoney1 = mymoney1 - 1;
}
public void myfun2()
{
mymoney1 = mymoney1 - 5;
}
public void myfun3()
{
mymoney1 = mymoney1 - 10;
}
public void myfun4()
{
mymoney1 = mymoney1 - 25;
}
public void myfun5()
{
mymoney1 = mymoney1 - 50;
}
public void myfun6()
{
mymoney1 = mymoney1 - 100;
}
public void myfun7()
{
mymoney1 = mymoney1 - 200;
}
}
2016年12月15日 星期四
161216 黃綠紅
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Counter : MonoBehaviour {
int num;
double fMyWaitTime=3.0;
double WaitTimecount=0;
// Use this for initialization
void Start () {
num = 0;
}
// Update is called once per frame
void Update () {
Text mytxt=GameObject.Find("Text").GetComponent<Text>();
num = num + 1;
int countnum = num % 3;
mytxt.text =countnum.ToString();
WaitTimecount=0;
mywait ();
if (countnum==0)
{
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(1.0F, 0.0F, 0.0F, 1.0F);
}
if (countnum==1)
{
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(0.0F, 1.0F, 0.0F, 1.0F);
}
if (countnum==2)
{
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(1.0F, 1.0F, 0.0F, 1.0F);
}
}
void mywait()
{
while (WaitTimecount <= fMyWaitTime) {
//do stuff;
WaitTimecount = WaitTimecount + 0.01;
Debug.Log ( WaitTimecount );
}
}
}
using System.Collections;
using UnityEngine.UI;
public class Counter : MonoBehaviour {
int num;
double fMyWaitTime=3.0;
double WaitTimecount=0;
// Use this for initialization
void Start () {
num = 0;
}
// Update is called once per frame
void Update () {
Text mytxt=GameObject.Find("Text").GetComponent<Text>();
num = num + 1;
int countnum = num % 3;
mytxt.text =countnum.ToString();
WaitTimecount=0;
mywait ();
if (countnum==0)
{
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(1.0F, 0.0F, 0.0F, 1.0F);
}
if (countnum==1)
{
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(0.0F, 1.0F, 0.0F, 1.0F);
}
if (countnum==2)
{
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(1.0F, 1.0F, 0.0F, 1.0F);
}
}
void mywait()
{
while (WaitTimecount <= fMyWaitTime) {
//do stuff;
WaitTimecount = WaitTimecount + 0.01;
Debug.Log ( WaitTimecount );
}
}
}
--------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class bbb : MonoBehaviour {
int num;
double fMyWaitTime=3.0;
double WaitTimecount=0;
// Use this for initialization
void Start () {
num = 0;
}
// Update is called once per frame
void Update () {
Text mytxt=GameObject.Find("Text1").GetComponent<Text>();
num = num + 1;
int countnum = num % 3;
mytxt.text =countnum.ToString();
WaitTimecount=0;
mywait ();
if (countnum==0)
{
Image img = GameObject.Find ("Image2").GetComponent<Image> ();
img.color = new Color(0.0F, 0.0F, 0.0F, 1.0F);
}
if (countnum==1)
{
Image img = GameObject.Find ("Image2").GetComponent<Image> ();
img.color = new Color(0.0F, 1.0F, 0.0F, 1.0F);
}
if (countnum==2)
{
Image img = GameObject.Find ("Image2").GetComponent<Image> ();
img.color = new Color(0.0F, 0.0F, 0.0F, 1.0F);
}
}
void mywait()
{
while (WaitTimecount <= fMyWaitTime) {
//do stuff;
WaitTimecount = WaitTimecount + 0.01;
Debug.Log ( WaitTimecount );
}
}
}
-----------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ccc : MonoBehaviour {
int num;
double fMyWaitTime=3.0;
double WaitTimecount=0;
// Use this for initialization
void Start () {
num = 0;
}
// Update is called once per frame
void Update () {
Text mytxt=GameObject.Find("Text1").GetComponent<Text>();
num = num + 1;
int countnum = num % 3;
mytxt.text =countnum.ToString();
WaitTimecount=0;
mywait ();
if (countnum==0)
{
Image img = GameObject.Find ("Image3").GetComponent<Image> ();
img.color = new Color(0.0F, 0.0F, 0.0F, 1.0F);
}
if (countnum==1)
{
Image img = GameObject.Find ("Image3").GetComponent<Image> ();
img.color = new Color(0.0F, 0.0F, 0.0F, 1.0F);
}
if (countnum==2)
{
Image img = GameObject.Find ("Image3").GetComponent<Image> ();
img.color = new Color(1.0F, 1.0F, 0.0F, 1.0F);
}
}
void mywait()
{
while (WaitTimecount <= fMyWaitTime) {
//do stuff;
WaitTimecount = WaitTimecount + 0.01;
Debug.Log ( WaitTimecount );
}
}
}
2016年12月8日 星期四
161209
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public GameObject obj_Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
obj_Player = GameObject.Find("Capsule");
if (Input.GetKeyDown (KeyCode.A)) {
obj_Player.transform.position += new Vector3 (-0.1f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.D)) {
obj_Player.transform.position += new Vector3 (0.1f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.W)) {
obj_Player.transform.position += new Vector3 (0, 0, 0.1f);
} else if (Input.GetKeyDown (KeyCode.S)) {
obj_Player.transform.position += new Vector3 (0, 0, -0.1f);
}
}
}
using System.Collections;
public class Player : MonoBehaviour {
public GameObject obj_Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
obj_Player = GameObject.Find("Capsule");
if (Input.GetKeyDown (KeyCode.A)) {
obj_Player.transform.position += new Vector3 (-0.1f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.D)) {
obj_Player.transform.position += new Vector3 (0.1f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.W)) {
obj_Player.transform.position += new Vector3 (0, 0, 0.1f);
} else if (Input.GetKeyDown (KeyCode.S)) {
obj_Player.transform.position += new Vector3 (0, 0, -0.1f);
}
}
}
2016年12月1日 星期四
161202 轉圈圈哦
using UnityEngine;
public class ExampleClass : MonoBehaviour
{
void Update()
{
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(10*Vector3.up * Time.deltaTime);
// ...also rotate around the World's Y axis
transform.Rotate(Vector3.left * Time.deltaTime, Space.World);
}
}
-
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour
{
Vector3[] T = new Vector3[4];
// Use this for initialization
void Start()
{
T[0] = new Vector3(8f, -6.161964e-17f, 4f);
T[1] = new Vector3(-8f, -6.161964e-17f, 6f);
T[2] = new Vector3(-8f, -6.161964e-17f, -4f);
T[3] = new Vector3(8f, -6.161964e-17f, -6f);
}
int aa = 0;
// Update is called once per frame
void Update()
{
transform.position = Vector3.MoveTowards(transform.position, T[aa], 10 * Time.deltaTime);
if (transform.position == T[aa])
aa = (aa + 1) % 4;
}
}
2016年11月10日 星期四
20161111
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public GameObject obj_Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
obj_Player = GameObject.Find("Sphere");
if (Input.GetKeyDown (KeyCode.A)) {
obj_Player.transform.position += new Vector3 (-0.5f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.D)) {
obj_Player.transform.position += new Vector3 (0.5f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.W)) {
obj_Player.transform.position += new Vector3 (0, 0, 0.5f);
} else if (Input.GetKeyDown (KeyCode.S)) {
obj_Player.transform.position += new Vector3 (0, 0, -0.5f);
}
}
}
using System.Collections;
public class Player : MonoBehaviour {
public GameObject obj_Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
obj_Player = GameObject.Find("Sphere");
if (Input.GetKeyDown (KeyCode.A)) {
obj_Player.transform.position += new Vector3 (-0.5f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.D)) {
obj_Player.transform.position += new Vector3 (0.5f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.W)) {
obj_Player.transform.position += new Vector3 (0, 0, 0.5f);
} else if (Input.GetKeyDown (KeyCode.S)) {
obj_Player.transform.position += new Vector3 (0, 0, -0.5f);
}
}
}
2016年11月3日 星期四
161104
using System.Collections;
using UnityEngine.UI;
using System;
using System.Linq;
using System.Collections.Generic;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void myfun()
{
float rnum=0;
rnum=GameObject.Find("Slider2").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text2").GetComponent<Text>();
mytxt.text =rnum.ToString();
Image img = GameObject.Find ("Image2").GetComponent<Image> ();
img.color = new Color(rnum, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
public void myfunn()
{
float bnum = 0;
bnum=GameObject.Find("Slider").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text").GetComponent<Text>();
mytxt.text =bnum.ToString();
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(0,0,bnum,1); // (紅red,綠green,藍blue,透明)
}
public void myfunnn()
{
float gnum = 0;
gnum=GameObject.Find("Slider1").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text1").GetComponent<Text>();
mytxt.text =gnum.ToString();
Image img = GameObject.Find ("Image1").GetComponent<Image> ();
img.color = new Color(0,gnum,0,1); // (紅red,綠green,藍blue,透明)
}
public void myfunnnn()
{
float gnum = 0;
float bnum = 0;
float rnum = 0;
gnum=GameObject.Find("Slider1").GetComponent<Slider>().value;
Text mytxt1=GameObject.Find("Text1").GetComponent<Text>();
mytxt1.text =gnum.ToString();
bnum=GameObject.Find("Slider").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text").GetComponent<Text>();
mytxt.text =bnum.ToString();
rnum=GameObject.Find("Slider2").GetComponent<Slider>().value;
Text mytxt2=GameObject.Find("Text2").GetComponent<Text>();
mytxt2.text =rnum.ToString();
Image img = GameObject.Find ("Image3").GetComponent<Image> ();
img.color = new Color(rnum,gnum,bnum,1); // (紅red,綠green,藍blue,透明)
}
}
using UnityEngine.UI;
using System;
using System.Linq;
using System.Collections.Generic;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void myfun()
{
float rnum=0;
rnum=GameObject.Find("Slider2").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text2").GetComponent<Text>();
mytxt.text =rnum.ToString();
Image img = GameObject.Find ("Image2").GetComponent<Image> ();
img.color = new Color(rnum, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
public void myfunn()
{
float bnum = 0;
bnum=GameObject.Find("Slider").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text").GetComponent<Text>();
mytxt.text =bnum.ToString();
Image img = GameObject.Find ("Image").GetComponent<Image> ();
img.color = new Color(0,0,bnum,1); // (紅red,綠green,藍blue,透明)
}
public void myfunnn()
{
float gnum = 0;
gnum=GameObject.Find("Slider1").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text1").GetComponent<Text>();
mytxt.text =gnum.ToString();
Image img = GameObject.Find ("Image1").GetComponent<Image> ();
img.color = new Color(0,gnum,0,1); // (紅red,綠green,藍blue,透明)
}
public void myfunnnn()
{
float gnum = 0;
float bnum = 0;
float rnum = 0;
gnum=GameObject.Find("Slider1").GetComponent<Slider>().value;
Text mytxt1=GameObject.Find("Text1").GetComponent<Text>();
mytxt1.text =gnum.ToString();
bnum=GameObject.Find("Slider").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("Text").GetComponent<Text>();
mytxt.text =bnum.ToString();
rnum=GameObject.Find("Slider2").GetComponent<Slider>().value;
Text mytxt2=GameObject.Find("Text2").GetComponent<Text>();
mytxt2.text =rnum.ToString();
Image img = GameObject.Find ("Image3").GetComponent<Image> ();
img.color = new Color(rnum,gnum,bnum,1); // (紅red,綠green,藍blue,透明)
}
}
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public GameObject obj_Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
obj_Player = GameObject.Find("Sphere");
if (Input.GetKeyDown (KeyCode.A)) {
obj_Player.transform.position += new Vector3 (-0.5f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.D)) {
obj_Player.transform.position += new Vector3 (0.5f, 0, 0);
} else if (Input.GetKeyDown (KeyCode.W)) {
obj_Player.transform.position += new Vector3 (0, 0, 0.5f);
} else if (Input.GetKeyDown (KeyCode.S)) {
obj_Player.transform.position += new Vector3 (0, 0, -0.5f);
}
}
}
訂閱:
文章 (Atom)