Beispiel #1
0
    public override void OnWeapon()
    {
        Debug.DrawRay(transform.position, transform.forward * 10f, Color.red);
        timer += Time.deltaTime;
        if (timer >= rate && Physics.SphereCast(transform.position, 1f, transform.forward, out RaycastHit hit) && isActive)
        {
            // GetComponentInParent<TowerAudio>()?.PlayWeaponSound(weaponSound);
            WeaponFired?.Invoke(this);

            timer = 0f;
            projectile pr  = pool.GetNext(projectileSpawnPoint.position, rotTransform.rotation);
            projectile prj = pool.GetNext(projectileSpawnPoint2.position, rotTransform.rotation);


            //Instantiate(projectile, projectileSpawnPoint.position, rotTransform.rotation);
            //Instantiate(projectile, projectileSpawnPoint2.position, rotTransform.rotation);
        }
    }
 public override void OnWeapon()
 {
     Debug.DrawRay(beamStartPoint.position, transform.up * range, Color.red);
     timer += Time.deltaTime;
     if (timer >= rate)
     {
         // GetComponentInParent<TowerAudio>()?.PlayWeaponSound(weaponSound);
         WeaponFired?.Invoke(this);
         timer = 0f;
         Ray        ray = new Ray(beamStartPoint.position, transform.up);
         RaycastHit hitInfo;
         if (Physics.Raycast(ray, out hitInfo, range, layerMask, QueryTriggerInteraction.Collide))
         {
             //hitInfo.collider.GetComponent<Enemy>().TakeDamage();
             //Debug.Log(hitInfo.collider.name);
             Enemy enemy = hitInfo.collider.GetComponent <Enemy>();
             //Debug.Log(enemy == null);
             enemy?.TakeDamage();
         }
     }
 }
Beispiel #3
0
        private void HandleCurrentEvents()
        {
            foreach (BaseEvent baseEvent in currentTick.Events)
            {
                switch (baseEvent.Type)
                {
                case EventType.MatchStarted:
                    MatchStarted?.Invoke(this, baseEvent);
                    break;

                case EventType.RoundAnnounceMatchStarted:

                    break;

                case EventType.RoundStart:
                    RoundStart?.Invoke(this, (RoundStartEvent)baseEvent);
                    break;

                case EventType.RoundEnd:
                    RoundEnd?.Invoke(this, (RoundEndEvent)baseEvent);
                    break;

                case EventType.WinPanelMatch:
                    WinPanelMatch?.Invoke(this, baseEvent);
                    break;

                case EventType.RoundFinal:
                    break;

                case EventType.LastRoundHalf:
                    break;

                case EventType.RoundOfficiallyEnd:
                    RoundOfficiallyEnd?.Invoke(this, baseEvent);
                    break;

                case EventType.RoundMVP:
                    RoundMVP?.Invoke(this, (RoundMVPEvent)baseEvent);
                    break;

                case EventType.FreezetimeEnded:
                    FreezetimeEnded?.Invoke(this, baseEvent);
                    break;

                case EventType.PlayerKilled:
                    PlayerKilled?.Invoke(this, (PlayerKilledEvent)baseEvent);
                    break;

                case EventType.PlayerTeam:
                    PlayerTeam?.Invoke(this, (PlayerTeamEvent)baseEvent);
                    break;

                case EventType.WeaponFired:
                    WeaponFired?.Invoke(this, (WeaponFiredEvent)baseEvent);
                    break;

                case EventType.SmokeNadeStarted:
                    SmokeNadeStarted?.Invoke(this, (SmokeNadeStartedEvent)baseEvent);
                    break;

                case EventType.SmokeNadeEnded:
                    SmokeNadeEnded?.Invoke(this, (SmokeNadeEndedEvent)baseEvent);
                    break;

                case EventType.DecoyNadeStarted:
                    DecoyNadeStarted?.Invoke(this, (DecoyNadeStartedEvent)baseEvent);
                    break;

                case EventType.DecoyNadeEnded:
                    DecoyNadeEnded?.Invoke(this, (DecoyNadeEndedEvent)baseEvent);
                    break;

                case EventType.FireNadeStarted:
                    FireNadeStarted?.Invoke(this, (FireNadeStartedEvent)baseEvent);
                    break;

                case EventType.FireNadeWithOwnerStarted:
                    FireNadeWithOwnerStarted?.Invoke(this, (FireNadeWithOwnerStartedEvent)baseEvent);
                    break;

                case EventType.FireNadeEnded:
                    FireNadeEnded?.Invoke(this, (FireNadeEndedEvent)baseEvent);
                    break;

                case EventType.FlashNadeExploded:
                    FlashNadeExploded?.Invoke(this, (FlashNadeExplodedEvent)baseEvent);
                    break;

                case EventType.ExplosiveNadeExploded:
                    ExplosiveNadeExploded?.Invoke(this, (ExplosiveNadeExplodedEvent)baseEvent);
                    break;

                case EventType.NadeReachedTarget:
                    NadeReachedTarget?.Invoke(this, (NadeReachedTargetEvent)baseEvent);
                    break;

                case EventType.BombBeginPlant:
                    BombBeginPlant?.Invoke(this, (BombBeginPlantEvent)baseEvent);
                    break;

                case EventType.BombAbortPlant:
                    BombAbortPlant?.Invoke(this, (BombAbortPlantEvent)baseEvent);
                    break;

                case EventType.BombPlanted:
                    BombPlanted?.Invoke(this, (BombPlantedEvent)baseEvent);
                    break;

                case EventType.BombDefused:
                    BombDefused?.Invoke(this, (BombDefusedEvent)baseEvent);
                    break;

                case EventType.BombExploded:
                    BombExploded?.Invoke(this, (BombExplodedEvent)baseEvent);
                    break;

                case EventType.BombBeginDefuse:
                    BombBeginDefuse?.Invoke(this, (BombBeginDefuseEvent)baseEvent);
                    break;

                case EventType.BombAbortDefuse:
                    BombAbortDefuse?.Invoke(this, (BombAbortDefuseEvent)baseEvent);
                    break;

                case EventType.PlayerHurt:
                    PlayerHurt?.Invoke(this, (PlayerHurtEvent)baseEvent);
                    break;

                case EventType.Blind:
                    Blind?.Invoke(this, (BlindEvent)baseEvent);
                    break;

                case EventType.PlayerBind:
                    PlayerBind?.Invoke(this, (PlayerBindEvent)baseEvent);
                    break;

                case EventType.PlayerDisconnect:
                    PlayerDisconnect?.Invoke(this, (PlayerDisconnectEvent)baseEvent);
                    break;

                case EventType.SayText:
                    SayText?.Invoke(this, (SayTextEvent)baseEvent);
                    break;

                case EventType.SayText2:
                    SayText2?.Invoke(this, (SayText2Event)baseEvent);
                    break;

                case EventType.PlayerJump:
                    PlayerJump?.Invoke(this, (PlayerJumpEvent)baseEvent);
                    break;

                case EventType.PlayerFootstep:
                    PlayerFootstep?.Invoke(this, (PlayerFootstepEvent)baseEvent);
                    break;

                case EventType.OtherDeath:
                    OtherDeath?.Invoke(this, (OtherDeathEvent)baseEvent);
                    break;

                case EventType.EntitySpawned:
                    EntitySpawned?.Invoke(this, (EntitySpawnedEvent)baseEvent);
                    break;

                case EventType.EntityRemoved:
                    EntityRemoved?.Invoke(this, (EntityRemovedEvent)baseEvent);
                    break;

                default:
                    break;
                }
            }
        }