Exemplo n.º 1
0
    public void AddScores(int score, bool iscombo, InGameBaseObj source)
    {
        int s = score;

        //if(iscombo){
        //    combo++;
        //    scores += combo;
        //    s = combo;
        //}else {
        //    combo = 0;
        //    scores += score;
        //}
        scores += score;
        InGameManager.GetInstance().inGameUIManager.AddScores(source.transform.position, s, scores, iscombo, true);
        //InGameManager.GetInstance().inGameColorManager.SetColor((float)score * (iscombo ? 1f /* ((float)combo * 0.3f)*/ : 0.1f  ));

        //Vector3[] ps = {
        //    source.transform.position,
        //    new Vector3(0,source.transform.position.y + source.transform.position.x /*Random.Range(8f,15f)*/,0),
        //                InGameManager.GetInstance().inGameUIManager.gamePadManager.comboLabelPos -
        //                new Vector3(0,Random.Range(8f,15f),0),
        //                InGameManager.GetInstance().inGameUIManager.gamePadManager.comboLabelPos
        //            };
        //ComboFlyObj.Create(ps);
    }
Exemplo n.º 2
0
    public void Bomb()
    {
        List <BaseObject> list = InGameManager.GetInstance().inGameObjectManager.GetObjList();

        for (int i = 0; i < list.Count; i++)
        {
            BaseObject obj = list[i];
            if (obj.conf.type != (int)BaseObject.enObjType.enemy && obj.conf.type != (int)BaseObject.enObjType.item)
            {
                continue;
            }
            float dis = Vector3.Distance(transform.position, obj.transform.position);
            if (dis < (transform.localScale.x + obj.transform.localScale.x) * 0.7f)
            {
                obj.Hurt(10);

                if (obj.state == BaseObject.enObjState.die)
                {
                    Debug.Log("x : " + obj.transform.position.x);
                    InGameManager.GetInstance().inGamePlayerManager.AddScores(Mathf.Abs((int)(obj.transform.position.x * 5)));
                }
            }
        }

        (new EventCreateEffect(conf.dieeffect, null, transform.position, 1f)).Send();
    }
Exemplo n.º 3
0
    public void TouchToPlane(Vector3 pos)
    {
        Ray ray = InGameManager.GetInstance().gamecamera.ScreenPointToRay(pos);

        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, 200, LayerMask.GetMask("GameObj")))
        {
            GameObject    gameObj = hitInfo.collider.gameObject;
            InGameBaseObj obj     = gameObj.GetComponent <InGameBaseObj>();
            if (obj != null)
            {
                (new EventData(EventID.EVENT_GAME_TOUCH_OBJ)).AddData(obj).Send();
                return;
            }
        }

        if (Physics.Raycast(ray, out hitInfo, 200, LayerMask.GetMask("TouchPlane")))
        {
            GameObject gameObj  = hitInfo.collider.gameObject;
            Vector3    hitPoint = hitInfo.point;

            (new EventGameTouchGround(hitPoint)).Send();
        }
    }
Exemplo n.º 4
0
    public override void HandleEvent(EventData resp)
    {
        switch (resp.eid)
        {
        case EventID.EVENT_UI_INITMAPTEXTURE:
            Texture2D texture = resp.sUserData[0] as Texture2D;

            uitexture.mainTexture = texture;

            uitexture.width  = texture.width * mapScale;
            uitexture.height = texture.height * mapScale;

            break;

        case EventID.EVENT_DATA_CHANGELIFE:
            InGameBaseCharacter obj = resp.sUserData[0] as InGameBaseCharacter;
            if (InGameManager.GetInstance().inGamePlayerManager.GetRole().instanceId == obj.instanceId)
            {
                SetLife(obj);
            }
            break;

        case EventID.EVENT_GAME_INITROLE:
            InGameBaseCharacter role = resp.sUserData[0] as InGameBaseCharacter;
            SetLife(role);
            SetExp(role.GetData());
            break;

        case EventID.EVENT_DATA_CHANGEEXP:
            RoleData roledata = resp.sUserData[0] as RoleData;
            SetExp(roledata);
            break;
        }
    }
