public void OnSpawned() { slots.physicsObject.isEnabled = true; willDespawnOnSceneExit = true; isFiring = false; isDead = false; isBeingReflected = false; spawningActor = null; spawningAttack = null; framesMovedInCurrentHorizontalDirection = 0; framesMovedInCurrentVerticalDirection = 0; remainingFramesBeforeDespawn = framesBeforeDespawn; remainingHorizontalFlips = horizontalFlipsAllowed; remainingVerticalFlips = verticalFlipsAllowed; ResetToOriginalValues(); GetComponent <Collider2D>().enabled = true; direction.horizontal = Direction.Horizontal.Neutral; direction.vertical = Direction.Vertical.Neutral; StopAllCoroutines(); StartCoroutine("SpawnCoroutine"); ParentHelper.Parent(gameObject, ParentHelper.ParentObject.Projectiles); }
protected void SpawnLandingParticle() { GameObject particle = landingParticlePool.Spawn(); ParentHelper.Parent(particle, ParentHelper.ParentObject.Particles); particle.transform.position = new Vector3(landingParticlePool.transform.position.x + particleOffset.x, landingParticlePool.transform.position.y + particleOffset.y, 0.0f); particle.GetComponent <RexParticle>().Play(); }
protected void CreateBar() { if (barPrefab != null) { GameObject newObject = Instantiate(barPrefab).gameObject; newObject.name = newObject.name.Split('(')[0]; DontDestroyOnLoad(newObject); ParentHelper.Parent(newObject, ParentHelper.ParentObject.UI); bar = newObject.GetComponent <EnergyBar>(); bar.SetMaxValue(max, false); bar.SetValue(current, false); } }