Ejemplo n.º 1
0
        private void InitGameAttributes()
        {
            GameAttributes.Add(Attributes.Ticks, 0);
            GameAttributes.Add(Attributes.Rank, 0);
            GameAttributes.Add(Attributes.Coal, 0);
            GameAttributes.Add(Attributes.Electricity, 0);
            GameAttributes.Add(Attributes.PopSize, 0);

            GameAttributes.Add(Attributes.Power, 0);

            GameAttributes.Add(Attributes.Size, 0);
            GameAttributes.Add(Attributes.SightRadius, 0);
            GameAttributes.Add(Attributes.Armour, 0);
            GameAttributes.Add(Attributes.Hitpoints, 0);
            GameAttributes.Add(Attributes.LandSpeed, 0);
            GameAttributes.Add(Attributes.WaterSpeed, 0);
            GameAttributes.Add(Attributes.AirSpeed, 0);
            GameAttributes.Add(Attributes.MeleeDamage, 0);

            GameAttributes.Add(Attributes.Range2Damage, 0);
            GameAttributes.Add(Attributes.Range2Max, 0);
            GameAttributes.Add(Attributes.Range2Type, 0);
            GameAttributes.Add(Attributes.Range2Special, 0);
            GameAttributes.Add(Attributes.Melee2Type, 0);

            GameAttributes.Add(Attributes.Range3Damage, 0);
            GameAttributes.Add(Attributes.Range3Max, 0);
            GameAttributes.Add(Attributes.Range3Type, 0);
            GameAttributes.Add(Attributes.Range3Special, 0);
            GameAttributes.Add(Attributes.Melee3Type, 0);

            GameAttributes.Add(Attributes.Range4Damage, 0);
            GameAttributes.Add(Attributes.Range4Max, 0);
            GameAttributes.Add(Attributes.Range4Type, 0);
            GameAttributes.Add(Attributes.Range4Special, 0);
            GameAttributes.Add(Attributes.Melee4Type, 0);

            GameAttributes.Add(Attributes.Range5Damage, 0);
            GameAttributes.Add(Attributes.Range5Max, 0);
            GameAttributes.Add(Attributes.Range5Type, 0);
            GameAttributes.Add(Attributes.Range5Special, 0);
            GameAttributes.Add(Attributes.Melee5Type, 0);

            GameAttributes.Add(Attributes.Range8Damage, 0);
            GameAttributes.Add(Attributes.Range8Max, 0);
            GameAttributes.Add(Attributes.Range8Type, 0);
            GameAttributes.Add(Attributes.Range8Special, 0);
            GameAttributes.Add(Attributes.Melee8Type, 0);

            GameAttributes.Add(Attributes.IsLand, 0);
            GameAttributes.Add(Attributes.IsSwimmer, 0);
            GameAttributes.Add(Attributes.IsFlyer, 0);

            foreach (string ability in AbilityNames.Abilities)
            {
                GameAttributes.Add(ability, 0);
            }

            GameAttributes.Add("damage", 0);
        }
Ejemplo n.º 2
0
    public GameCharacter()
    {
        _attributes = new GameAttributes();
        _baseAttr = new GameAttributes();
        _damageAttr = new GameAttributes();

        UpdateAttributesEquipment();
    }
Ejemplo n.º 3
0
    public GameCharacter()
    {
        _attributes = new GameAttributes();
        _baseAttr   = new GameAttributes();
        _damageAttr = new GameAttributes();

        UpdateAttributesEquipment();
    }
Ejemplo n.º 4
0
    public void setAttributes(string _nam, string _des, int _spr, int _pri)
    {
        _attributes  = new GameAttributes();
        _name        = _nam;
        _description = _des;
        _sprite      = _spr;
        _price       = _pri;

        _color = new Color(Random.Range(0, 10) * 0.1f, Random.Range(0, 10) * 0.1f, Random.Range(0, 10) * 0.1f);
    }
