public void Awake()
    {
        aSource = GetComponent<AudioSource> ();

        sControl = new soundControl (aSource);//создаем обьект контроллера звука
        sControl. stopSound();
    }
Example #2
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
    void Awake()
    {
        if (instanse == null)
        {
            instanse = this;
        }
        else if (instanse != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Example #4
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);
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        ThisAttack = this.GetComponent<HTHHitter>();

        if (NameAnimate == null)
            this.enabled = false;
        attackId = Animator.StringToHash(NameAnimate);

        aSource = GetComponent<AudioSource> ();
        sControl = new soundControl (aSource);//создаем обьект контроллера звука
        myTransform = transform;
    }
Example #6
0
    // Use this for initialization
    protected void Start()
    {
        aSource = GetComponent<AudioSource> ();
        sControl = new soundControl (aSource);//создаем обьект контроллера звука

        //проверяем длительности звуков стрельбы и перезарядки
        if (fireSound!=null&&fireSound.length >= fireInterval) {
            //Debug.LogWarning("fireSound clip length is greater than fireIntrval value");
        }
        if (reloadSound!=null&&reloadSound.length >= reloadTime) {
            //Debug.LogError("reloadSound clip length is greater than reloadTime value");
        }

        curTransform = transform;
        photonView = GetComponent<PhotonView>();
        rifleParticleController = GetComponentInChildren<RifleParticleController>();

        if (rifleParticleController != null) {
            rifleParticleController.SetOwner (owner.collider);
        }
    }
    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);
            }
        }
    }