// method // Standard method protected virtual void Awake() { enemyManager = EnemyManager.Instance; inventoryManager = InventoryManager.Instance; lifeStoneManager = LifeStoneManager.Instance; animator = GetComponent <Animator>(); DebuffState _temp = DebuffState.Off; debuffState = new DebuffState[(int)EnemyDebuffCase.END_POINTER] { _temp, _temp, _temp, _temp, _temp }; AnimationClip[] clips = animator.runtimeAnimatorController.animationClips; foreach (var clip in clips) { if (clip.name.Contains("Stunned")) { stunnedAnimLength = clip.length; } } Array.Sort(knockbackPercentage); Array.Reverse(knockbackPercentage); }
void Awake() { lifeStoneManager = LifeStoneManager.Instance; inventoryManager = InventoryManager.Instance; playerController = GetComponent <PlayerController>(); attackProperty = GetComponentInChildren <AttackProperty>(); anim = GetComponent <Animator>(); aoc = new AnimatorOverrideController(anim.runtimeAnimatorController); anim.runtimeAnimatorController = aoc; }
/// <summary> /// Spawn items according to the probability and item stage of this room. /// </summary> public void SpawnItem() { Room room = transform.parent.GetComponent <Room>(); InventoryManager inventoryManager = InventoryManager.Instance; LifeStoneManager lifeStoneManager = LifeStoneManager.Instance; Vector3[] itemPosition = new Vector3[6]; int j = 0; foreach (Transform child in transform.Find("item spot")) { itemPosition[j++] = child.position; } int goldRoomIndex = room.stage; int random = Random.Range(0, goldRoomInformation[goldRoomIndex].itemSpawnInfo.Count); GoldRoomItemInfo itemInfo = goldRoomInformation[goldRoomIndex].itemSpawnInfo[random]; itemGoods = new GameObject[itemInfo.itemType.Length]; int itemCount = 0; for (int i = 0; i < itemInfo.itemType.Length; i++) { if (itemInfo.itemType[i] == ItemSpawnType.Item) { itemGoods[i] = inventoryManager.ItemInstantiate(itemInfo.itemQuality[i], itemPosition[itemCount++], itemInfo.price[i], 0); } else if (itemInfo.itemType[i] == ItemSpawnType.Addon) { itemGoods[i] = inventoryManager.AddonInstantiate(itemInfo.itemQuality[i], itemPosition[itemCount++], itemInfo.price[i], 0); } else if (itemInfo.itemType[i] == ItemSpawnType.GoldPotion) { itemGoods[i] = lifeStoneManager.InstantiatePotion(itemPosition[itemCount++], itemInfo.price[i], 0); } else if (itemInfo.itemType[i] == ItemSpawnType.LifeStone) { if (itemInfo.itemQuality[i] == ItemQuality.Gold) { itemGoods[i] = lifeStoneManager.InstantiateDroppedLifeStone(new Vector2Int(3, 2), 1, 0, itemPosition[itemCount++], itemInfo.price[i], 0); } else { itemGoods[i] = lifeStoneManager.InstantiateDroppedLifeStone(new Vector2Int(3, 2), 0, 0, itemPosition[itemCount++], itemInfo.price[i], 0); } } if (itemGoods[i] != null) { itemGoods[i].GetComponent <DroppedObject>().priceSign = Instantiate(InventoryManager.Instance.woodSign, itemGoods[i].transform.position + new Vector3(0.5f, 0, 0), Quaternion.identity, MapManager.currentRoom.transform); itemGoods[i].GetComponent <DroppedObject>().priceTag.text = itemInfo.price[i].ToString(); itemGoods[i].GetComponent <DroppedObject>().priceTag.transform.position = itemGoods[i].GetComponent <DroppedObject>().priceSign.transform.position + new Vector3(0, 0.65f, 0); } } }
public override void Declare() { id = 17; name = "식탐"; quality = ItemQuality.Ordinary; type = AddonType.Theory; sprite = Resources.Load <Sprite>("Sprites/Addons/gluttony");; highlight = Resources.Load <Sprite>("Sprites/Addons/gluttony_border");; sizeInventory = new Vector2(80, 80); lifeStoneManager = LifeStoneManager.Instance; addonInfo = "적을 처치하면 생명석이 1개 회복된다."; }
public override float DamageFinalAdder(PlayerAttackInfo attackInfo, Enemy enemyInfo, string combo) { LifeStoneManager lifeStoneManager = LifeStoneManager.Instance; if (Random.Range(0, 2) == 0) { lifeStoneManager.DestroyStone(2); return(0); } else { return(enemyInfo.CurrHealth * 0.25f); } }
private void Awake() { lifeStoneManager = GameObject.Find("LifeStoneManager").GetComponent <LifeStoneManager>(); skillQueue = new Queue <SkillInfo>(); animator = GetComponent <Animator>(); aoc = new AnimatorOverrideController(animator.runtimeAnimatorController); animator.runtimeAnimatorController = aoc; controller = GetComponent <CharacterController2D>(); arrowChecker = new bool[(int)InputArrow.Front + 1]; actionChecker = new bool[(int)InputAction.NULL]; possibleComboes = new List <ComboInfo>(); originPlayerAttribute.gravityScale = GetComponent <Rigidbody2D>().gravityScale; }
// Use this for initialization void Start() { ttx = (int)(transform.position.x / 24f); tty = (int)(transform.position.y - 0.8f / 24f); lifeStoneManager = LifeStoneManager.Instance; particles = new GameObject[40]; for (int i = 0; i < particles.Length; i++) { particles[i] = Instantiate(particlePrefab, transform); particles[i].SetActive(false); } gameover = false; }
/// <summary> /// Spawn items according to the probability and item stage of this room. /// </summary> public void SpawnItem() { Room room = transform.parent.GetComponent <Room>(); InventoryManager inventoryManager = InventoryManager.Instance; LifeStoneManager lifeStoneManager = LifeStoneManager.Instance; float probability = Random.Range(0f, 100f); Vector3[] itemPosition = new Vector3[5]; int j = 0; foreach (Transform child in transform.Find("item spot")) { itemPosition[j++] = child.transform.position; } int itemRoomIndex = room.itemRoomType > 5 ? 5 : room.itemRoomType; for (int index = 0; index < itemRoomInformation[itemRoomIndex - 1].itemSpawnInfo.Count; index++) { ItemRoomItemInfo itemInfo = itemRoomInformation[itemRoomIndex - 1].itemSpawnInfo[index]; probability -= itemInfo.probability; Debug.Log(probability); if (probability <= 0) { int itemCount = 0; for (int i = 0; i < itemInfo.itemType.Length; i++) { if (itemInfo.itemType[i] == ItemSpawnType.Item) { for (int _amount = 0; _amount < itemInfo.amount[i]; _amount++) { inventoryManager.ItemInstantiate(itemInfo.itemQuality[i], itemPosition[itemCount++], 0); } } else if (itemInfo.itemType[i] == ItemSpawnType.Addon) { for (int _amount = 0; _amount < itemInfo.amount[i]; _amount++) { inventoryManager.AddonInstantiate(itemInfo.itemQuality[i], itemPosition[itemCount++], 0); } } else if (itemInfo.itemType[i] == ItemSpawnType.GoldPotion) { for (int _amount = 0; _amount < itemInfo.amount[i]; _amount++) { lifeStoneManager.InstantiatePotion(itemPosition[itemCount++], 0); } } else if (itemInfo.itemType[i] == ItemSpawnType.LifeStone) { if (room.itemRoomType < 4) { for (int _amount = 0; _amount < itemInfo.amount[i]; _amount++) { if (itemInfo.itemQuality[i] == ItemQuality.Gold) { lifeStoneManager.InstantiateDroppedLifeStone(new Vector2Int(3, 2), 4, 1, 0, itemPosition[itemCount++], 0); } else { lifeStoneManager.InstantiateDroppedLifeStone(new Vector2Int(3, 2), 0, 0, itemPosition[itemCount++], 0); } } } else { lifeStoneManager.InstantiateDroppedLifeStone(new Vector2Int(3, room.itemRoomType - 4), 1, 0, itemPosition[itemCount++], 0); } } else if (itemInfo.itemType[i] == ItemSpawnType.LifeStoneFrame) { lifeStoneManager.InstantiateFrame(room.itemRoomType - 4, itemPosition[itemCount++], 0); } } return; } } }
private void Start() { uii = LifeStoneManager.Instance; }