Ejemplo n.º 5
0
 private void SetMeleeType()
 {
     foreach (Limb limb in Enum.GetValues(typeof(Limb)))
     {
         if (GameAttributes.ContainsKey(Attributes.MeleeType[(int)limb]))
         {
             GameAttributes[Attributes.MeleeType[(int)limb]] = Calculator.GetMeleeType(limb);
         }
     }
 }
Ejemplo n.º 6
0
 private void SetRangeSpecial()
 {
     foreach (Limb limb in Enum.GetValues(typeof(Limb)))
     {
         if (GameAttributes.ContainsKey(Attributes.RangeSpecial[(int)limb]))
         {
             GameAttributes[Attributes.RangeSpecial[(int)limb]] = Calculator.GetRangeSpecial(limb);
         }
     }
 }
Ejemplo n.º 7
0
 private void CalcRangeMax()
 {
     foreach (Limb limb in Enum.GetValues(typeof(Limb)))
     {
         if (GameAttributes.ContainsKey(Attributes.RangeMax[(int)limb]))
         {
             GameAttributes[Attributes.RangeMax[(int)limb]] = Calculator.CalcRangeMax(limb);
         }
     }
 }
        public HttpResponseMessage SelectAllAttributes()
        {
            GameAttributes     attributes = new GameAttributes();
            GameProfileService gPSvc      = new GameProfileService();

            try
            {
                attributes = gPSvc.SelectAllAttributes();
                return(Request.CreateResponse(HttpStatusCode.OK, attributes));
            }
            catch (System.Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Ejemplo n.º 9
0
    public GameObject ForEachGame(string data)
    {
        // parsing json data using SimpleJSON
        var jsonData = JSON.Parse(data);
        var games    = jsonData["user_game_list"];

        // Make the root object to save all game & treasure objects
        GameObject gameTreasurePanel = new GameObject();

        gameTreasurePanel.tag = "GameTreasurePanel";

        // Make game objects
        for (int i = 0; i < games.Count; i++)
        {
            //make new game panel
            GameObject     newGame = (GameObject)Instantiate(game);
            GameAttributes ga      = newGame.GetComponent <GameAttributes>();
            var            cur     = games[i];
            // attach game attributes
            ga.SetAsChildOf(gameTreasurePanel);
            ga.SetAttributes(cur["game_id"].AsInt.ToString(), cur["game_name"], cur["treasure_count"].AsInt, cur["maker_id"], cur["status"].AsInt);
            newGame.name = cur["game_id"].AsInt.ToString();
            newGame.tag  = "Games";
            // parse treasures
            var treasures = cur["treasures"];

            /*
             *          // check if there is an error
             *          if (cur["treasure_count"].AsInt != treasures.Count)
             *          {
             *                  Debug.Log ("something wrong with treasure_count");
             *                  return gameTreasurePanel;
             *          }
             */
            // make treasure objects
            for (int j = 0; j < treasures.Count; j++)
            {
                var    curT        = treasures[j];
                string treasure_id = curT["treasure_id"];
                MakeNewTreasure(newGame, curT["treasure_id"].AsInt.ToString(), curT["treasure_name"], curT["destination"], curT["game_id"].AsInt.ToString(),
                                curT["location"], curT["point"].AsInt, curT["catchgame_cat"].AsInt, curT["target_img_name"], curT["treasure_img_name"], curT["question"], curT["answer"]);
            }
        }

        return(gameTreasurePanel);
    }
Ejemplo n.º 10
0
 public void UpdateAttributesEquipment()
 {
     _attributes = baseAttr;
     if (this.leftArm != null)
     {
         _attributes.agility    += this.leftArm.attributes.agility;
         _attributes.alchemy    += this.leftArm.attributes.alchemy;
         _attributes.endurance  += this.leftArm.attributes.endurance;
         _attributes.strength   += this.leftArm.attributes.strength;
         _attributes.technology += this.leftArm.attributes.technology;
     }
     if (this.leftLeg != null)
     {
         _attributes.agility    += this.leftLeg.attributes.agility;
         _attributes.alchemy    += this.leftLeg.attributes.alchemy;
         _attributes.endurance  += this.leftLeg.attributes.endurance;
         _attributes.strength   += this.leftLeg.attributes.strength;
         _attributes.technology += this.leftLeg.attributes.technology;
     }
     if (this.rightArm != null)
     {
         _attributes.agility    += this.rightArm.attributes.agility;
         _attributes.alchemy    += this.rightArm.attributes.alchemy;
         _attributes.endurance  += this.rightArm.attributes.endurance;
         _attributes.strength   += this.rightArm.attributes.strength;
         _attributes.technology += this.rightArm.attributes.technology;
     }
     if (this.rightLeg != null)
     {
         _attributes.agility    += this.rightLeg.attributes.agility;
         _attributes.alchemy    += this.rightLeg.attributes.alchemy;
         _attributes.endurance  += this.rightLeg.attributes.endurance;
         _attributes.strength   += this.rightLeg.attributes.strength;
         _attributes.technology += this.rightLeg.attributes.technology;
     }
 }
Ejemplo n.º 11
0
    public void NewPos()
    {
        var hit = GameAttributes.RayDown(transform);

        transform.position = new Vector3(transform.position.x, hit.point.y + 1f, transform.position.z);
    }
Ejemplo n.º 12
0
        public void AddGame(PartialDefinition partial)
        {
            object baseObj = globalEnvironment.LookupSymbol(partial.BaseName);

            if (baseObj == null)
            {
                throw new Exception("Specified base game is unknown: " + partial.BaseName);
            }
            if (!(baseObj is Type))
            {
                throw new Exception("Specified base game is not of correct type: " + partial.BaseName);
            }
            Type baseGameType = (Type)baseObj;

            if (!baseGameType.IsSubclassOf(typeof(Game)))
            {
                throw new Exception("Specified base game is not of correct type: " + partial.BaseName);
            }
            Type newGameType = classFactory.CreateGameWrapper(moduleBuilder, baseGameType, partial);

            object[]      attrobjs          = baseGameType.GetCustomAttributes(typeof(GameAttribute), false);
            GameAttribute baseGameAttribute = (GameAttribute)attrobjs[0];

            int[] geometryParameters = baseGameAttribute.GeometryParameters;
            if (geometryParameters.Length == 0)
            {
                geometryParameters = new int[] { (int)(partial.VariableAssignments["NumFiles"]), (int)(partial.VariableAssignments["NumRanks"]) }
            }
            ;
            GameAttribute       newGameAttribute  = new GameAttribute(partial.Name, baseGameAttribute.GeometryType, geometryParameters);
            AppearanceAttribute newAppearanceAttr = new AppearanceAttribute();
            bool appearancePropertiesEncountered  = false;

            if (partial.VariableAssignments.ContainsKey("Invented"))
            {
                newGameAttribute.Invented = (string)partial.VariableAssignments["Invented"];
            }
            if (partial.VariableAssignments.ContainsKey("InventedBy"))
            {
                newGameAttribute.InventedBy = (string)partial.VariableAssignments["InventedBy"];
            }
            if (partial.VariableAssignments.ContainsKey("GameDescription1"))
            {
                newGameAttribute.GameDescription1 = (string)partial.VariableAssignments["GameDescription1"];
                if (partial.VariableAssignments.ContainsKey("GameDescription2"))
                {
                    newGameAttribute.GameDescription2 = (string)partial.VariableAssignments["GameDescription2"];
                }
            }
            if (partial.VariableAssignments.ContainsKey("Tags"))
            {
                newGameAttribute.Tags = (string)partial.VariableAssignments["Tags"];
            }
            else
            {
                newGameAttribute.Tags = "";
            }
            if (partial.VariableAssignments.ContainsKey("ColorScheme"))
            {
                appearancePropertiesEncountered = true;
                newAppearanceAttr.ColorScheme   = (string)partial.VariableAssignments["ColorScheme"];
            }
            if (partial.VariableAssignments.ContainsKey("NumberOfColors"))
            {
                appearancePropertiesEncountered        = true;
                newAppearanceAttr.NumberOfSquareColors = Convert.ToInt32(partial.VariableAssignments["NumberOfColors"]);
            }
            if (partial.VariableAssignments.ContainsKey("PieceSet"))
            {
                appearancePropertiesEncountered = true;
                newAppearanceAttr.PieceSet      = (string)partial.VariableAssignments["PieceSet"];
            }
            if (partial.VariableAssignments.ContainsKey("Player1Color"))
            {
                appearancePropertiesEncountered = true;
                newAppearanceAttr.Player1Color  = (string)partial.VariableAssignments["Player1Color"];
            }
            if (partial.VariableAssignments.ContainsKey("Player2Color"))
            {
                appearancePropertiesEncountered = true;
                newAppearanceAttr.Player1Color  = (string)partial.VariableAssignments["Player2Color"];
            }
            GameTypes.Add(partial.Name, newGameType);
            GameAttributes.Add(partial.Name, newGameAttribute);
            if (appearancePropertiesEncountered)
            {
                GameAppearances.Add(partial.Name, newAppearanceAttr);
            }
        }
        public GameAttributes SelectAllAttributes()
        {
            GameAttributes attributes = new GameAttributes();

            string sqlConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(sqlConnectionString))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("dbo.Attributes_SelectAll", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                    while (reader.Read())
                    {
                        Platforms plats = new Platforms();
                        int       index = 0;

                        plats.Id       = reader.GetInt32(index++);
                        plats.Platform = reader.GetString(index++);
                        attributes.Platforms.Add(plats);
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        Genres genres = new Genres();
                        int    index  = 0;

                        genres.Id    = reader.GetInt32(index++);
                        genres.Genre = reader.GetString(index++);
                        attributes.Genres.Add(genres);
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        Studios studios = new Studios();
                        int     index   = 0;

                        studios.Id     = reader.GetInt32(index++);
                        studios.Studio = reader.GetString(index++);
                        attributes.Studios.Add(studios);
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        Directors dirs  = new Directors();
                        int       index = 0;

                        dirs.Id       = reader.GetInt32(index++);
                        dirs.Director = reader.GetString(index++);
                        attributes.Directors.Add(dirs);
                    }
                }

                conn.Close();
            }

            return(attributes);
        }
