using UnityEngine;

using System.Collections;


public class Shoot : MonoBehaviour {

public float Power = 60.0f;

public GameObject ballPrefab;


// Update is called once per frame

void Update () {

if(Input.GetButtonDown("Fire1"))

{

GameObject newBall = (GameObject)Instantiate(ballPrefab,transform.position , Quaternion.identity);  //with gravity and rigidbody

newBall.rigidbody.velocity = transform.rotation * Vector3.right * Power;

}

}

}


 


'유니티3D > 예제' 카테고리의 다른 글

PopUpButton.cs  (0) 2013.09.11
2DGameScripts  (0) 2013.09.10
UpDownRotate  (0) 2013.09.03
StreetLight.cs  (0) 2013.08.26
gamemanagel.cs  (0) 2013.08.26


using UnityEngine;

using System.Collections;


public class UpDownRotate : MonoBehaviour {

public float rotateSpeed = 60.0f;


// Update is called once per frame

void Update () {

float v = Input.GetAxis("Vertical");

float currentAngle = transform.eulerAngles.z;

currentAngle += v *rotateSpeed * Time.deltaTime;

currentAngle = Mathf.Clamp(currentAngle,0f,90f);   //limit value

transform.rotation = Quaternion.Euler(Vector3.forward * currentAngle);

}

}

 


'유니티3D > 예제' 카테고리의 다른 글

2DGameScripts  (0) 2013.09.10
Shoot  (0) 2013.09.03
StreetLight.cs  (0) 2013.08.26
gamemanagel.cs  (0) 2013.08.26
powercell.cs  (0) 2013.08.26

#include<stdio.h>


int main(void)

{

int i;

int k;

int input;



printf("시작단수를 입력하시오 : ");

scanf(" %d",&input);

for(k= input; k <10 ; k++){


for(i= 1; i <10 ; i++)

{

printf("%d x %d = %d\n",k,i,k*i);

}


printf("\n");

}


}



'C' 카테고리의 다른 글

C언어 자주쓰는 함수  (0) 2013.10.21
Visual Studio 단축키  (0) 2013.10.01

using UnityEngine;

using System.Collections;


public class StreetLight : MonoBehaviour {


public Light streetLight;

public AudioClip LightSound;

void OnTriggerEnter(Collider hit)  //catch conflict without phishical effet!

{

if(hit.gameObject.tag == "Player")

{

audio.PlayOneShot(LightSound,1.0f);

streetLight.light.enabled = true;

}

}

void OnTriggerExit(Collider hit)  //catch conflict without phishical effet!

{

if(hit.gameObject.tag == "Player")

{

audio.PlayOneShot(LightSound,1.0f);

streetLight.light.enabled = false;

}

}

}


'유니티3D > 예제' 카테고리의 다른 글

Shoot  (0) 2013.09.03
UpDownRotate  (0) 2013.09.03
gamemanagel.cs  (0) 2013.08.26
powercell.cs  (0) 2013.08.26
wall.cs  (0) 2013.08.26

+ Recent posts