Ejemplo n.º 1
0
    void Start()
    {
        rb2D   = GetComponent <Rigidbody2D>();
        radius = GetComponent <CircleCollider2D>().radius;

        force = new Vector2(
            ConfigurationUtils.BallImpulseForce * Mathf.Cos(angle),
            ConfigurationUtils.BallImpulseForce * Mathf.Sin(angle));

        // FIXME event
        ballLifetime          = gameObject.AddComponent <Timer>();
        ballLifetime.Duration = ConfigurationUtils.BallLifeTime;
        ballLifetime.Run();
        // EventManager.AddTimerEventListener(BallLifetimeEvent);


        // FIXME event
        ballFreezeAfterSpawn          = gameObject.AddComponent <Timer>();
        ballFreezeAfterSpawn.Duration = ConfigurationUtils.BallFreezeAfterSpawn;
        ballFreezeAfterSpawn.Run();
        // EventManager.AddTimerEventListener(BallFreezeAfterSpawnEvent);


        EventManager.AddBoostBallEffectListener(HandleAddBoostBallEffectActivatedEvent);

        reduceBallsLeftEvent = new ReduceBallsLeft();
        EventManager.ReduceBallsLeftInvoker(this);
    }
Ejemplo n.º 2
0
 public static void AddReduceBallsLeftInvoker(ReduceBallsLeft inputEvent)
 {
     reduceBallsLeftInvokers.Add(inputEvent);
     foreach (var currentAction in reduceBallsLeftListeners)
     {
         inputEvent.AddListener(currentAction);
     }
 }
Ejemplo n.º 3
0
    void Start()
    {
        // Set timers
        SetTimers();

        // Speedup effect support
        _rigidbody2D = GetComponent <Rigidbody2D>();
        EventManager.AddSpeedupEffectListener(SetSpeedupEffect);

        _ballsLeft = new ReduceBallsLeft();
        EventManager.BallsLeftInvokers(this);

        _spawnBallEvent = new SpawnBallEvent();
        EventManager.BallSpawnInvoker(this);
    }
Ejemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject tempball       = Instantiate(ballPrefab);
        Vector3    scaleOfBall    = tempball.transform.lossyScale;
        float      ballHalfWidth  = scaleOfBall.x / 2.0f;
        float      ballHalfHeight = scaleOfBall.y / 2.0f;

        ballDownLeftCorner = new Vector2(tempball.transform.position.x - ballHalfWidth, tempball.transform.position.y - ballHalfHeight);
        ballUpRightCorner  = new Vector2(tempball.transform.position.x + ballHalfWidth, tempball.transform.position.y + ballHalfHeight);
        Destroy(tempball);
        Initialize();

        minSpawnTime  = ConfigurationUtils.MinRandomSpawnTime;
        maxSpawnTime  = ConfigurationUtils.MaxRandomSpawnTime;
        randomspawner = gameObject.AddComponent <Timer>();
        RunRandomSpawner(randomspawner);

        reduceBallsEvent = new ReduceBallsLeft();
        EventManager.AddReduceBallsEventInvoker(this);
    }