Devlog12


script for pop up bubble chat : 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bubbleChat : MonoBehaviour {
public Camera mainCamera;
public GameObject[] bubblechat;
public GameObject bubblechatposition;
GameObject bubblechatclone;
int bubble = 0;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

void OnTriggerEnter2D(Collider2D coll){
if(coll.gameObject.name == "Monalisa"){
if (bubble == 0) {
bubblechatclone = Instantiate (bubblechat[3], bubblechatposition.transform.position, Quaternion.identity);
bubble += 1;
bubblechatclone.transform.parent = mainCamera.transform;
} else if(bubble > 1){
Destroy (bubblechatclone);
}
}
if(coll.gameObject.name == "Kabel"){
if (bubble == 0) {
bubblechatclone = Instantiate (bubblechat[1], bubblechatposition.transform.position, Quaternion.identity);
bubble += 1;
bubblechatclone.transform.parent = mainCamera.transform;
} else if(bubble > 1){
Destroy (bubblechatclone);
}
}
if(coll.gameObject.name == "Aksara"){
if (bubble == 0) {
bubblechatclone = Instantiate (bubblechat[0], bubblechatposition.transform.position, Quaternion.identity);
bubble += 1;
bubblechatclone.transform.parent = mainCamera.transform;
} else if(bubble > 1){
Destroy (bubblechatclone);
}
}
if(coll.gameObject.name == "BlackFog"){
if (bubble == 0) {
bubblechatclone = Instantiate (bubblechat[5], bubblechatposition.transform.position, Quaternion.identity);
bubble += 1;
bubblechatclone.transform.parent = mainCamera.transform;
} else if(bubble > 1){
Destroy (bubblechatclone);
}
}
}
void OnTriggerExit2D(Collider2D coll){
Destroy (bubblechatclone);
bubble = 0;
}
}

Get Palasic

Leave a comment

Log in with your itch.io account to leave a comment.