Exemplo n.º 1
0
    public void Init(LightningGun.ProjectileProperties properties, Transform startingTransform, int enemyCount = 0, List <Transform> ignoreEnemies = null)
    {
        chainEffect.Reset();
        vfxLightning.Clear();
        projectileProperties = properties;
        transform.position   = startingTransform.position;
        startingPosition     = transform.position;
        transform.forward    = startingTransform.forward;
        this.enemyCount      = enemyCount;
        yPosition            = transform.position.y;

        if (ignoreEnemies != null)
        {
            GameObject affectTarget = ignoreEnemies.Tail().GetComponent <EnemyBase>().GetAffectObject();
            if (affectTarget)
            {
                chainEffect.SetOrigin(affectTarget.transform);
            }
            ignoreTargets = ignoreEnemies;
        }
        damager             = new Damager();
        damager.damagerType = DamagerType.GrapplingHook;

        chainEffect.SetTarget(transform);

        if (enemyCount == 0)
        {
            chainEffect.SetOrigin(transform);
            chainEffect.SetTarget(transform);
        }
    }
Exemplo n.º 2
0
 public void ResetToDefaults()
 {
     chainEffect.Reset();
     vfxLightning.Clear();
     projectileProperties = null;
     startingPosition     = Vector3.zero;
     target        = null;
     enemyCount    = 0;
     ignoreTargets = new List <Transform>();
     gameObject.SetActive(false);
     markedForRemoval = false;
     removalTime      = 0.0f;
     vfxLightning.gameObject.SetActive(true);
     yPosition = 0f;
 }
Exemplo n.º 3
0
    private void SpawnNextProjectile()
    {
        LightningGun.ProjectileProperties newProperties = new LightningGun.ProjectileProperties(projectileProperties);
        newProperties.maxDistance = projectileProperties.maxDistancePerSubChain;
        //Spawn next hook
        GameObject nextHookObject = ObjectPool.Instance.GetObject(PoolObjectType.LightningProjectile);

        if (nextHookObject)
        {
            //Initialize
            LightningProjectile nextProjectile = nextHookObject.GetComponent <LightningProjectile>();
            nextProjectile.Init(newProperties, transform, enemyCount, ignoreTargets);

            if (!nextProjectile.CheckForTargets())
            {
                nextProjectile.ResetToDefaults();
            }
        }
    }