Exemplo n.º 5
0
    public override void MUpdate()
    {
        base.MUpdate();
        //更新小地图位置
        Vector3 rolePos = InGameManager.GetInstance().inGamePlayerManager.GetRolePos();
        Vector2 arrPos  = GameCommon.GetMapPos(rolePos);

        float x = (float)arrPos.x / (float)uitexture.mainTexture.width;
        float y = (float)arrPos.y / (float)uitexture.mainTexture.height;

        uitexture.transform.localPosition = -1 * new Vector2(x * uitexture.width, y * uitexture.height);

        //update life

        if (Mathf.Abs(lifeTargetVal - lifeLine.fillAmount) > 0.01f)
        {
            lifeLine.fillAmount = lifeLine.fillAmount + (lifeTargetVal - lifeLine.fillAmount) * 0.1f;
            if (Mathf.Abs(lifeTargetVal - lifeLine.fillAmount) <= 0.01f)
            {
                lifeLine.fillAmount = lifeTargetVal;
            }
        }

        //update mana

        //update exp
        if (Mathf.Abs(expTargetVal - expLine.fillAmount) > 0.01f)
        {
            expLine.fillAmount = expLine.fillAmount + (expTargetVal - expLine.fillAmount) * 0.1f;
            if (Mathf.Abs(expTargetVal - expLine.fillAmount) <= 0.01f)
            {
                expLine.fillAmount = expTargetVal;
            }
        }
    }
Exemplo n.º 6
0
    public void Fire(Vector3 targetpos)
    {
        HitCubeBullet bullet = InGameManager.GetInstance().inGameObjManager.AddObj(BaseHitCubeObj.enHitCubeObjId.bullet) as HitCubeBullet;

        bullet.Init(role.transform.position, targetpos, 4);
        (new EventCreateEffect(60010011, bullet.gameObject, bullet.transform.position, bullet.transform.localScale.x)).Send();
    }
Exemplo n.º 7
0
    protected override Vector3 AttemptMove(Layer2D layer, Direction dir)
    {
        var move = base.AttemptMove(layer, dir);

        // スタミナを減らす
        _stamina--;
        InGameManager.GetInstance().staminaText.text = "Stamina: " + Stamina;

        CheckIfGameOver();

        // ゴールがある場合リロード
        if (InGameManager.GetInstance().GoalCheck(ChipUtil.GetChipPos(new Vector2(move.x, move.y))))
        {
            // 遅延してリスタート
            Restart();

            // プレイヤーを一度無効
            enabled = false;
        }

        // プレイヤーのターンを終了する
        InGameManager.GetInstance().playersTurn = false;

        return(move);
    }
Exemplo n.º 8
0
    public override void Update()
    {
        for (int i = 0; i < enemyPoints.Count; i++)
        {
            enemyPoints[i].ObjUpdate();
        }
        for (int i = enemyList.Count - 1; i >= 0; i--)
        {
            if (enemyList[i] == null)
            {
                enemyList.RemoveAt(i);
            }
        }
        List <CharacterConf> roleList = ConfigManager.characterConfManager.dicByType[(int)CharacterConf.enCharacterType.enemy];

        while (enemyList.Count < 5)
        {
            //InGameBaseCharacter enemy = InGameManager.GetInstance().inGameObjManager.AddObj(roleList[Random.Range(0, roleList.Count)].id, enMSCamp.en_camp_enemy) as InGameBaseCharacter;
            InGameBaseCharacter enemy = InGameManager.GetInstance().inGameObjManager.AddObj(100008, enMSCamp.en_camp_enemy) as InGameBaseCharacter;
            //100011
            enemy.AddAI();

            Vector3 pos = InGameManager.GetInstance().inGameLevelManager.gameMap.GetRandomWay();
            enemy.transform.position = GameCommon.GetWorldPos(pos);
            enemy.SetZPos();

            enemyList.Add(enemy);
        }
    }
