// Use this for initialization
    void Start()
    {
        if (!photonView.isMine)
        {
            Destroy(GetComponent <ThirdPersonController> ());
            Destroy(GetComponent <ThirdPersonCamera> ());
            Destroy(GetComponent <MouseLook> ());
            GetComponent <Rigidbody> ().isKinematic = true;
        }
        else
        {
            cameraController = GetComponent <ThirdPersonCamera> ();
            isAi             = cameraController == null;
        }
        AIBase comp = GetComponent <AIBase> ();

        isAi = comp != null;

        correctPlayerPos = transform.position;
        myCollider       = collider;

        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);
        //Debug.Log (distToGround);
    }
    public void Heal(float damage, GameObject Healler)
    {
        int maxHealth = charMan.GetIntChar(CharacteristicList.MAXHEALTH);

        health += damage;
        if (maxHealth < health)
        {
            health = maxHealth;
        }
    }
Exemple #3
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);
    }
    // Use this for initialization
    protected void Start()
    {
        if (emitter != null) {
                emitter.Emit ();//запускаем эмиттер
                isSpawn = true;//отключаем движения и повреждения
        }
        if (!photonView.isMine) {

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

        correctPlayerPos = transform.position;
        myCollider = collider;

        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);
        //Debug.Log (distToGround);
    }