Exemple #1
0
    void Start()
    {
        EventManager.AddBallSwanInvoker(this);
        ballSpawnEvent.Invoke();
        timer = gameObject.AddComponent <Timer>();
        float d = Random.Range(ConfigurationUtils.Min, ConfigurationUtils.Max);

        timer.Duration = d;
        timer.Run();
    }
Exemple #2
0
    void Start()
    {
        EventManager.AddBallSwanInvoker(this);
        if (noSpeed)
        {
            ballSpeed = ConfigurationUtils.BallImpulseForce;
        }
        else
        {
            ballSpeed = ConfigurationUtils.BallImpulseForce * 2;
        }
        SpeedUpManager.AddListener(SpeedUpHandler);
        rigidbidy = GetComponent <Rigidbody2D>();
        Vector3 direction = new Vector3(Mathf.Cos(-90 * Mathf.PI / 180), Mathf.Sin(-90 * Mathf.PI / 180));

        rigidbidy.AddForce(direction * ballSpeed);
        speed          = rigidbidy.velocity;
        timer          = gameObject.AddComponent <Timer>();
        timer.Duration = ConfigurationUtils.LifeTime;
        timer.Run();
        Speedtimer          = gameObject.AddComponent <Timer>();
        Speedtimer.Duration = 5;
    }