Beispiel #1
0
    protected override void unitLoop()
    {
        base.unitLoop();

        _fDelay += Time.deltaTime * CGameStateManager.instance.tryGetScenetime();

        if (_fDelay >= _fMaxDelay)
        {
            var           ingameScene   = CGameStateManager.instance.inGameScene as CKarma_Scene;
            CKarmaKetchup ketChupBottle = ingameScene.getKarmaKetchupBottle();

            for (int i = 0; i < ketChupBottle._KetchupObj.Count; ++i)
            {
                if (!ketChupBottle._KetchupObj[i]._bColWithPotato)
                {
                    var PotatoBox = ingameScene.getPotatoBoxObject();
                    int iRand     = Random.Range(0, ketChupBottle._KetchupObj.Count);

                    if (ketChupBottle._KetchupObj[iRand]._bColWithPotato)
                    {
                        continue;
                    }

                    var potatoObj = CGameStateManager.instance.scenePrefabProvider.spawnItemToFunc <CKarmaPotatoObject>(
                        CKarma_Scene.potatoObject,
                        PotatoBox.gameObject.transform.position);
                    potatoObj.setTarget(ketChupBottle._KetchupObj[iRand]);
                    potatoObj.setUseGravity(false);
                    potatoObj.gameObjectSetActiveOn();
                    _fDelay = 0f;
                    break;
                }
            }
        }
    }
Beispiel #2
0
    public override void gameObjectSetActiveOff()
    {
        base.gameObjectSetActiveOff();

        var ingameScene = CGameStateManager.instance.inGameScene as CKarma_Scene;
        CKarmaKetchup ketChupBottle = ingameScene.getKarmaKetchupBottle();

        ketChupBottle._KetchupObj.Remove(this);
    }
Beispiel #3
0
    // object -> potato 위치 전해야됨.
    // object -> potato off 새로 뽑아야함.

    public override void gameObjectSetActiveOn()
    {
        base.gameObjectSetActiveOn();
        int iRand = Random.Range(0, 4);
        if (animIsVaild && anim as CSpriteAnimation != null)
            (anim as CSpriteAnimation).getSpriteRenderer.sprite = _ketChupSprite[iRand];

        var ingameScene = CGameStateManager.instance.inGameScene as CKarma_Scene;
        CKarmaKetchup ketChupBottle = ingameScene.getKarmaKetchupBottle();
        ketChupBottle._KetchupObj.Add(this);
    }
Beispiel #4
0
    /// <summary>
    /// 하나가 고유하다고 전제 (케첩 보틀)
    /// </summary>
    public CKarmaKetchup getKarmaKetchupBottle()
    {
        CKarmaKetchup ketchup = null;

        var gameStateManager = CGameStateManager.instance;

        if (_karmaKetchupInstanceId == -1)
        {
            ketchup = gameStateManager.scenePrefabProvider.spawnItemToFunc <CKarmaKetchup>(CKarma_Scene.ketchupBottle, Vector3.zero, false);;
            _karmaKetchupInstanceId = ketchup.gameObject.GetInstanceID();
            return(ketchup);
        }
        else
        {
            if (gameStateManager.inGameScene.isVaildCompareRigidObject(_karmaKetchupInstanceId))
            {
                ketchup = gameStateManager.inGameScene.getRigidObject(_karmaKetchupInstanceId) as CKarmaKetchup;
            }
        }

        return(ketchup);
    }