Exemplo n.º 9
0
    void AddSawUpdate()
    {
        addSawTime -= Time.deltaTime;
        if (addSawTime > 0)
        {
            return;
        }
        addSawTime = Random.Range(MAX_ADD_SAW_TIME, MAX_ADD_SAW_TIME * 2);

        Rect gamerect = InGameManager.GetInstance().GetGameRect();

        float  rand = Random.Range(0f, 1f);
        string name;

        if (rand < 0.5f)
        {
            name = "InGameSaw";
        }
        else
        {
            name = "InGameElastic";
        }
        InGameBaseObj item = AddItem(name, gamerect.y + gamerect.height + 1);

        float randScale = Random.Range(1f, 1.8f);

        item.transform.localScale = new Vector3(randScale, randScale, 1);
    }
Exemplo n.º 10
0
    // Update is called once per frame
    public void Update()
    {
        Rect gamerect = InGameManager.GetInstance().GetGameRect();

        while (addindex < objList.Count && objList[addindex].transform.position.y - 1 < gamerect.y + gamerect.height)
        {
            InGameManager.GetInstance().inGameLevelManager.AddObj((InGameBaseObj)objList[addindex]);
            addindex++;
        }

        //for (int i = 0; i < objList.Count; i++)
        //{
        //    InGameBaseObj obj = (InGameBaseObj)objList[i];
        //    obj.ObjUpdate();

        //    if (obj.IsDie())
        //    {
        //        delList.Add(obj);
        //    }
        //}

        //for (int i = 0; i < delList.Count; i++)
        //{
        //    InGameBaseObj obj = delList[i];
        //    objList.Remove(obj);
        //    obj.Die();
        //}
        //delList.Clear();

        //InGameManager.GetInstance().gamecamera.transform.position += new Vector3(0, Time.deltaTime, 0);
    }
Exemplo n.º 11
0
    void BulletFunction()
    {
        //bullet
        if (bulletList == null)
        {
            return;
        }

        setReadyBulletTime -= Time.deltaTime;
        if (setReadyBulletTime <= 0 && readyBullet == null && bulletList.Count > 0)
        {
            SetReadyBullet();
        }

        if (bulletList.Count >= InGameManager.GetInstance().inGamePlayerManager.GetBulletMaxCount())
        {
            return;
        }
        addBulletTime -= Time.deltaTime;
        if (addBulletTime > 0)
        {
            return;
        }
        addBulletTime = addBulletMaxTime;
        AddBullet(1);
    }
Exemplo n.º 12
0
    public override void HandleEvent(EventData resp)
    {
        if (InGameManager.GetInstance().gameState != enGameState.playing)
        {
            return;
        }
        if (bullet == null)
        {
            return;
        }
        switch (resp.eid)
        {
        case EventID.EVENT_TOUCH_DOWN:
            EventTouch eve = (EventTouch)resp;
            //TouchToPlane(eve.pos);
            //Fire(GameCommon.ScreenPositionToWorld(eve.pos));
            Vector3 pos = GameCommon.ScreenPositionToWorld(InGameManager.GetInstance().gamecamera, eve.pos);

            if (pos.y > InGameManager.GetInstance().inGameUIManager.gamePadManager.comboLabelPos.y - 1)
            {
                return;
            }

            bullet.Fire();
            AudioManager.Instance.Play("sound/btn");
            bullet = null;
            break;
        }
    }
Exemplo n.º 13
0
    void AddItemUpdate()
    {
        addItemTime -= Time.deltaTime;
        if (addItemTime > 0)
        {
            return;
        }
        addItemTime = Random.Range(MAX_ADD_ITEM_TIME, MAX_ADD_ITEM_TIME * 2);

        Rect gamerect = InGameManager.GetInstance().GetGameRect();

        float  rand = Random.Range(0f, 1f);
        string name;

        if (rand < 0.3f)
        {
            name = "InGameItemMagnet";
        }
        else if (rand < 0.65f)
        {
            name = "InGameItemSuperSpeed";
        }
        else
        {
            name = "InGameItemScale";
        }

        AddItem(name, gamerect.y + gamerect.height + 1);
    }
