2014年9月21日 星期日

物件導向 2014/09/19

一、button1 &button2


程式內容

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 上課習題
{
    public partial class Form1 : Form
    {
        int a = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("尚未完成");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            a+=1;
            if (a % 2 == 1)
            {
                button1.Location = new Point(250, 250);
            }
            else if(a%2==0)
            {
                button1.Location = new Point(47, 40);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}


二、Cube 跑動

程式內容

using UnityEngine;
using System.Collections;

public class move : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
transform.Translate(Time.deltaTime, Time.deltaTime, 0);
}
}

沒有留言:

張貼留言