| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class IceRainController : MonoBehaviour
- {
- public GameObject sword;
- public PlayerController owner;
- public int swordsNum;
- public float totalTime;
- private float interval;
- public int damage;
- public Vector2 PosRangeX;
- public bool start;
- public float time;
- public int num;
- public float height;
- public void Update()
- {
- if (!start) return;
- time -= Time.deltaTime;
- if(time < 0)
- {
- GameObject obj = PoolManager.Instantiate(sword);
- owner.attackController.curAttackMethod.attackInfo.damage = damage;
- owner.attackController.curAttackMethod.attackInfo.attackMethod_Type = AttackMethod_Type.Attack_Summon;
- Vector3 targetPos = new Vector3(Random.Range(PosRangeX.x,PosRangeX.y), 0, 0);
- if (owner.bodyTrans.localScale.x >= 0)
- {
- targetPos = owner.transform.position - targetPos;
- }
- else
- {
- targetPos = owner.transform.position - targetPos;
- }
- targetPos.y = height;
- obj.GetComponent<Bullet>().BeShoot(owner, targetPos, Vector3.down, false);
- num++;
- time = interval;
- if(num >= swordsNum)
- {
- start = false;
- gameObject.SetActive(false);
- }
- }
- }
- public void Biu()
- {
- time = 0;
- num = 0;
- interval = totalTime / swordsNum;
- start = true;
- }
- }
|