Exemplo n.º 1
0
    public void CreateRole(int ID)
    {
        myRole = PhotonNetwork.Instantiate("Darkman Solider", Random.onUnitSphere * 5f, Quaternion.identity, 0);
        if (ID == 0)
        {
            playersInfo.myID = PhotonNetwork.room.playerCount;
            GameObject myPlayer = GameObject.Find("Player" + PhotonNetwork.room.playerCount.ToString());
            myRole.transform.parent = myPlayer.transform;

            myPhotonView          = myPlayer.GetComponent <PhotonView>();
            myPhotonView.observed = myRole.GetComponent <NetworkController>();
        }
        playersInfo.alive[ID] = true;


        //AddTag(myPhotonView);
        if (myPhotonView.isMine)
        {
            TP_Animator   playerAnimator   = myRole.GetComponent <TP_Animator>();
            TP_Motor      playerMotor      = myRole.GetComponent <TP_Motor>();
            TP_Controller playerController = myRole.GetComponent <TP_Controller>();
            TP_Info       playerInfo       = myRole.GetComponent <TP_Info>();
            playerAnimator.enabled   = true;
            playerMotor.enabled      = true;
            playerController.enabled = true;
            playerInfo.enabled       = true;
        }
    }
Exemplo n.º 2
0
    void OnAllScripts()
    {
        playerMotor     = GetComponent <TP_Motor>();
        playerAnimator  = GetComponent <TP_Animator>();
        playerInfo      = GetComponent <TP_Info>();
        gameObject.name = gameObject.name + photonView.viewID;

        /*playerCamera = transform.FindChild("Camera").gameObject;// transform.FindChild("Camera").gameObject;
         * playerAttack = transform.FindChild("AttackRangeCol").gameObject;
         * if(photonView.isMine)
         * {
         *      playerCamera.SetActive(true);
         *      playerAttack.SetActive(true);
         *      playerCamera.transform.parent = transform.FindChild("targetLookAt").transform;
         *      playerController.OnPlayerAttack();
         *      playerAnimator.OnPlayerAttack();
         * }
         * else
         * {
         *      playerCamera.gameObject.SetActive(false);
         *      playerController.OnPlayerAttack();
         *      playerAnimator.OnPlayerAttack();
         *      playerAttack.gameObject.SetActive(true);
         * }
         * playerController.SetIsLocalPlayer(photonView.isMine);*/
    }
Exemplo n.º 3
0
    }                                                                           // The vertical velocity of the character.

    #endregion

    #region UNITY_FUNCTIONS

    // Use this for initialization
    void Awake()
    {
        if (instance != this)
        {
            instance = this;
        }
    }
Exemplo n.º 4
0
    /**
     * Setup function
     */
    void Awake()
    {
        myTrailSnow  = SnowTrailParticle;
        myTrailTrack = myTrailSnow.GetComponent("TrailRenderer") as TrailRenderer;

        inputFriction = Vector3.zero;
        Instance      = this;
    }
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     gravityOn = true;
 }
Exemplo n.º 6
0
  void Awake()
  {
    Instance = this;

    playerHealth = 100;

    if (HealthVisualBar != null)
      HealthVisualBar.value = playerHealth;
  }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     data.controller = GetComponent <CharacterController>();
     source          = GetComponent <AudioSource>();
 }
    private void Start()
    {
        //Initalization.
        motor  = TP_Motor.Instance;
        target = motor.transform;

        //Begin spawning the enemy.
        StartCoroutine(InitializeEnemy());
    }
Exemplo n.º 9
0
    void Awake()
    {
        if (instance != null)
        {
            Debug.Log("Instance of TP_Motor already exists");
            return;
        }

        instance = this;
    }
