Exemplo n.º 1
0
 protected override void Awake()
 {
     base.Awake();
     explosionPool = new Queue <ParticleSystem>();
     instance      = this;
     AllocPool();
 }
Exemplo n.º 2
0
    override public void Start()
    {
        base.Start();
        GameObject explosionPoolGameObject = GameObject.FindWithTag("ExplosionPool"); // WARNING: SLOW!!

        explosionPool = explosionPoolGameObject.GetComponent <ExplosionPool>();
    }
Exemplo n.º 3
0
    void Awake()
    {
        if (!ExplosionPool)
        {
            ExplosionPool = FindObjectOfType <ExplosionPool>();
        }

        Teleportable = GetComponent <TeleportableEntity>();
        OnAwake();
    }
Exemplo n.º 4
0
    // Start is called before the first frame update
    void Awake()
    {
        if (!PlayerProjectilePool.Initialized)
        {
            PlayerProjectilePool.Initialize();
        }

        if (!ExplosionPool.Initialized)
        {
            ExplosionPool.Initialize();
        }
    }
Exemplo n.º 5
0
 protected void SetCommonComponents()
 {
     layerMask     = (1 << LayerMask.NameToLayer("Enemies"));
     rigidBody     = GetComponent <Rigidbody>();
     animator      = GetComponentInChildren <Animator>();
     audioSources  = GetComponents <AudioSource>();
     explosionPool = StarterController.Instance.GetExplosionPool();
     startParticlesForDamageSmoke = damageSmoke.main.maxParticles;
     maxParticlesForDamageSmoke   = damageSmoke.main.maxParticles * 2;
     durability       *= durability;
     quaterCheckGround = rayCheckingGroundLength / 4;
     standUpTime       = .2f * (Mathf.Max(scale * .5f, 2f));
 }
Exemplo n.º 6
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.TryGetComponent <EnemyAI>(out EnemyAI enemy))
        {
            GameObject explosion = ExplosionPool.GetExplosion();

            explosion.transform.position = transform.position;
            explosion.SetActive(true);
            explosion.GetComponent <Explosion>().Play();

            Destroy(gameObject);
        }
    }
Exemplo n.º 7
0
        private void Update()
        {
            if (interaction == null)
            {
                return;
            }
            Vector3 position = GetPosition(1f - interaction.NormalizedTime);

            if (position.x == float.NaN)
            {
                gameObject.SetActive(false);
                return;
            }
            Quaternion rotation = Quaternion.LookRotation(prevPosition - position) * Quaternion.Euler(90, 0, 0);

            prevPosition       = position;
            transform.rotation = rotation;
            transform.position = position;
            if (interaction.IsEnded)
            {
                var destroyVector = Vector3.zero;
                if (interaction.NormalizedTime > 0)
                {
                    var extrapolatedPosition = GetPosition((1f - interaction.NormalizedTime) + 0.01f / interaction.FlyTime);
                    destroyVector = (extrapolatedPosition - position) * 100f * destroySpeed;
                }
                const float explodeRadius = 0.15f;
                ExplosionPool.Explode(position, destroyVector, explodeRadius);
                interaction = null;
                Timer.Add(explosionDelay, (anim) => {
                    if (this == null)
                    {
                        return;
                    }
                    transform.position = transform.position + destroyVector * Time.deltaTime;
                }, () => {
                    if (this == null)
                    {
                        return;
                    }
                    Timer.Add(destroyDelay, () => {
                        if (this == null)
                        {
                            return;
                        }
                        gameObject.SetActive(false);
                    });
                });
            }
        }
Exemplo n.º 8
0
    void Awake()
    {
        m_ExplosionPoolInstance = ExplosionPool.Instance;
        if (m_ExplosionPoolInstance == null)
        {
            Debug.LogError("m_ExplosionPoolInstance == null");
        }
        m_ExplosionPoolInstance.Init(m_ExplosionPrefabPath);

//		m_ExplosionListArray = new LinkedList<GameObject>[(int)PathGrid.eNeighborDirection.kNumNeighbors];
        //	InitExplosionListArray();

        m_ExplosionList = new List <GameObject>();
    }
Exemplo n.º 9
0
 public void ReturnToThePool()
 {
     ExplosionPool.ReturnExplosion(gameObject);
 }
Exemplo n.º 10
0
 private void Awake()
 {
     weaponsPool   = new WeaponsPool(new Weapon(Weapon.Type.Torpedo, Weapon.Status.Disarmed), 3);
     explosionPool = new ExplosionPool(new Explosion(Explosion.Type.Large), 3);
 }
Exemplo n.º 11
0
    public ExplosionView prototype; // Set from editor

    private void Awake()
    {
        instance = this;
    }
 private void Awake()
 {
     TorpedoTestHarness.torpedoPool   = new WeaponsPool(new Weapon(Weapon.Type.Torpedo, Weapon.Status.Disarmed), 3);
     TorpedoTestHarness.explosionPool = new ExplosionPool(new Explosion(Explosion.Type.Large), 3);
 }
Exemplo n.º 13
0
	public static void PurgeInstance()
	{
		_instance = null;
	}