Esempio n. 1
0
    public void init()
    {
        mHero = GameObject.Find("Manager").GetComponent <LevelManager>().mPlayerControl;
        xMin  = JsonUtils.getIntance().getConfigValueForId(100034);
        xMax  = JsonUtils.getIntance().getConfigValueForId(100035);
        yMax  = JsonUtils.getIntance().getConfigValueForId(100036);
        ymin  = JsonUtils.getIntance().getConfigValueForId(100037);


        xDistance = (xMax - xMin) / 6;
        yDistance = (yMax - ymin) / 6;

        for (int i = 0; i < 3; i++)
        {
            for (int ii = 0; ii < 3; ii++)
            {
                PetLocalDate local = new PetLocalDate();
                local.x  = xMin + (ii * 2 + 1) * xDistance;
                local.y  = ymin + (i * 2 + 1) * xDistance;
                local.id = -1;
                mLocalList.Add(local);
            }
        }
        //reInit();
    }
Esempio n. 2
0
    public bool petFight(long id)
    {
        if (mPetCount >= JsonUtils.getIntance().getConfigValueForId(100038))
        {
            return(false);
        }
        mPetCount++;
        PetLocalDate date = null;

        foreach (PetLocalDate local in mLocalList)
        {
            if (local.id == -1)
            {
                date    = local;
                date.id = id;
                break;
            }
        }
        GameObject newobj = GameObject.Instantiate(
            mPetGj, new Vector3(-10, -10, mZIdex[0]), Quaternion.Euler(0.0f, 0f, 0.0f));

        mZIdex.RemoveAt(0);
        PetItemControl pet = newobj.GetComponent <PetItemControl>();

        pet.init(date, this);
        mControlList.Add(id, pet);
        Debug.Log("PetItemControl pet=" + pet);
        Debug.Log("PetItemControl mHero=" + mHero);
        Debug.Log("PetItemControl mHero.mSkillManager=" + mHero.mSkillManager);

        mHero.mSkillManager.
        addSkill(pet.mJson, mHero, SkillIndexUtil.getIntance().getPetIndexByPetId(false, id));
        return(true);
    }