Exemplo n.º 14
0
    protected override void Start()
    {
        InGameManager.GetInstance().AddEnemyToList(this);

        target = GameObject.FindGameObjectWithTag("Player").transform;

        base.Start();
    }
Exemplo n.º 15
0
 public override void Hurt(int val)
 {
     base.Hurt(val);
     if (state == enObjState.die)
     {
         InGameManager.GetInstance().inGamePlayerManager.AddLife(reviveCount);
     }
 }
Exemplo n.º 16
0
    //
    public override bool Hurt(InGameBaseObj obj)
    {
        MapObjConf conf = ConfigManager.mapObjConfManager.map[this.confid];

        InGameManager.GetInstance().inGameLevelManager.gameMap.DelMapObj(transform.position, conf);
        transform.position = new Vector3(-9999, -9999, 0);
        return(true);
    }
Exemplo n.º 17
0
    public void SetCameraPos()
    {
        Vector3 camerapos = InGameManager.GetInstance().gamecamera.transform.position;

        camerapos.z = cameraBasePos.z + transform.position.z;

        InGameManager.GetInstance().gamecamera.transform.position = camerapos;
    }
Exemplo n.º 18
0
    public void Revive()
    {
        gameObject.SetActive(true);

        Rect gamerect = InGameManager.GetInstance().GetGameRect();

        transform.position = new Vector3(0, gamerect.y + gamerect.height / 2, 0);
        AddForce(new Vector3(0, GameConst.JUMP_FORCE, 0));
    }
