Ejemplo n.º 1
0
    // Use this for initialization
    protected void Start()
    {
        aSource = GetComponent<AudioSource> ();

        sControl = new soundControl (aSource);//создаем обьект контроллера звука
        _canWallRun = canWallRun;
        //проигрываем звук респавна
        sControl.playClip (spawnSound);

        if (emitter != null) {
                emitter.Emit ();//запускаем эмиттер
                isSpawn = true;//отключаем движения и повреждения
        }

        if (!photonView.isMine) {

                        Destroy (GetComponent<ThirdPersonController> ());
                        Destroy (GetComponent<ThirdPersonCamera> ());
                        Destroy (GetComponent<MouseLook> ());
                        GetComponent<Rigidbody> ().isKinematic = true;
                        //ivnMan.Init ();
        } else {
            cameraController=GetComponent<ThirdPersonCamera> ();
            isAi = cameraController==null;
        }
        mainAi =  GetComponent<AIBase> ();
        isAi = mainAi!=null;

        correctPlayerPos = transform.position;
        myCollider = collider;
        ivnMan.Init ();
        centerOffset = capsule.bounds.center - myTransform.position;
        headOffset = centerOffset;
        headOffset.y = capsule.bounds.max.y - myTransform.position.y;

        distToGround = capsule.height/2-capsule.center.y;
        charMan = GetComponent<CharacteristicManager> ();
        charMan.Init ();
        health= charMan.GetIntChar(CharacteristicList.MAXHEALTH);
        if (canJump) {
            jetPackCharge = charMan.GetIntChar(CharacteristicList.JETPACKCHARGE);
        }
        ivnMan.Init ();
        AfterSpawnAction ();
        //Debug.Log (distToGround);
    }
Ejemplo n.º 2
0
    void Start()
    {
        aSource = GetComponent<AudioSource> ();
        sControl = new soundControl (aSource);//создаем обьект контроллера звука и передаем указатель на источник
        sControl.playClip (reactiveEngineSound);

        mTransform = transform;
        mRigidBody = rigidbody;
        mRigidBody.velocity = mTransform.TransformDirection(Vector3.forward * startImpulse);

        RaycastHit hit;

        if (Physics.Raycast (transform.position, mRigidBody.velocity.normalized, out hit)){

            if (hit.distance < mTransform.InverseTransformDirection (mRigidBody.velocity).z * 0.1f)
            {
                onBulletHit(hit);
            }
        }
    }