示例#1
0
        // BOLT

        public override void OnEvent(TotemWallHit evnt)
        {
            if (BoltNetwork.IsServer)
            {
                Debug.Log("TotemWallHit event received.");
                IncreaseScore(evnt.Team.ToTeam().OppositeTeam(), 1);
                SendScoreIncreasedEvent(evnt.Team.ToTeam().OppositeTeam());
            }
        }
示例#2
0
        // BOLT

        public override void OnEvent(TotemWallHit evnt)
        {
            /*
             * var scorerTeam = evnt.Team.ToTeam().OppositeTeam();
             * if (_kartRoot.isOwner && scorerTeam == _playerSettings.ColorSettings.TeamEnum)
             * {
             *  TeleportOnSpawn();
             * }
             */
            TeleportOnSpawn();
        }
示例#3
0
        public override void OnEvent(TotemWallHit evnt)
        {
            if (evnt.Team.ToTeam() == Team.Red)
            {
                _wallHitIterationRed++;
                switch (_wallHitIterationRed)
                {
                case 1:
                    _redStep1.Play();
                    PlayRandomCrowdSound();
                    break;

                case 2:
                    _redStep2.Play();
                    PlayRandomCrowdSound();
                    break;

                case 3:
                    _redStep4Win.Play();
                    _crowdStep4Win.Play();
                    break;
                }
            }
            else
            {
                _wallHitIterationBlue++;
                switch (_wallHitIterationBlue)
                {
                case 1:
                    _blueStep1.Play();
                    PlayRandomCrowdSound();
                    break;

                case 2:
                    _blueStep2.Play();
                    PlayRandomCrowdSound();
                    break;

                case 3:
                    _blueStep4Win.Play();
                    _crowdStep4Win.Play();
                    break;
                }
            }
        }
        // PRIVATE

        private void LoseLife()
        {
            if (OnWallHit != null)
            {
                OnWallHit.Invoke(state.Lives); // Local event
            }

            if (entity.isAttached && entity.isOwner)
            {
                state.Lives--;

                foreach (var totemSpawn in FindObjectsOfType <TotemSpawner>())
                {
                    if (OwnerTeam == Team.Red && totemSpawn.RespawnSide == TotemSpawner.Side.Red)
                    {
                        totemSpawn.RespawnTotem();
                    }
                    else if (OwnerTeam == Team.Blue && totemSpawn.RespawnSide == TotemSpawner.Side.Blue)
                    {
                        totemSpawn.RespawnTotem();
                    }
                }

                TotemWallHit totemWallHitEvent = TotemWallHit.Create();
                totemWallHitEvent.Team = (int)OwnerTeam;
                totemWallHitEvent.Send();

                if (state.Lives <= 0)
                {
                    if (OnWallDestroyed != null)
                    {
                        OnWallDestroyed.Invoke(OwnerTeam);
                    }

                    BoltNetwork.Destroy(gameObject);
                }
            }
        }
示例#5
0
        // BOLT

        public override void OnEvent(TotemWallHit evnt)
        {
            CurrentTeam = evnt.Team.ToTeam();
            ChangeColor(_teamsList.GetSettings(evnt.Team.ToTeam()).ItemsColor);
            StartCoroutine(SecurityRoutine());
        }