Debug.Log ("Log Info");

Debug.LogWarning("Log Waring");

Debug.LogError("Log Error")


using UnityEngine;

using System.Collections;


public class script : MonoBehaviour {

public GameObject[] Robot;

int HP;

// Use this for initialization

void Start () {

GameObject robot = GameObject.FindGameObjectWithTag("Sphere");

robot.SetActive(false);

}

// Update is called once per frame

void Update () {

if(Time.time > 2.0f){

GameObject robot1 = GameObject.Find("Sphere");

robot1.tag = "Sphere";

robot1.SetActive(false);

}

}

}


'Computer Language > 유니티' 카테고리의 다른 글

생명 주기와 색깔 바꾸기  (0) 2014.05.23
로그 찍기  (0) 2014.05.23
이것만은 알고갚시다. 9장.  (0) 2014.05.20
남은 시간 출력 하기. 그외 시간 함수  (0) 2014.05.20
프로퍼티  (0) 2014.05.20

도전 8

2의 n승을 구하는 합수를 재귀적으로 구현해보자. 그리고 그에 따른 적절한 main 함수도 구현해 보자. 참고로 재귀함수의 구현이 처음에는 어려운 편이기 때문에 여기서는 쉬운문제를 제시 하였다.

(본문에 소개한 예제보다도 쉬운문제다.)

 

#include<stdio.h>

 int re(int n);
 int main(void)
 {
  int n;
  printf("정수입력:");
  scanf_s("%d", &n);
  printf("2의 %d승은 %d \n", n,re(n));
  return 0;
 }
 int re(int n)
 {
  if (n == 0)
   return 1;
  else
  return 2 * re(n - 1);
 } //도전 8

+ Recent posts