Пример #1
0
 //Function for player to score
 public void SetPlayerScore(PlayerTypes playerType)
 {
     if (GameObject.FindGameObjectWithTag(playerType.ToString()).GetComponent <IReceivesReward <float> >() != null)
     {
         GameObject player = GameObject.FindGameObjectWithTag(playerType.ToString()) as GameObject;
         try
         {
             player.GetComponent <IReceivesReward <float> >().ReceiveReward(RewardTypes.EnemyKill, onKillReward);
         }
         catch (Exception e)
         {
             Debug.Log(e);
         }
         Debug.Log(playerType.ToString() + " rewarded " + onKillReward.ToString() + " points");
     }
 }
Пример #2
0
    // ----------------------------------------------------------------
    //  Serializing
    // ----------------------------------------------------------------
    override public PropData ToData()
    {
        SnackData data = new SnackData {
            pos        = pos,
            playerType = playerType.ToString(),
            travelMind = new TravelMindData(travelMind),
        };

        return(data);
    }
Пример #3
0
        public IPlayer Generate(PlayerTypes playerType)
        {
            switch (playerType)
            {
            case PlayerTypes.Human:
                return(new HumanPlayer());

            case PlayerTypes.Random:
                return(new RandomPlayer());

            case PlayerTypes.Tactical:
                return(new TacticalPlayer());
            }

            throw new Exception($"No player implements the player type {playerType.ToString()}");
        }
Пример #4
0
 // ----------------------------------------------------------------
 //  Update
 // ----------------------------------------------------------------
 private void OnGUI()
 {
     if (!isCharTrial)   // Don't show ANYthing in a CharTrial.
     //GUI.color = Color.black;
     {
         GUIStyle style = new GUIStyle();
         style.fontSize = 24;
         for (int i = 0; i < lineup.Lineup.Count; i++)
         {
             PlayerTypes pt = lineup.Lineup[i];
             //GUI.color = lineup.CurrTypeIndex == i ? new Color(1,0.8f,0) : Color.black;
             style.fontStyle = lineup.CurrTypeIndex == i ? FontStyle.Bold : FontStyle.Normal;
             GUI.Label(new Rect(14, Screen.height - 40 - i * 30, 400, 80), pt.ToString(), style);
         }
     }
 }
Пример #5
0
    public Player CreatePlayer(int x, int y, PlayerTypes type)
    {
        Transform parent = this.container.Find("Entities/Players");

        GameObject obj = GameObject.Instantiate(prefabs.players[type]);
        obj.transform.SetParent(parent, false);
        obj.name = type.ToString(); //"Player";
        Player player = obj.GetComponent<Player>();
        player.Init(this, x, y, Color.white);

        player.type = type;

        return player;
    }
Пример #6
0
 public static void SaveLastPlayedType(PlayerTypes _type)
 {
     SaveStorage.SetString(SaveKeys.LastPlayedPlayerType, _type.ToString());
 }
Пример #7
0
    private void SwapPlayerType(Player player)
    {
        PlayerTypes playerNewType = CharTypeInMe;
        PlayerTypes myNewType     = player.PlayerType();

        // Set Player's type!
        MyRoom.GameController.SetPlayerType(playerNewType);
        // Set/save my type!
        SetCharTypeInMe(myNewType);
        SaveStorage.SetString(SaveKeys.CharBarrelTypeInMe(MyRoom.MyRoomData, myIndex), myNewType.ToString());
        // Reset timeWhenCanSensePlayer!
        timeWhenCanSensePlayer = Time.time + 0.1f;
    }
Пример #8
0
    public RoomData GetPlayerTrialStartRoom(PlayerTypes pt)
    {
        string roomKey = pt.ToString() + "TrialStart"; // TEMP HARDCODED finding.

        return(GetRoomData(GameProperties.TEMP_TrialsWorldIndex, roomKey, false));
    }
Пример #9
0
 public static string IsPlayerTypeUnlocked(PlayerTypes playerType)
 {
     return("IsPlayerTypeUnlocked_" + playerType.ToString());
 }