62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayAdenovirus : MonoBehaviour
|
|
{
|
|
|
|
public GameObject MainObject;
|
|
public GameObject firstObject;
|
|
public GameObject secondObject = null;
|
|
|
|
public GameObject newFirstObject;
|
|
public GameObject newSecondObject = null;
|
|
|
|
public GameObject virusParticles;
|
|
|
|
// // move toward animation;
|
|
// public GameObject imageTargetPupose;
|
|
// public GameObject viruses;
|
|
// public float speed;
|
|
|
|
void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other is CapsuleCollider || other is BoxCollider)
|
|
{
|
|
// MainObject.SetActive(false);
|
|
|
|
if (firstObject != null) firstObject.SetActive(false);
|
|
if (secondObject != null) secondObject.SetActive(false);
|
|
if (virusParticles != null) virusParticles.SetActive(false);
|
|
|
|
if (newFirstObject != null) newFirstObject.SetActive(true);
|
|
if (newSecondObject != null) newSecondObject.SetActive(true);
|
|
|
|
// viruses.transform.position = Vector3.MoveTowards(viruses.transform.position, imageTargetPupose.transform.position, speed);
|
|
}
|
|
}
|
|
|
|
void OnTriggerExit(Collider other)
|
|
{
|
|
if (other is CapsuleCollider || other is BoxCollider)
|
|
{
|
|
// MainObject.SetActive(true);
|
|
if (firstObject != null) firstObject.SetActive(true);
|
|
if (secondObject != null) secondObject.SetActive(true);
|
|
if (virusParticles != null) virusParticles.SetActive(true);
|
|
|
|
if (newFirstObject != null && newFirstObject.activeSelf)
|
|
{
|
|
newFirstObject.SetActive(false);
|
|
Debug.Log("object first untouched");
|
|
}
|
|
if (newSecondObject != null && newSecondObject.activeSelf)
|
|
{
|
|
newSecondObject.SetActive(false);
|
|
Debug.Log("object second untouched");
|
|
}
|
|
// Debug.Log ("object untouched");
|
|
}
|
|
}
|
|
}
|