Recently playing plants vs Zombie ol hit Zombie Maze, played a 700-point countdown first, rub ... As the saying goes, failure is a successful mother, so took a little time to write a small thing, I believe next time I will be able to take the first
The code is simple:
usingUnityengine;usingSystem.Collections;usingUnityengine.ui; Public classMyscript:monobehaviour {//Use this for initialization voidStart () {}//Update is called once per frame voidUpdate () {if(Input.getkeyup (Keycode.leftarrow)) {button_left ();//Call left } if(Input.getkeyup (Keycode.rightarrow)) {button_regith ();//invoke right-click } if(Input.getkeyup (keycode.space)) {foreach(Image Iinch_nimage) {i.getcomponent<Button> (). interactable =true; } } } PublicImage _allimage;//Storing parent Objects Publicimage[] _nimage; Public voidButton_left () {_allimage.transform.rotate (0,0, -);//Rotate Parent Object_allimage.transform.localscale =NewVector3 (_allimage.transform.localscale.y, _allimage.transform.localscale.x, _allimage.transform.localscale.z);//long and wide interchange } Public voidButton_regith () {_allimage.transform.rotate (0,0, - -); _allimage.transform.localscale=NewVector3 (_allimage.transform.localscale.y, _allimage.transform.localscale.x, _allimage.transform.localscale.z ); } Public voidButton_initialize (intTemp//button Discoloration{_nimage[temp]. Getcomponent<Button> (). interactable =false; } Public voidButton_enable ()//reset Button Color { foreach(Image Iinch_nimage) {i.getcomponent<Button> (). interactable =true; } } Public voidbutton_scene1 () {screen.setresolution ( the, -,false);//screen size is 1280,800, window } Public voidButton_scene2 () {screen.setresolution (640, -,false);//screen size is 640,400, window } Public voidButton_scene3 () {screen.setresolution (480, -,false);//screen size is 480,300, window } Public voidbutton_scene4 () {screen.setresolution ( the, $,false);//screen size is 320,200, window }}
Project case: Link: http://pan.baidu.com/s/1mhvDVwW Password: qm5b
98 Plants vs Zombies Ol_ Zombie Maze