Ejemplo n.º 1
0
    public void Start()
    {
        _eb           = gameObject.AddComponent <ExplodableBehaviour>();
        _eb.Transform = transform;
        _eb.Bounty    = bounty;

        _tb = new TeleportableBehaviour(transform, imageWidth, imageHeight);

        _rb = gameObject.GetComponent <Rigidbody2D>();
        MoveHorizontally();

        Shoot();
    }
Ejemplo n.º 2
0
    public void Start()
    {
        //add teleportable behaviour
        _tb = new TeleportableBehaviour(transform, imageWidth, imageHeight);

        _eb           = gameObject.AddComponent <ExplodableBehaviour>();
        _eb.Transform = transform;
        _eb.Bounty    = AsteroidHelper.GetBounty(stage);

        //add random forces
        Vector2 velocity = new Vector2(Random.Range(minVelocity, maxVelocity) * SceneHelper.GetRandomMultiplier(),
                                       Random.Range(minVelocity, maxVelocity) * SceneHelper.GetRandomMultiplier());
        float torque = Random.Range(-maxTorque, maxTorque);

        rb.AddForce(velocity);
        rb.AddTorque(torque);

        //link to the particles
        _explosion = ResourcesLoader.GetExplosion();
    }