Exemplo n.º 10
0
 void Awake()
 {
     parentTrans      = transform.parent;
     CC               = parentTrans.GetComponent <CharacterController>();
     playerInfo       = parentTrans.GetComponent <TP_Info>();
     playerMotor      = parentTrans.GetComponent <TP_Motor>();
     roomMenu         = GameObject.FindGameObjectWithTag("RoomMenu").GetComponent <InRoom_Menu>();
     myPhotonView     = transform.parent.GetComponent <PhotonView>();
     _lockAttackCheck = false;
     attackDistance   = 100;
 }
    public override void ApplySettings()
    {
        if (DIRE.Instance.DisplayOrigin.activeSelf)
        {
            DIRE.Instance.DisplayOrigin.GetComponent <ARTtrack>().SetTracking(trackingEnabled);
        }
        TP_Motor tpMotorScript = GameObject.FindObjectOfType <TP_Motor>();

        tpMotorScript.ForwardSpeed  = avatarForwardSpeed;
        tpMotorScript.BackwardSpeed = avatarBackwardSpeed;
        tpMotorScript.StrafingSpeed = avatarStrafeSpeed;
    }
Exemplo n.º 12
0
 void Awake()
 {
     Instance         = this;
     CC               = gameObject.GetComponent <CharacterController>();
     playerInfo       = GetComponent <TP_Info>();
     playerController = GetComponent <TP_Controller>();
     playerAnimator   = GetComponent <TP_Animator>();
     myTransform      = transform;
     myPos            = myTransform.position;
     isAlignCamera    = true;
     //JumpSpeed = 400f;
     Gravity          = 500f;
     TerminalVelocity = 1000f;
 }
Exemplo n.º 13
0
    void Awake()
    {
        IsRunning           = true;
        CharacterController = GetComponent("CharacterController") as CharacterController;
        playerAnimator      = GetComponent <TP_Animator>();
        playerMotor         = GetComponent <TP_Motor>();
        playerInfo          = GetComponent <TP_Info>();
        roomMenu            = GameObject.FindGameObjectWithTag("RoomMenu").GetComponent <InRoom_Menu>();

        myPhotonView = GetComponent <PhotonView>();
        Instance     = this;

        UselightSourceTimer = 0;

        buffSkillType = new TP_Animator.BuffSkillType[2];
    }
Exemplo n.º 14
0
 void Awake()
 {
     Instance = this;
     characterMesh = GameObject.Find("MainChar") as GameObject;
 }
Exemplo n.º 15
0
 void Awake()
 {
     Instance      = this;
     characterMesh = GameObject.Find("MainChar") as GameObject;
 }
Exemplo n.º 16
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 17
0
 void Awake()
 {
     _instance = this;
 }
Exemplo n.º 18
0
 void Start()
 {
     Instance = this;
 }
Exemplo n.º 19
0
    /*void Awake()
    {
        CharacterController = GetComponent<CharacterController>() as CharacterController;
        Instance = this;

        //P_Camera.UseExistingOrCreateNewMainCamera ()
        //Debug.Log(isLocalPlayer);
        //if (isLocalPlayer)
        //{
        TP_Camera.CreateNewMainCamera(netId.ToString());
        //}
    }*/
    void Awake()
    {
        motor = GetComponent<TP_Motor>();
    }
Exemplo n.º 20
0
 void Start()
 {
     instance = this;
 }
Exemplo n.º 21
0
    void Awake()
    {
        Instance = this;

        playerHealth = 100;

        if (HealthVisualBar != null)
          HealthVisualBar.value = playerHealth;
    }
Exemplo n.º 22
0
 // Use this for initialization
 void Awake()
 {
     Instance  = this;
     IsSliding = false;
 }
Exemplo n.º 23
0
 void Awake()
 {
     _instance = this;
 }
Exemplo n.º 24
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 25
0
 void Awake()
 {
     Instance   = this;
     moveVector = targetDir = Vector3.zero;
 }
 void Awake()
 {
     if(Instance == null)
         Instance = this;
     gravityOn = true;
 }
Exemplo n.º 27
0
    /*void Awake()
     * {
     *  CharacterController = GetComponent<CharacterController>() as CharacterController;
     *  Instance = this;
     *
     *  //P_Camera.UseExistingOrCreateNewMainCamera ()
     *  //Debug.Log(isLocalPlayer);
     *  //if (isLocalPlayer)
     *  //{
     *  TP_Camera.CreateNewMainCamera(netId.ToString());
     *  //}
     * }*/

    void Awake()
    {
        motor = GetComponent <TP_Motor>();
    }