Exemplo n.º 19
0
        public GameObject gameManager;                          //GameManager prefab to instantiate.

        void Awake()
        {
            //Check if a GameManager has already been assigned to static variable GameManager.instance or if it's still null
            if (InGameManager.GetInstance() == null)
            {
                //Instantiate gameManager prefab
                Instantiate(gameManager);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// <para>Eng. Load all save file in local save folder </para>
        /// <para>Kor. 세이브 폴더내에 저장된 파일을 게임으로 모두 불러옵니다. </para>
        /// </summary>
        void ReloadSaveFile(VinoveGameSaveData _saveData)
        {
            VinoveScript _script = InGameManager.GetInstance()._currentVinove.FindSceneWithUID(_saveData._parentSceneUID).FindScriptWithUID(_saveData._scriptUID);

            _pushedSavedButton.GetComponent <SavedButtonManager>().ChangeSaveData(_saveData);
            _pushedSavedButton.GetComponent <SavedButtonManager>().ChangeTexts(_saveData._savedDate, _script.ScriptConversation.Speaker, _script.ScriptConversation.Dialog);

            _pushedSavedButton = null;
        }
Exemplo n.º 21
0
    public override void Update()
    {
        base.Update();

        addTime -= Time.deltaTime;

        if (addTime > 0f)
        {
            return;
        }
        addTime = Random.Range(1f, 3f);

        //随机出生点

        float x = gameMapRect.x * 2f + Random.Range(1, gameMapRect.width * 2f);
        float y = gameMapRect.y + gameMapRect.height + 1f;

        float targetx = 0f;

        if (x < 0f)
        {
            targetx = gameMapRect.x + Random.Range(1f, gameMapRect.width * 1.5f);
        }
        else
        {
            targetx = gameMapRect.x + gameMapRect.width - Random.Range(1f, gameMapRect.width * 1.5f);
        }

        float targety = gameMapRect.y - 1f;

        //移动轨迹不能与y轴平行,如果平行手动+1
        if (Mathf.Abs(targetx - x) <= 0.1f)
        {
            targetx += 1f;
        }

        //保证出生点在屏幕边缘
        if (x < gameMapRect.x - 1f)
        {
            y = GameCommon.GetLineY(new Vector3(x, y), new Vector3(targetx, targety), gameMapRect.x - 1);

            x = gameMapRect.x - 1f;
        }
        else if (x > gameMapRect.x + gameMapRect.width + 1f)
        {
            y = GameCommon.GetLineY(new Vector3(x, y), new Vector3(targetx, targety), gameMapRect.x + gameMapRect.width + 1f);
            x = gameMapRect.x + gameMapRect.width + 1f;
        }

        Vector3 startPos  = new Vector3(x, y);
        Vector3 targetPos = new Vector3(targetx, targety);

        HitCubeEnemy enemy = InGameManager.GetInstance().inGameObjManager.AddObj(BaseHitCubeObj.enHitCubeObjId.enemy) as HitCubeEnemy;

        enemy.Init(startPos, targetPos, Random.Range(0.5f, 3f), Random.Range(0.3f, 0.6f));
    }
Exemplo n.º 22
0
    public static BaseSkill CreateSkill(
        int skillid,
        InGameBaseCharacter source,
        InGameBaseCharacter target)
    {
        BaseSkill skill = InGameManager.GetInstance().inGameObjManager.AddSkill(skillid, source.camp) as BaseSkill;

        skill.SkillInit(source, target);
        return(skill);
    }
Exemplo n.º 23
0
    public void Bomb()
    {
        bombtime = 0;
        sprite.SetActive(false);
        gameObject.SetActive(false);

        (new EventCreateEffect(60010010, null, transform.position, transform.localScale.x)).Send();

        InGameManager.GetInstance().imageEffect_MoblieBloom.threshold = 1f;
    }
Exemplo n.º 24
0
    // Use this for initialization
    public override void Init()
    {
        role = InGameManager.GetInstance().inGameObjectManager.AddObj(BaseObject.enObjId.role_1) as Role;
        role.transform.position = new Vector3(0, 0, 1f);


        life           = maxLife;
        maxBulletCount = 5;
        bulletSpeed    = 5;
    }
Exemplo n.º 25
0
    public override void Init()
    {
        base.Init();

        validTouchDistance = 200;

        moveForce = Vector3.zero;

        cameraBasePos = InGameManager.GetInstance().gamecamera.transform.position;
    }
Exemplo n.º 26
0
 void AddBullet(int count)
 {
     for (int i = 0; i < count; i++)
     {
         Bullet b = (Bullet)InGameManager.GetInstance().inGameObjectManager.AddObj(BaseObject.enObjId.bullet_1);
         bulletList.Add(b);
         b.transform.position = transform.position + new Vector3(0, (bulletList.Count - 1) * b.transform.localScale.y, -transform.localScale.z);
         b.transform.rotation = Quaternion.Euler(0, Random.Range(0, 360), 0);
     }
 }
Exemplo n.º 27
0
    void AddStepUpdate()
    {
        Rect gamerect = InGameManager.GetInstance().GetGameRect();

        while (addHeight < gamerect.y + gamerect.height)
        {
            AddItem("InGameStep", addHeight);
            addHeight += Random.Range(MIN_ADDHEIGHT, MAX_ADDHEIGHT);
        }
    }
Exemplo n.º 28
0
 public override void ObjUpdate()
 {
     base.ObjUpdate();
     if (Vector3.Distance(transform.position, InGameManager.GetInstance().role.transform.position) <
         (transform.localScale.x + InGameManager.GetInstance().role.transform.localScale.x) * 0.45)
     {
         SetDie();
         InGameManager.GetInstance().role.AddForceY(GameConst.JUMP_FORCE * 0.2f);
         InGameManager.GetInstance().role.buffManager.AddBuff(BaseBuff.BuffType.scale, 5f, 1f);
     }
 }
Exemplo n.º 29
0
    public void JumpStart(Vector3 targetPos)
    {
        hit = false;
        jump.JumpStart(transform.position, targetPos, 5);
        InGameManager.GetInstance().touchPlane.gameObject.SetActive(false);

        flag.transform.position = targetPos;
        flag.SetActive(true);

        AudioManager.Instance.Play("sound/jump");
    }
Exemplo n.º 30
0
    public override void Init(BuffType type, float time, float val)
    {
        base.Init(type, time, val);

        effectobj = new GameObject("role speed effect");
        effectobj.transform.parent = InGameManager.GetInstance().role.transform;

        effectobj.transform.localPosition = Vector3.zero;

        (new EventCreateEffect(60010011, effectobj, effectobj.transform.position, 1.0f)).Send();
    }