Beispiel #1
0
    void OnBallStart(IEventBase eventBase)
    {
        BallStartEvent ballData = eventBase as BallStartEvent;

        ballCollider.enabled = true;
        transform.SetPositionAndRotation(ballData.startPos, Quaternion.identity);
        GetComponent <Rigidbody>().velocity = ballData.startVelocity;

        mesh.enabled           = true;
        cam.transform.position = transform.position;
        cam.gameObject.SetActive(true);
    }
    void Fire()
    {
        cam.transform.Rotate(new Vector3(-1, 0, 0));

        BallStartEvent ballstart = new BallStartEvent()
        {
            startPos      = ballsStartPos.position,
            startVelocity = ballsStartPos.forward.normalized * 7f
        };

        EventAggregator.Publish(ballstart);

        SoundFireEvent soundfire = new SoundFireEvent();

        EventAggregator.Publish(soundfire);
    }