Exemplo n.º 1
0
    // ================================================================ //
    // MonoBehaviour에서 상속.

    void    Start()
    {
        this.main_camera = GameObject.Find("Main Camera").GetComponent <CameraControl>();

        // ------------------------------------------------------------ //
        // 입과 눈.

        this.mouths = new List <GameObject>();
        this.eyes   = new List <GameObject>();

        this.face        = this.transform.FindChild("face").gameObject;
        this.face_center = this.face.transform.localPosition.z;

        // 입.

        Transform mouth_root = this.face.transform.FindChild("mouth");

        for (int i = 0; i < (int)MOUTH_TYPE.NUM; i++)
        {
            this.mouths.Add(null);

            Transform t = mouth_root.FindChild("mouth" + i);

            if (t == null)
            {
                continue;
            }

            this.mouths[i] = t.gameObject;
        }

        this.change_mouth_type(this.mouth_type);

        // 눈.

        for (int i = 0; i < (int)EYE_TYPE.NUM; i++)
        {
            this.eyes.Add(null);

            Transform t = this.face.transform.FindChild("eye" + i);

            if (t == null)
            {
                continue;
            }

            this.eyes[i] = t.gameObject;
        }

        this.eye_type    = EYE_TYPE.OPEN;
        this.blink_timer = 0.0f;
        this.change_eye_type();

        // ------------------------------------------------------------ //

        this.cloud_root = GameObject.Find("Game Root").GetComponent <CloudRoot>();

        this.timer = 0.0f;
    }
Exemplo n.º 2
0
    protected void          change_eye_type()
    {
        this.blink_timer -= Time.deltaTime;

        if (this.blink_timer < 0.0f)
        {
            this.blink_timer = Random.Range(1.0f, 3.0f);
            this.eye_type    = EYE_TYPE.OPEN;
        }
        else if (this.blink_timer < 0.25f)
        {
            this.eye_type = EYE_TYPE.CLOSE;
        }

        for (int i = 0; i < this.eyes.Count; i++)
        {
            GameObject eye = this.eyes[i];

            eye.SetActive((i == (int)this.eye_type));
        }
    }
Exemplo n.º 3
0
    protected void change_eye_type()
    {
        this.blink_timer -= Time.deltaTime;

        if(this.blink_timer < 0.0f) {

            this.blink_timer = Random.Range(1.0f, 3.0f);
            this.eye_type    = EYE_TYPE.OPEN;

        } else if(this.blink_timer < 0.25f) {

            this.eye_type = EYE_TYPE.CLOSE;

        }

        for(int i = 0;i < this.eyes.Count;i++) {

            GameObject	eye = this.eyes[i];

            eye.SetActive((i == (int)this.eye_type));
        }
    }
Exemplo n.º 4
0
    // ================================================================ //
    // MonoBehaviour에서 상속.
    void Start()
    {
        this.main_camera = GameObject.Find("Main Camera").GetComponent<CameraControl>();

        // ------------------------------------------------------------ //
        // 입과 눈.

        this.mouths = new List<GameObject>();
        this.eyes   = new List<GameObject>();

        this.face = this.transform.FindChild("face").gameObject;
        this.face_center = this.face.transform.localPosition.z;

        // 입.

        Transform	mouth_root = this.face.transform.FindChild("mouth");

        for(int i = 0;i < (int)MOUTH_TYPE.NUM;i++) {

            this.mouths.Add(null);

            Transform	t = mouth_root.FindChild("mouth" + i);

            if(t == null) {

                continue;
            }

            this.mouths[i] = t.gameObject;
        }

        this.change_mouth_type(this.mouth_type);

        // 눈.

        for(int i = 0;i < (int)EYE_TYPE.NUM;i++) {

            this.eyes.Add(null);

            Transform	t = this.face.transform.FindChild("eye" + i);

            if(t == null) {

                continue;
            }

            this.eyes[i] = t.gameObject;
        }

        this.eye_type    = EYE_TYPE.OPEN;
        this.blink_timer = 0.0f;
        this.change_eye_type();

        // ------------------------------------------------------------ //

        this.cloud_root = GameObject.Find("Game Root").GetComponent<CloudRoot>();

        this.timer = 0.0f;
    }