Example #1
0
    private void SelectTeam(int playerNumber)
    {
        playerPhase[playerNumber] = SelectionPhase.Ready;
        gameData.SetPlayerTeam(playerNumber, _playerObjects[playerNumber].Team);
        ECharacter selectedChar = gameData.GetPlayerCharacter(playerNumber);

        switch (selectedChar)
        {
        case ECharacter.Cat:
            char1TeamText.text = "Ready";
            break;

        case ECharacter.Computer:
            char2TeamText.text = "Ready";
            break;

        case ECharacter.MallCop:
            char3TeamText.text = "Ready";
            break;

        case ECharacter.Sushi:
            char4TeamText.text = "Ready";
            break;
        }
    }
Example #2
0
        public void SelectCharacter(ECharacter character)
        {
            // check
            if ((_currentContext.Player.Character & character) == 0)
            {
                throw new Exception("Invalid character");
            }

            // set character
            _currentContext.Player.Character = character;
            _currentContext.Player.HP        = character.GetHP();
            if (_currentContext.Player.Role == ERole.sheriff)
            {
                _currentContext.Player.HP++;
            }

            // get cards
            var packToTake = _databaseContext.Cards
                             .Where(c => c.PackToTakeId == _currentContext.Game.Id)
                             .OrderBy(c => c.Index)
                             .Take(character.GetHP())
                             .Select((card, index) => new { card, index });

            foreach (var pair in packToTake)
            {
                pair.card.PackToTakeId = null;
                pair.card.PlayerHandId = _currentContext.Player.Id;
                pair.card.Index        = pair.index;
            }
        }
        private IEnumerator Talk(ECharacter character, string text)
        {
            m_Bubble.SetActive(true);
            m_Subtitles.gameObject.SetActive(true);
            switch (character)
            {
            case ECharacter.Boy:
                m_Bubble.SetData(m_BoyCharacter.BubbleAnchor.position, m_BoyCharacter.Color);
                m_Subtitles.text = string.Format("{0}: {1}", "Boy", text);     // TODO: Translated name
                yield return(m_BoyCharacter.Talk(text));

                m_Bubble.SetActive(false);
                m_Subtitles.gameObject.SetActive(false);
                break;

            case ECharacter.Girl:
                m_Bubble.SetData(m_GirlCharacter.BubbleAnchor.position, m_GirlCharacter.Color);
                m_Subtitles.text = string.Format("{0}: {1}", "Girl", text);     // TODO: Translated name
                yield return(m_GirlCharacter.Talk(text));

                break;
            }

            m_Subtitles.gameObject.SetActive(false);
            m_Bubble.SetActive(false);
        }
 protected virtual void PlaySoundEventHandler(EventData eventData, ECharacter characterType)
 {
     if (this.BehaviourObservesEvent(eventData))
     {
         //Debug.Log("SOUND EVENT!");
         int         randomSFX = -1;
         AudioClip[] temp      = null;
         Debug.Log("Character Type!" + characterType);
         if (characterType == ECharacter.Pigeon && _pigeonTalk.GetLength(0) != 0)
         {
             randomSFX = Random.Range(0, _pigeonTalk.GetLength(0) - 1);
             temp      = _pigeonTalk;
         }
         if (characterType == ECharacter.BitchinPigeon && _bitchinPigeon.GetLength(0) != 0)
         {
             randomSFX = Random.Range(0, _bitchinPigeon.GetLength(0) - 1);
             temp      = _bitchinPigeon;
         }
         else if (characterType == ECharacter.Penquin && _penquinTaunts.GetLength(0) != 0)
         {
             randomSFX = Random.Range(0, _penquinTaunts.GetLength(0) - 1);
             temp      = _penquinTaunts;
         }
         else if (characterType == ECharacter.Edison && _edisonTaunts.GetLength(0) != 0)
         {
             randomSFX = Random.Range(0, _edisonTaunts.GetLength(0) - 1);
             temp      = _edisonTaunts;
         }
         if (randomSFX > -1 && temp != null)
         {
             //Debug.Log("Temp Count: " + temp.GetLength(0));
             OnPlaySound(temp[randomSFX]);
         }
     }
 }
        /// <summary>
        /// 返回值为Player
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="protocol"></param>
        public void CreateRole(Conn conn, ProtocolBase protocol)
        {
            int           start = sizeof(Int32) * 3;
            ProtocolBytes p     = protocol as ProtocolBytes;
            string        name  = p.GetString(start, ref start);
            ProtocolBytes result;

            if (dataMgr.GetPlayerIDByName(name) != -1)
            {
                result = new ProtocolBytes(requestCode, EActionCode.CreateRole, EReturnCode.RepeatName);
            }
            else
            {
                string     jobStr = p.GetString(start, ref start);
                EPlayerJob job    = (EPlayerJob)Enum.Parse(typeof(EPlayerJob), jobStr);

                string     characterStr = p.GetString(start, ref start);
                ECharacter character    = (ECharacter)Enum.Parse(typeof(ECharacter), characterStr);

                bool        isSuccess  = dataMgr.CreateRole(conn.user.ID, name, job, character);
                EReturnCode returnCode = isSuccess ? EReturnCode.Success : EReturnCode.Failed;
                result = new ProtocolBytes(requestCode, EActionCode.CreateRole, returnCode);
            }
            Send(conn, result);
        }
