Exemplo n.º 1
0
    private void OnShootBulletsParticle(object data)
    {
        HeroController.OnShootRaycastEvent onShoot = (HeroController.OnShootRaycastEvent)data;
        if (onShoot.currentGun.GunType.ToString().Equals("Knife"))
        {
            return;
        }

        randomNegativeZ      = Random.Range(-70, -110);
        randomZ              = Random.Range(+70, +110);
        randomZValueArray[0] = randomZ;
        randomZValueArray[1] = randomNegativeZ;
        randomIndexZArray    = Random.Range(0, 2);

        randomRotateSpeed = Random.Range(-5, 5);
        randomSpeed       = Random.Range(2.3f, 3.2f);

        int          quadIndex = meshParticle.AddPooledQuad(onShoot.lineRendererPosition, 0);
        SingleBullet bullet    = new SingleBullet {
            randomSpeed       = randomSpeed,
            randomRotateSpeed = randomRotateSpeed,
            position          = onShoot.lineRendererPosition,
            direction         = Quaternion.Euler(
                0, 0, randomZValueArray[randomIndexZArray]) * onShoot.heroDirection,
            index        = quadIndex,
            meshParticle = meshParticle,
        };

        bulletsList.Add(bullet);
    }
Exemplo n.º 2
0
    private void OnRunning(object data)
    {
        HeroController.OnShootRaycastEvent onShoot = (HeroController.OnShootRaycastEvent)data;
        moveVelocityValue = onShoot.heroDirection.sqrMagnitude;
        if (moveVelocityValue < .5f)
        {
            isRunning = false;
        }
        else
        {
            isRunning = true;
        }
        randomSpeed = Random.Range(2.7f, 3f);

        int        quadIndex = meshParticle.AddPooledQuad(onShoot.lineRendererPosition, 0);
        SingleDirt dirt      = new SingleDirt {
            randomSpeed  = randomSpeed,
            isRunning    = isRunning,
            position     = onShoot.lineRendererPosition,
            direction    = -onShoot.heroDirection,
            quadIndex    = quadIndex,
            meshParticle = meshParticle,
        };

        dirtList.Add(dirt);
    }