Advertisement
JeCodeLeSoir

Egg exemple

May 10th, 2024
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System.Collections;
  2. using UnityEngine;
  3.  
  4. public class Egg : MonoBehaviour
  5. {
  6.     [SerializeField] Animator animator;
  7.     [SerializeField] Fish fish;
  8.    
  9.     IEnumerator Start()
  10.     {
  11.         yield return new WaitForSeconds(1200);
  12.  
  13.         animator.SetTrigger("crack");
  14.  
  15.         fish.BehaviourActive = true;
  16.         fish.gameObject.transform.SetParent(null);
  17.  
  18.         yield return new WaitForSeconds(1);
  19.  
  20.         Destroy(this.gameObject);
  21.  
  22.         yield return 0;
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement