Esempio n. 1
0
    private void MakeExpBall(Enemy _enemy, float _exp, bool _isBoss)
    {
        GameObject expBall = ObjectPoolingManager.instance.GetQueue(ObjectPoolingManager.instance.expBallQueue);

        expBall.transform.position = _enemy.transform.position + Vector3.up * 1.8f;
        ExpBall _expball = expBall.GetComponent <ExpBall>();

        if (!_isBoss)
        {
            _expball.SetRemoveTime(TitleSetting.ballRemoveTime);
        }
        _expball.SetExpBallHP(health / 3);
        _expball.onDeath += () => _expball.DestroyExpBall(_exp);
    }
Esempio n. 2
0
 public void collectExpBalls(Vector3 pos)
 {
     if (expBalls.Count > 0)
     {
         foreach (GameObject expBall in expBalls)
         {
             if (Mathf.Abs(Vector3.Distance(expBall.transform.position, pos)) < 40.0f)
             {
                 ExpBall ball = expBall.GetComponent <ExpBall>();
                 ball.collect();
                 SoundManager.getInstance().play("collect");
             }
         }
     }
 }
Esempio n. 3
0
    void CreateExpBall()
    {
        ExpBall ball = Instantiate(expBall, this.gameObject.transform.position, Quaternion.Euler(new Vector3(0, 0, 0))).gameObject.GetComponent <ExpBall>();

        ball.Init(expValue);
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        showingHowToPlay = true;
        gameRunning      = false;
        fadeOut          = false;

        playerBB = playerGO.GetComponent <BoxCollider2D>();
        //powerCoreSR = powerCoreGO.GetComponent<SpriteRenderer>();

        player    = playerGO.GetComponent <Player>();
        powerCore = powerCoreGO.GetComponent <PowerCore>();

        floorBB = floor.GetComponent <BoxCollider2D>().bounds;

        staticBBs = new List <BoxCollider2D>();

        for (int i = 0; i < LD39.Constants.TOTAL_POWER_GENERATORS; i++)
        {
            staticBBs.Add(powerGenerators[i].GetComponent <BoxCollider2D>());
        }

        foreach (Transform child in propGO.transform)
        {
            staticBBs.Add(child.GetComponent <BoxCollider2D>());
        }
        staticBBs.Add(consoleGO.GetComponent <BoxCollider2D>());
        staticBBs.Add(coreHolder.GetComponent <BoxCollider2D>());

        //Debug.Log("Total " + staticBBs.Count.ToString() + " (4 pg + props) static BB found");

        updatePowerGenSpriteOrder();

        expGenerated = 0;

        ExpBall.setPlayer(playerGO);

        coreHolderBound = coreHolder.GetComponent <BoxCollider2D>().bounds;

        float   pad = 30.0f;
        Vector3 min = coreHolderBound.min;
        Vector3 max = coreHolderBound.max;

        min.x -= pad;
        min.y -= pad;

        max.x += pad;
        max.y += pad;

        coreHolderBound.SetMinMax(min, max);

        consoleBB = consoleGO.GetComponent <BoxCollider2D>().bounds;

        Vector3 consoleMin = consoleBB.min;

        //consoleMin.x -= pad;
        consoleMin.y -= pad;
        consoleBB.SetMinMax(consoleMin, consoleBB.max);

        consoleUI.GetComponent <Console>().init();

        curAlertLevel       = 0;
        maxAlertLevel       = 100;
        alertBar.fillAmount = 0;

        gameOverEffect.GetComponent <Image>().color = new Color(1.0f, 1.0f, 1.0f, 0.0f);
    }