Example #6
0
    public void AddAssist(object _sender, EventArgs _eventArgs)
    {
        CharacterAssistEventArgs assistArgs = (CharacterAssistEventArgs)_eventArgs;

        if (assistArgs == null)
        {
            return;
        }

        Character character = (Character)_sender;

        if (character != null)
        {
            if (Enum.TryParse(assistArgs.GetName, out ECharacter result))// if u want to discard result, use _
            {
                ECharacter parsedEnum = result;
                MyCharacterAssistRecords[parsedEnum] += assistArgs.GetTimes;
                Debug.Log(assistArgs.GetName + " Assist times: " + MyCharacterAssistRecords[parsedEnum].ToString());
            }
            else
            {
                MyCharacterAssistRecords[character.GetECharacter] += assistArgs.GetTimes;
                Debug.Log(assistArgs.GetName + " Assist times: " + MyCharacterAssistRecords[character.GetECharacter].ToString());
            }

            Debug.Log(assistArgs.GetMessage);
        }
    }
Example #7
0
    private void Awake()
    {
        if (playerNumberTag)
        {
            playerNumberTag.text = playerNumber.ToString();
        }
        //powerupParticle.Stop();
        isFrozen   = false;
        isShrunken = false;

        thrusterSpeed      = defaultThrusterSpeed;
        defaultMass        = rigid.mass;
        killList           = new List <PlayerController>();
        rigid.gravityScale = 0;
        rightStickHorz     = 1;
        rightStickVert     = 0;
        shield             = GetComponentInChildren <Shield>();
        animator           = transform.GetComponentInChildren <Animator>();
        team            = gameData.GetPlayerTeam(playerNumber - 1);
        chosenCharacter = gameData.GetPlayerCharacter(playerNumber - 1);
        shield.SetTeamColor(team);
        acceptingInput = true;

        dashController = GetComponent <PlayerDashController>();

        if (gameManagerInstance != null || GameManager.TryGetInstance(out gameManagerInstance))
        {
            gameManagerInstance.LoadPlayer(this, playerNumber);
        }
    }
Example #8
0
        /* Handles Command */
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            try
            {
                ECharacter character = caller.Player.GetModPlayer <ECharacter>();
                long       xp        = character.Experience / character.GetExperienceNeededForLevel(character.Level);
                character.Level      = int.Parse(args[0]);
                character.Experience = character.GetExperienceNeededForLevel(character.Level) * xp;

                foreach (PlayerStats stat in Enum.GetValues(typeof(PlayerStats)))
                {
                    character.BaseStats[stat] += 1;
                }

                Main.NewText("Level Increased To: " + character.Level, 43, 255, 128);
            }
            catch (Exception e)
            {
                ECharacter character = caller.Player.GetModPlayer <ECharacter>();

                Main.NewText("Please use: " + Usage, 255, 43, 43);
                Main.NewText("Your Current Level Is: " + character.Level, 255, 223, 63);
                Main.NewText("Your Total Experience Is: " + character.TotalExperience, 255, 223, 63);
                Main.NewText("Experience To Next Level: " + character.Experience, 255, 223, 63);
                ModLoader.GetMod(EConstants.ModName).Logger.InfoFormat("@Command :: " + e);
            }
        }
