コード例 #1
0
    private void SpawnEffects(bool paintImpactParticle, bool paintDecal, Vector3 hitPosition, Quaternion decalRot, Quaternion paintImpactRot, int paintType)
    {
        paintMuzzleFlashParticle.Initialise(PlayerManager.instance.entity.paintController.GetPaintColor((PaintController.PaintType)paintType));
        muzzleFlashParticle.Play();

        if (!photonView.IsMine)
        {
            AudioController audioController = ObjectPooler.instance.GrabFromPool("Audio_GunFire", transform.position, Quaternion.identity).GetComponent <AudioController>();
            audioController.Play(transform);
        }

        if (paintImpactParticle)
        {
            GameObject          newSpawn = ObjectPooler.instance.GrabFromPool("PaintImpact", hitPosition, paintImpactRot);
            PaintImpactParticle pip      = newSpawn.GetComponent <PaintImpactParticle>();
            if (pip)
            {
                pip.Initialise(PlayerManager.instance.entity.paintController.GetPaintColor((PaintController.PaintType)paintType));
            }
        }

        if (paintDecal)
        {
            GameObject newSpawn = ObjectPooler.instance.GrabFromPool("PaintDecal", hitPosition, decalRot);
            PaintDecal decal    = newSpawn.GetComponent <PaintDecal>();
            if (decal)
            {
                decal.Initialise(PlayerManager.instance.entity.paintController.GetPaintColor((PaintController.PaintType)paintType));
            }
        }
    }
コード例 #2
0
    private void Awake()
    {
        if (photonView.IsMine)
        {
            mainCam = Camera.main;

            WeaponSlot.OnFireWeapon += WeaponSlot_OnFireWeapon;
            initialisedEvents        = true;
        }
        else
        {
            SetLayer(transform, 10);
        }

        paintMuzzleFlashParticle = GetComponentInChildren <PaintImpactParticle>();
    }