public void CmdPutCard(int cardIndex, Vector3 pos, bool inArea, int animalIdx)
 {
     if (inArea)
     {
         if (animalIdx >= 0)
         {
             Evolution.ConstEnums.Skills skillType = playerMod.cardMods[cardIndex].cardType;
             Debug.Log("create skill:" + skillType);
             RpcRemoveCard(cardIndex);
             //Debug.Log ("i am on animal");
             RpcCreateSkill(animalIdx, skillType);
         }
         else if (animalIdx == ConstEnums.ANIMAL_HAS_SKILL)
         {
             RpcMoveCard(cardIndex, GameController.Instance.latestChoosenCardPosition);
         }
         else if (animalIdx == ConstEnums.NOT_ON_Animal)
         {
             RpcRemoveCard(cardIndex);
             RpcCreateAnimal(pos);
         }
     }
     else
     {
         RpcMoveCard(cardIndex, GameController.Instance.latestChoosenCardPosition);
     }
 }
    public int checkOnAnimal(Vector3 position, int cardIdx)
    {
        int animalIndex = ConstEnums.NOT_ON_Animal;

        Evolution.ConstEnums.Skills cardType = playerMod.cardMods[cardIdx].cardType;

        foreach (GameObject animal in playerView.animals)
        {
            Vector3 animalSize   = animal.GetComponent <Collider> ().bounds.size;
            Vector3 animalCenter = animal.transform.position;

            float left   = animalCenter.x - animalSize.x / 2;
            float right  = animalCenter.x + animalSize.x / 2;
            float top    = animalCenter.z + animalSize.z / 2;
            float bottom = animalCenter.z - animalSize.z / 2;

            if (position.x < right && position.x > left)
            {
                if (position.z < top && position.z > bottom)
                {
                    AnimalModel mod = (AnimalModel)animal.GetComponent <AnimalView>().mod;
                    if (!mod.property.getSkill(cardType))
                    {
                        animalIndex = mod.index;
                    }
                    else
                    {
                        animalIndex = ConstEnums.ANIMAL_HAS_SKILL;
                    }
                    break;
                }
            }
        }
        return(animalIndex);
    }
    void RpcCreateSkill(int animalIdx, Evolution.ConstEnums.Skills skillType)
    {
        //Debug.Log("rpc create skill:" + skillType);
        int neededFood = playerMod.addSkillToAniml(animalIdx, skillType);

        playerView.addSkillToAniml(animalIdx, skillType, neededFood);
        //Debug.Log( getPlayerId() + " creat skill ");
        this.PostNotification(RequestCreatAnimal);
        //Instantiate (animalStatus, new Vector3 (pos.x, pos.y + 3.0f, pos.z), Quaternion.identity);
    }