Example #9
0
 /* Read/Write Experience Packet */
 public static void Read(BinaryReader reader)
 {
     if (Main.netMode == NetmodeID.MultiplayerClient)
     {
         ECharacter character = Main.LocalPlayer.GetModPlayer <ECharacter>();
         character.AddExperience((long)reader.ReadInt64());
     }
 }
Example #10
0
    private void Update()
    {
        if (acceptingInput)
        {
            leftStickHorz   = player.GetAxis("MoveHorizontal");
            leftStickVert   = player.GetAxis("MoveVertical");
            leftTriggerAxis = player.GetAxis("Jetpack");

            rightStickHorz = player.GetAxis("RightStickHorizontal");
            rightStickVert = player.GetAxis("RightStickVertical");
        }
        else
        {
            leftStickHorz   = 0;
            leftStickVert   = 0;
            leftTriggerAxis = 0;
        }

        if (player.GetAxis("Taunt") != 0)
        {
            animator.SetBool("isTaunting", true);
            if (gameManagerInstance != null || GameManager.TryGetInstance(out gameManagerInstance))
            {
                if (!audioSource.isPlaying)
                {
                    ECharacter character = gameData.GetPlayerCharacter(playerNumber - 1);
                    audioSource.PlayOneShot(gameManagerInstance.GetTauntSound(character));
                }
            }
        }
        else
        {
            animator.SetBool("isTaunting", false);
        }



        if (remainingFreezeTime > 0)
        {
            rigid.velocity       = new Vector3(0, 0, 0);
            remainingFreezeTime -= Time.deltaTime;
            if (remainingFreezeTime <= 0)
            {
                isFrozen     = false;
                sprite.color = Color.white;
            }
        }

        if (!isFrozen)
        {
            RotateShield();
            if (!movementDisabled)
            {
                Flip();
            }
        }
    }
Example #11
0
 public static void Read(BinaryReader reader)
 {
     if (Main.netMode == NetmodeID.Server)
     {
         ECharacter character = Main.player[reader.ReadInt32()].GetModPlayer <ECharacter>();
         character.Level = reader.ReadInt32();
         character.BaseStats[PlayerStats.STR] = reader.ReadInt32();
         character.BaseStats[PlayerStats.DEX] = reader.ReadInt32();
         character.BaseStats[PlayerStats.LUK] = reader.ReadInt32();
         character.BaseStats[PlayerStats.INT] = reader.ReadInt32();
     }
 }
Example #12
0
        public static int GetHP(this ECharacter self)
        {
            switch (self)
            {
            case ECharacter.el_gringo:
            case ECharacter.paul_regret:
                return(3);

            default:
                return(4);
            }
        }
Example #13
0
 private GameObject MoveSelectionTokenTo(ECharacter character, GameObject active, IEnumerable <GameObject> tokens)
 {
     foreach (var token in tokens)
     {
         if (token.GetComponentInParent <CharacterInfo>().getCharacterId() != character)
         {
             continue;
         }
         SwitchActiveToken(active, token);
         return(token);
     }
     return(null);
 }
Example #14
0
 public Player(int playerid, string name, int userid, ESex sex, EPlayerJob playerJob, ECharacter character, int gold, int level, int exp, int mapnum, Pos pos)
 {
     ID        = playerid;
     Name      = name;
     UserID    = userid;
     Sex       = sex;
     PlayerJob = playerJob;
     Character = character;
     Gold      = gold;
     Level     = level;
     Exp       = exp;
     MapNum    = mapnum;
     Pos       = pos;
 }