Ejemplo n.º 14
0
 public void UpdateAttributesEquipment()
 {
     _attributes = baseAttr;
     if (this.leftArm != null)
     {
         _attributes.agility += this.leftArm.attributes.agility;
         _attributes.alchemy += this.leftArm.attributes.alchemy;
         _attributes.endurance += this.leftArm.attributes.endurance;
         _attributes.strength += this.leftArm.attributes.strength;
         _attributes.technology += this.leftArm.attributes.technology;
     }
     if (this.leftLeg != null)
     {
         _attributes.agility += this.leftLeg.attributes.agility;
         _attributes.alchemy += this.leftLeg.attributes.alchemy;
         _attributes.endurance += this.leftLeg.attributes.endurance;
         _attributes.strength += this.leftLeg.attributes.strength;
         _attributes.technology += this.leftLeg.attributes.technology;
     }
     if (this.rightArm != null)
     {
         _attributes.agility += this.rightArm.attributes.agility;
         _attributes.alchemy += this.rightArm.attributes.alchemy;
         _attributes.endurance += this.rightArm.attributes.endurance;
         _attributes.strength += this.rightArm.attributes.strength;
         _attributes.technology += this.rightArm.attributes.technology;
     }
     if (this.rightLeg != null)
     {
         _attributes.agility += this.rightLeg.attributes.agility;
         _attributes.alchemy += this.rightLeg.attributes.alchemy;
         _attributes.endurance += this.rightLeg.attributes.endurance;
         _attributes.strength += this.rightLeg.attributes.strength;
         _attributes.technology += this.rightLeg.attributes.technology;
     }
 }
Ejemplo n.º 15
0
    public void setAttributes(string _nam, string _des, int _spr, int _pri)
    {
        _attributes = new GameAttributes();
        _name = _nam;
        _description = _des;
        _sprite = _spr;
        _price = _pri;

        _color = new Color(Random.Range(0, 10) * 0.1f, Random.Range(0, 10) * 0.1f, Random.Range(0, 10) * 0.1f);
    }