internal static List <EffectSpawner> ReadAll(string json) { List <EffectSpawner> spawners = new List <EffectSpawner>(); if (elems == null) { elems = ConfigElement.GetAll(typeof(EffectSpawner)); } JsonContext ctx = new JsonContext(); ctx.Val = json; JsonArray array = (JsonArray)Json.ParseStream(ctx); if (array == null) { return(spawners); } foreach (object raw in array) { JsonObject obj = (JsonObject)raw; if (obj == null) { continue; } EffectSpawner data = new EffectSpawner(); obj.Deserialise(elems, data); spawners.Add(data); } return(spawners); }
void OnHit() { gameObject.SetActive(false); _rigid.isKinematic = true; //Destroy(this.gameObject); EffectSpawner.GetInstance().Play(_defeatedEffect, this.transform.position); }
bool isEnergyInc; // 能量条是否增加 void Awake() { // 单例 effect = this; // 为宝石消除动画数组申请空间 JewelCrashArray = new GameObject[7, 9]; }
private IEnumerator DeathSceneCoroutine() { yield return(new WaitForSeconds(Random.Range(0.5f, 0.78f))); parentObject.gameObject.SetActive(false); EffectSpawner.SpawnEnemyDeathEffect(transform.position); }
private void Start() { state = gameState.Start; stageCreater = Instantiate(stageCreater); stageCreater.transform.parent = transform; player = Instantiate(player); player.transform.parent = transform; footPrinter = Instantiate(footPrinter); footPrinter.transform.parent = transform; effectSpawner = Instantiate(effectSpawner); effectSpawner.transform.parent = transform; effectSpawner2 = Instantiate(effectSpawner2); effectSpawner2.transform.parent = transform; stageCreater.footPrinter = footPrinter; stageCreater.effectSpawner = effectSpawner; stageCreater.effectSpawner2 = effectSpawner2; player.haveMapDateObject = stageCreater; }
static void SpawnersTick(SchedulerTask task) { spawnerAccum++; foreach (Player p in PlayerInfo.Online.Items) { if (!spawnersAtLevel.ContainsKey(p.level)) { continue; } List <EffectSpawner> spawners = spawnersAtLevel[p.level]; if (spawners.Count == 0) { continue; } //We are going to tackle the myth that classicube is minecraft. So, why the "j"? (IDK LOL) for (int j = 0; j < spawners.Count; j++) { EffectSpawner spawner = spawners[j]; if (spawner.spawnInterval == 0 || (spawnerAccum + spawner.spawnTimeOffset) % spawner.spawnInterval == 0) { if (rnd.NextDouble() > spawner.spawnChance) { continue; } SpawnEffectFor(p, spawner.effectName, spawner.x, spawner.y, spawner.z, spawner.originX, spawner.originY, spawner.originZ); } } } }
private void OnDestroy() { if (_instance == this) { _instance = null; } }
private void Awake() { if (IsInitialized) { return; } Instance = this; }
void Start() { game = GetComponent <Game>(); effectSpawner = GetComponent <EffectSpawner>(); field = GetComponent <Field>(); effectSpawner = GetComponent <EffectSpawner>(); indicator = GetComponent <Indicator>(); pf = new Pathfinder(); }
void OnDefeated() { EffectSpawner.GetInstance().Play(_defeatedEffect, _bodyCenterTransform.position); TargetSpawner.GetInstance().Spawn(); Destroy(this.gameObject); }
public void SetPrefabColors() { if (player.Team != null) { EffectSpawner chargeEffectSpawner = this.FindEffect(EffectType.DashCharge); dashEffectPrefab = player.Team.resources.dashEffectPrefab; chargeEffectSpawner.effectPrefab = player.Team.resources.dashChargeEffectPrefab; dashAimerPrefab = player.Team.resources.dashAimerPrefab; } }
private void Awake() { if (_instance == null) { _instance = this; } else if (_instance != null) { Destroy(this.gameObject); } }
/// <summary> /// アニメーションからエフェクトを生成. /// </summary> public void CreateEffectByAnimation(int dataIndex) { Transform baseTrans = transform; EffectSpawnData data = spawnDataList[dataIndex]; if (data.baseBone != null) { baseTrans = data.baseBone; } EffectSpawner.Spawn(data.effectData, baseTrans.position + data.posOffset); }
void Start() { rb = GetComponent <Rigidbody2D>(); spriteSizes = new Vector2(GetComponent <SpriteRenderer>().bounds.size.x, GetComponent <SpriteRenderer>().bounds.size.y); levelManager = FindObjectOfType <LevelManager>(); effectSpawner = FindObjectOfType <EffectSpawner>(); //RandomDirection(); MoveAsteroid(); InvokeRepeating("CheckMovement", 0.0f, 2.0f); }
private void Awake() { if (instance == null) { instance = this; } else { Debug.LogError("Tried to instantiate more than one EffectSpawner!"); return; } }
void Start() { Aspawner = FindObjectOfType <AsteroidSpawner>(); effectSpawner = FindObjectOfType <EffectSpawner>(); target = GameObject.FindGameObjectWithTag("Ship").transform; initialPosition = transform.position; StartCoroutine(MoveBetweenTwoLocations(destinations)); InvokeRepeating("ShootPlayerShip", 1.5f, 2.0f); }
public static void RemoveSpawner(EffectSpawner spawner, Level lvl, bool save) { if (!spawnersAtLevel.ContainsKey(lvl)) { return; } spawnersAtLevel[lvl].Remove(spawner); if (save) { SpawnersFile.Save(lvl); } }
protected override void OnUpdate() { var query = GetEntityQuery( ComponentType.ReadOnly <ProjectileComponentData>(), ComponentType.ReadOnly <VelocityComponentData>(), ComponentType.ReadOnly <Translation>() ); var entities = query.ToEntityArray(Allocator.TempJob); var velocities = query.ToComponentDataArray <VelocityComponentData>(Allocator.TempJob); var datas = query.ToComponentDataArray <ProjectileComponentData>(Allocator.TempJob); var translations = query.ToComponentDataArray <Translation>(Allocator.TempJob); var l = entities.Length; for (int i = 0; i < l; i++) { var v = velocities[i].value; if (v.x == 0 && v.y == 0) { var scale = 1f; if (manager.HasComponent <Scale>(entities[i])) { scale = manager.GetComponentData <Scale>(entities[i]).Value; } if (datas[i].itStopsRightNow) { EffectSpawner.SpawnEffect(translations[i].Value, scale, quaternion.identity, datas[i].effectOnParticleStops); } if (datas[i].removeEntityWhenProjectileStops) { if (datas[i].lifetimeAfterProjectileStop <= 0) { manager.DestroyEntity(entities[i]); EffectSpawner.SpawnEffect(translations[i].Value, scale, quaternion.identity, datas[i].effectOnParticleRemoves); } } else { manager.RemoveComponent <ProjectileComponentData>(entities[i]); manager.RemoveComponent <VelocityComponentData>(entities[i]); } } } datas.Dispose(); velocities.Dispose(); entities.Dispose(); translations.Dispose(); }
void OnTriggerEnter(Collider collision) { Debug.Log(collision.gameObject.name); //Destroy (this.gameObject); if (collision.gameObject.tag == "ArrowBullet") { Vector3 pos = new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y + 2.0f, this.gameObject.transform.position.z); EffectSpawner.GetInstance().Play(_defeatedEffect, pos); _state = ZombieState.Die; _zombieAnim.ZombieDead(); Invoke("ZombieDestory", 1.0f); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) //{ // //} // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) //{ // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Transform parent = animator.transform.parent; EffectSpawner spawner = parent?.GetComponent <EffectSpawner>(); while (parent && !spawner) { parent = parent.transform.parent; spawner = parent?.GetComponent <EffectSpawner>(); } if (spawner) { spawner.EndEffect(); } Destroy(animator.gameObject); }
void Start() { // Get the reference to the rigidbody component rb = GetComponent <Rigidbody2D>(); // effectSpawner = FindObjectOfType <EffectSpawner>(); // target = GameObject.FindGameObjectWithTag("Ship").transform; // Move the bullet MoveBullet(); // If it fails to hit the player ship, then when its lifetime is up, destroy it Invoke("DestroyBullet", lifeTime); }
public static void AddSpawner(EffectSpawner spawner, Level lvl, bool save) { if (!spawnersAtLevel.ContainsKey(lvl)) { //Logger.Log(LogType.Debug, "We are adding key {0} for the first time.", lvl.MapName); List <EffectSpawner> spawnerList = new List <EffectSpawner>(); spawnerList.Add(spawner); spawnersAtLevel.Add(lvl, spawnerList); } else { spawnersAtLevel[lvl].Add(spawner); } if (save) { SpawnersFile.Save(lvl); } }
public void CheckLevelUp() { bool levelup = expNeeded <= 0; while (expNeeded <= 0) { //TODO LVL up level++; expNeeded += 10 * level; this.maxHP++; this.HP++; } if (levelup) { var clip = MainLogic.instance.audioManager.SFXs[4]; AudioManager.playSFX(this, clip, 0); EffectSpawner.SetEffect("LvUP", transform.position); } }
// Use this for initialization public void Scan() { Ray ray = new Ray(transform.position, transform.up * -1); RaycastHit hit; if (Physics.Raycast(ray, out hit, 40)) { var plate = hit.collider.GetComponent <TargetCollider>(); if (plate != null) { plate.target.Smash(); } var effect = EffectSpawner.GetEffect("Spark"); effect.SetActive(true); effect.transform.position = hit.point; effect.transform.rotation = Quaternion.LookRotation(hit.normal); } gameObject.SetActive(false); }
//데미지를 받으면 public virtual bool AnyDamage(float damage, Guid guid) { if (!GuidCheck(guid)) { return(false); } currentHP -= damage; currentHP = Mathf.Max(0f, currentHP); if (!string.IsNullOrEmpty(hitEffect)) { EffectSpawner.SetEffect(hitEffect, transform.position); } if (currentHP == 0f) { aliveState = SGE_ALIVE_STATE.DEAD; } return(true); }
public virtual void getDamage(int power, int dice) { int powerDiff = power + dice - this.GetPower(); bool hit = false; if (powerDiff >= 12) { //CRITICAL !! TODO ANIMATION this.HP -= 2; EffectSpawner.SetEffect("HitEffect", transform.position + Vector3.up); hit = true; } else if (powerDiff >= 7 || dice >= 12) { //normal hit; this.HP -= 1; EffectSpawner.SetEffect("HitEffect", transform.position + Vector3.up); hit = true; } else { //MISS!! EffectSpawner.SetEffect("MISS", transform.position + Vector3.up); } if (IsDead()) { if (animation) { animation.SetTrigger("Die"); } } else { if (animation && hit) { animation.SetTrigger("Hit"); } } }
// Update is called once per frame void FixedUpdate() { if (trackedObj == null || currentShotLeft <= 0) { return; } var device = SteamVR_Controller.Input((int)trackedObj.index); if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) { currentShotLeft--; source.Play(); for (int i = 0; i < shotCount; i++) { var spread2d = (Random.insideUnitSphere + Random.insideUnitSphere) * spread; var shot = EffectSpawner.GetEffect("shot"); shot.transform.position = muzzle.position; shot.transform.rotation = muzzle.rotation * Quaternion.Euler(spread2d); shot.GetComponent <HitScan>().Scan(); } } }
private void OnTriggerEnter(Collider other) { var tag = other.GetComponent <ObjectTag>(); if (tag != null && tag.type == ObjectType.DOWN_STAIR) { animation.SetTrigger("Jumpdown"); tag.GetComponent <Animator>().enabled = true; } else if (other.tag == "Equipment") { Debug.Log("Touched!"); if (ItemManager.equipDic[other.GetComponent <EquipmentItem>().code].power >= ItemManager.equipDic[other.GetComponent <EquipmentItem>().code].power) { ItemManager.heroEquipInfo.Remove(ItemManager.equipDic[other.GetComponent <EquipmentItem>().code].type); ItemManager.heroEquipInfo.Add(ItemManager.equipDic[other.GetComponent <EquipmentItem>().code].type, other.GetComponent <EquipmentItem>().code); other.gameObject.SetActive(false); other.GetComponentInParent <DungeonFloor>().objectsToReset.Add(other.gameObject); AudioManager.playSFX(this, MainLogic.instance.audioManager.SFXs[3]); EffectSpawner.SetEffect("PwUP", transform.position); } // TODO : loot or ignore } else if (other.tag == "Consumable") { // if ((int)other.GetComponent<ConsumableItem>().code <= 2) // ���迭 ������ MainLogic.instance.hero.HP = Mathf.Min(MainLogic.instance.hero.HP + ItemManager.consumalbeDic[other.GetComponent <ConsumableItem>().code], MainLogic.instance.hero.maxHP); // else //�����迭 ������ // MainLogic.instance.hero.buffedTurn += ItemManager.consumalbeDic[other.GetComponent<ConsumableItem>().code]; other.gameObject.SetActive(false); other.GetComponentInParent <DungeonFloor>().objectsToReset.Add(other.gameObject); AudioManager.playSFX(this, MainLogic.instance.audioManager.SFXs[3]); } }
// Start is called before the first frame update void Start() { instance = this; effectPrefab = Resources.Load("Prefabs/GeneralEffect") as GameObject; damagePrefab = Resources.Load("Prefabs/DamagePop") as GameObject; }
void Awake() { effect = this; JewelCrashArray = new GameObject[7, 9]; }