Example #15
0
    public void SetCharacter(ECharacter character)
    {
        selectedCharacter = character;

        navMeshAgent.speed        = characters[(int)character].speed;
        navMeshAgent.angularSpeed = characters[(int)character].speed * 40;
        navMeshAgent.acceleration = characters[(int)character].speed * 40;

        Destroy(prefab);
        prefab = Instantiate(characters[(int)character].prefab, gameObject.transform.position, Quaternion.identity);
        prefab.transform.parent      = gameObject.transform;
        prefab.transform.localScale *= 4;
        prefab.transform.Translate(new Vector3(0, -1, 0));
        prefab.transform.Rotate(new Vector3(-90, 0, 0));
    }
Example #16
0
    public AudioClip GetPlayerRespawnSound(ECharacter character)
    {
        switch (character)
        {
        case ECharacter.Cat:
            return(catRespawnSounds[Random.Range(0, catRespawnSounds.Count)]);

        case ECharacter.Computer:
            return(computerRespawnSounds[Random.Range(0, computerRespawnSounds.Count)]);

        case ECharacter.Sushi:
            return(fishRespawnSounds[Random.Range(0, fishRespawnSounds.Count)]);

        default:     // mallCop
            return(copRespawnSounds[Random.Range(0, copRespawnSounds.Count)]);
        }
    }
Example #17
0
    public AudioClip GetCharacterSFX(ECharacter character, ECharacterAction movement)
    {
        switch (movement)
        {
        case ECharacterAction.Dash:
            return(soundStorage.GetPlayerDashSound(character));

        case ECharacterAction.Death:
            return(soundStorage.GetPlayerDeathSound(character));

        case ECharacterAction.Jetpack:
            return(soundStorage.GetPlayerJetpackSound(character));

        default:     //ECharacterMovement.Jetpack:
            return(soundStorage.GetPlayerJetpackSound(character));
        }
    }
Example #18
0
 public bool CreatePlayer(int userid, string name, EPlayerJob playerJob, ECharacter character)
 {
     try
     {
         MySqlCommand cmd = new MySqlCommand("insert into player(userid,name,playerjob,playercharacter) values(@userid,@name,@playerjob,@character)", sqlConn);
         cmd.Parameters.AddWithValue("@userid", userid);
         cmd.Parameters.AddWithValue("@name", name);
         cmd.Parameters.AddWithValue("@playerjob", playerJob.ToString());
         cmd.Parameters.AddWithValue("@character", character.ToString());
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine("在创建角色的时候出现异常:" + e);
         return(false);
     }
 }
Example #19
0
    private void UndoReady(int playerNumber)
    {
        StopAllCoroutines();
        timerActive               = false;
        timer                     = waitTime;
        timerText.text            = "Waiting...";
        playerPhase[playerNumber] = SelectionPhase.TeamSelect;

        ECharacter selectedChar = gameData.GetPlayerCharacter(playerNumber);
        string     teamText;

        if (_playerObjects[playerNumber].Team == ETeam.RedTeam)
        {
            teamText = "Red Team";
        }
        else
        {
            teamText = "Blue Team";
        }
        switch (selectedChar)
        {
        case ECharacter.Cat:
            char1Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char1TeamText.text = teamText;
            break;

        case ECharacter.Computer:
            char2Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char2TeamText.text = teamText;
            break;

        case ECharacter.MallCop:
            char3Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char3TeamText.text = teamText;
            break;

        case ECharacter.Sushi:
            char4Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char4TeamText.text = teamText;
            break;
        }
    }
Example #20
0
        private Player GetPlayerByReader(MySqlDataReader reader)
        {
            int        playerid  = reader.GetInt32("playerid");
            int        userid    = reader.GetInt32("userid");
            string     name      = reader.GetString("name");
            ESex       sex       = (ESex)Enum.Parse(typeof(ESex), reader.GetString("sex"));
            EPlayerJob job       = (EPlayerJob)Enum.Parse(typeof(EPlayerJob), reader.GetString("playerjob"));
            ECharacter character = (ECharacter)Enum.Parse(typeof(ECharacter), reader.GetString("playercharacter"));
            int        gold      = reader.GetInt32("gold");
            int        level     = reader.GetInt32("level");
            int        exp       = reader.GetInt32("exp");
            int        mapNum    = reader.GetInt32("mapnum");
            float      posx      = reader.GetFloat("posx");
            float      posy      = reader.GetFloat("posy");
            float      posz      = reader.GetFloat("posz");
            Pos        pos       = new Pos(posx, posy, posz);
            Player     player    = new Player(playerid, name, userid, sex, job, character, gold, level, exp, mapNum, pos);

            return(player);
        }
