| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SpiritOutDoor : MonoBehaviour
- {
- public enum spiritQuality
- {
- blue = 0,
- purple = 1,
- gold = 2,
- }
- public enum spiritType
- {
- spiritFloat = 0,
- spiritAssassin = 1,
- spiritCook = 2,
- spiritInvisible = 3,
- }
- [System.Serializable]
- public struct SpiritInfo
- {
- public GameObject spiritPrefab;
- public spiritType type;
- public spiritQuality quality;
- public int corpse;
- public Sprite introduction;
- public int ultimateTimes;
- }
- public BackDoor doorController;
- public List<SpiritInfo> spirits;
- public int times = 1;
- public GameObject[] qualityBackgrounds;
- //public GameObject isLooking1;
- //public GameObject isLooking2;
- public List<GameObject> outSpirits;
- public GameObject poses;
- public int maxPos = 6;
- static public int curPos;
- private void RandomSpirit()
- {
- int num = spirits.Count;
- int r = Random.Range(0, num);
- OutSpirit(r);
- }
- private void OutSpirit(int id)
- {
- GameObject g = Instantiate(spirits[id].spiritPrefab, poses.transform.GetChild(curPos++).transform.position, new Quaternion(0, 0, 0, 0), null);
- if (curPos == maxPos)
- {
- doorController.canCount = false;
- }
- outSpirits.Add(g);
- Base_Spirits bs = g.GetComponentInChildren<Base_Spirits>();
- bs.needCorpse = spirits[id].corpse;
- bs.type = (int)spirits[id].type;
- bs.ultimateTimes = spirits[id].ultimateTimes;
- }
- private void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.layer == 6)
- {
- times -= 1;
- if (times >= 0)
- {
- doorController.LionDark(times);
- RandomSpirit();
- if (times == doorController.maxSpirits - 1 && curPos < maxPos)
- {
- doorController.canCount = true;
- }
- }
- else
- {
- times = 0;
- doorController.col.enabled = false;
- }
- }
- }
- }
|