Example #1
0
        public static void PlayWeaponFired(Side side, WeaponFireEvent weapon)
        {
            switch (weapon.Weapon.Name)
            {
            case "Flashbang":
                PlayFlashbangThrown(side);
                break;

            case "Smoke":
                PlaySmokeThrown(side);
                break;

            case "He Grenade":
                PlayHeGrenadeThrown(side);
                break;

            case "Decoy":
                PlayDecoyThrown(side);
                break;

            case "Molotov":
            case "Incendiary":
                PlayMolotovThrown(side);
                break;
            }
        }
Example #2
0
	private void OnWeaponFireEvent(WeaponFireEvent evt)
	{
		if(evt.Weapon.Wielder.HasTag("Player"))
		{
			lastKnownPosition.Position = evt.Weapon.Wielder.transform.position;
		}
	}
	private void OnWeaponFireEvent(WeaponFireEvent evt)
	{
		if(evt.Hit.source == entity)
		{
			animator.SetTrigger("Shoot");
		}
	}
 public override void OnEvent(WeaponFireEvent evnt)
 {
     GameObject prefab = Instantiate(WeaponFirePrefab);
     WeaponShot shot = prefab.GetComponent<WeaponShot>();
     shot.StartPoint = evnt.StartPoint;
     shot.EndPoint = evnt.EndPoint;
     shot.BeamColor = evnt.Color;
     shot.transform.parent = gameObject.transform;
 }
        public void Fire(WeaponFireEvent fireEvent)
        {
            RaycastHit hit;

            if (Physics.Raycast(fireEvent.ray, out hit, Mathf.Infinity, layerMask))
            {
                CEventSystem.Broadcast(Ship.ShipChannel.shipChannel, Ship.ShipChannel.shipSubchannel, new Ship.TargetEvent(hit.point));
            }
        }
Example #6
0
    public void CreateShot()
    {
        WeaponFireEvent evnt = WeaponFireEvent.Create(Bolt.GlobalTargets.Everyone, Bolt.ReliabilityModes.Unreliable);

        evnt.EndPoint   = endpoint;
        evnt.StartPoint = GunShotStartTransform.position;
        evnt.Color      = Color.red;
        evnt.Send();
    }
    public override void OnEvent(WeaponFireEvent evnt)
    {
        GameObject prefab = Instantiate(WeaponFirePrefab);
        WeaponShot shot   = prefab.GetComponent <WeaponShot>();

        shot.StartPoint       = evnt.StartPoint;
        shot.EndPoint         = evnt.EndPoint;
        shot.BeamColor        = evnt.Color;
        shot.transform.parent = gameObject.transform;
    }
Example #8
0
        void IEventHandler <WeaponFireEvent> .HandleEvent(object source, WeaponFireEvent data)
        {
            if (MuzzleGlows == null || data.BarrelIndex >= MuzzleGlows.Length)
            {
                return;
            }

            var wpn   = (Weapon)source;
            var color = MuzzleGlows[data.BarrelIndex].ColorTint;

            MuzzleGlows[data.BarrelIndex].ColorTint = new Duality.Drawing.ColorRgba(color.R, color.G, color.B, 255);
        }
Example #9
0
        public void DrawEvent(PositionPoint positionPoint)
        {
            Type type = positionPoint.Event.GetType();

            if (type == typeof(WeaponFireEvent))
            {
                DrawWeapon(positionPoint);
                WeaponFireEvent e = (WeaponFireEvent)positionPoint.Event;
                SoundService.PlayWeaponFired(positionPoint.Team, e);
            }
            else if (type == typeof(FlashbangExplodedEvent))
            {
                DrawFlashbangExploded(positionPoint);
                SoundService.PlayFlashbangExploded();
            }
            else if (type == typeof(SmokeNadeStartedEvent))
            {
                DrawSmokeStarted(positionPoint);
                SoundService.PlaySmokeDetonated();
            }
            else if (type == typeof(SmokeNadeEndedEvent))
            {
                DrawSmokeEnded(positionPoint);
            }
            else if (type == typeof(ExplosiveNadeExplodedEvent))
            {
                DrawExplosiveNadeExploded(positionPoint);
                SoundService.PlayHeExploded();
            }
            else if (type == typeof(MolotovFireStartedEvent))
            {
                DrawMolotovStarted(positionPoint);
                SoundService.PlayMolotovExploded();
            }
            else if (type == typeof(MolotovFireEndedEvent))
            {
                DrawMolotovEnded(positionPoint);
            }
            else if (type == typeof(KillEvent))
            {
                DrawKill(positionPoint);
                SoundService.PlayPlayerKilled(positionPoint.Team);
            }
            else if (type == typeof(DecoyStartedEvent))
            {
                DrawDecoyStarted(positionPoint);
            }
            else if (type == typeof(DecoyEndedEvent))
            {
                DrawDecoyEnded(positionPoint);
                SoundService.PlayDecoyExploded();
            }
            else if (type == typeof(BombPlantedEvent))
            {
                DrawBombPlanted(positionPoint);
                SoundService.PlayBombPlanted();
            }
            else if (type == typeof(BombExplodedEvent))
            {
                DrawBombExploded(positionPoint);
                SoundService.PlayBombExploded();
            }
            else if (type == typeof(BombDefusedEvent))
            {
                DrawBombDefused(positionPoint);
                SoundService.PlayBombDefused();
            }
        }