Example #21
0
    public AudioClip GetPlayerTauntSound(ECharacter character)
    {
        switch (character)
        {
        case ECharacter.Cat:
            return(catTauntSounds[Random.Range(0, catTauntSounds.Count)]);

        case ECharacter.Computer:
            return(computerTauntSounds[Random.Range(0, computerTauntSounds.Count)]);

        case ECharacter.Sushi:
            return(fishTauntSounds[Random.Range(0, fishTauntSounds.Count)]);

        case ECharacter.MallCop:
            return(copTauntSounds[Random.Range(0, copTauntSounds.Count)]);

        default:     // for now we only have one asset, and its super standin, i mean quality (R.I.P. 4/8/18)
            return(computerTauntSounds[Random.Range(0, computerTauntSounds.Count)]);
        }
    }
Example #22
0
    public void SetupCharacter(ECharacter e, int version)
    {
        switch (e)
        {
        case ECharacter.MallCop:
            SetupCharacter(this.cop, version);
            break;

        case ECharacter.Computer:
            SetupCharacter(this.computer, version);
            break;

        case ECharacter.Cat:
            SetupCharacter(this.cat, version);
            break;

        case ECharacter.Sushi:
            SetupCharacter(this.sushi, version);
            break;
        }
    }
Example #23
0
    private void ChangeTeam(int playerNumber, int direction)
    {
        //TODO: Move to CharacterSelectObjects class?
        _playerObjects[playerNumber].Team = GetNextTeam(_playerObjects[playerNumber].Team);
        ECharacter selectedChar = gameData.GetPlayerCharacter(playerNumber);
        string     teamText;

        if (_playerObjects[playerNumber].Team == ETeam.RedTeam)
        {
            teamText = "Red Team";
        }
        else
        {
            teamText = "Blue Team";
        }
        switch (selectedChar)
        {
        case ECharacter.Cat:
            char1Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char1TeamText.text = teamText;
            break;

        case ECharacter.Computer:
            char2Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char2TeamText.text = teamText;
            break;

        case ECharacter.MallCop:
            char3Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char3TeamText.text = teamText;
            break;

        case ECharacter.Sushi:
            char4Image.color   = GetTeamColor(_playerObjects[playerNumber].Team);
            char4TeamText.text = teamText;
            break;
        }
    }
Example #24
0
 public void AddKill(ECharacter _eCharacter)
 {
     MyCharacterKillRecords[_eCharacter]++;
     Debug.Log(_eCharacter.ToString() + " kill times: " + MyCharacterKillRecords[_eCharacter].ToString());
 }
Example #25
0
 public AudioClip GetTauntSound(ECharacter character)
 {
     return(soundStorage.GetPlayerTauntSound(character));
 }
Example #26
0
 public AudioClip GetCharacterBumpSFX(ECharacter character)
 {
     return(soundStorage.GetPlayerBumpSound(character));
 }
Example #27
0
 public bool CreateRole(int userid, string name, EPlayerJob job, ECharacter character)
 {
     return(playerDAO.CreatePlayer(userid, name, job, character));
 }
Example #28
0
 public PSettings(ECharacter character, ETeam team)
 {
     Character = character;
     Team      = team;
 }
Example #29
0
 public CharacterDefinition(ECharacter character, float speed)
 {
     this.character = character;
     this.speed     = speed;
 }
Example #30
0
 public void SetPlayerCharacter(int playerNumber, ECharacter eCharacter)
 {
     playerCharacters[playerNumber] = eCharacter;
 }