// Use this for initialization
 private void Start()
 {
     syncInput             = GetComponent <PlayerSyncInput>();
     m_CharacterController = GetComponent <CharacterController>();
     m_Camera = GetComponentInChildren <Camera>();
     m_OriginalCameraPosition = m_Camera.transform.localPosition;
     m_FovKick.Setup(m_Camera);
     m_HeadBob.Setup(m_Camera, m_StepInterval);
     m_StepCycle   = 0f;
     m_NextStep    = m_StepCycle / 2f;
     m_Jumping     = false;
     m_AudioSource = GetComponent <AudioSource>();
 }
 // Use this for initialization
 private void Start()
 {
     syncInput = GetComponent<PlayerSyncInput>();
     m_CharacterController = GetComponent<CharacterController>();
     m_Camera = GetComponentInChildren<Camera>();
     m_OriginalCameraPosition = m_Camera.transform.localPosition;
     m_FovKick.Setup(m_Camera);
     m_HeadBob.Setup(m_Camera, m_StepInterval);
     m_StepCycle = 0f;
     m_NextStep = m_StepCycle/2f;
     m_Jumping = false;
     m_AudioSource = GetComponent<AudioSource>();
 }
示例#3
0
    // Use this for initialization
    private void Start()
    {
        m_goFrostNova = GetComponentInChildren<FrostNova>().gameObject;
        if(Game.Instance.IsLocalGame)
        {
            m_iHeroId = GameManager.Instance.PlayerJoined(this);
            GetComponent<PlayerSyncPosition>().enabled = false;
            GetComponent<PlayerSyncInput>().enabled = false;

                if (m_iHeroId ==1)
                    FindObjectOfType<CameraController>().Init(this.transform);

            if(m_iHeroId == (int)HeroId.PLAYER1)
            {
                this.transform.GetChild(m_iHeroId).gameObject.SetActive(false);
                m_bHasSword = true;
                ToggleSword(); // m_bHasSword will be false and hide the sword
            }
            else
            {
                this.transform.GetChild((int)HeroId.NONE).gameObject.SetActive(false);
                m_bHasSword = true;
                ToggleSword();
            }
        }
        else
        {
            syncInput =  this.gameObject.GetComponent<PlayerSyncInput>();
            if(syncInput.isLocalPlayer)
            {
                m_iHeroId = 1;
                this.transform.GetChild(m_iHeroId).gameObject.SetActive(false);
                ToggleSword();
            }
            else
            {
                m_iHeroId = 2;
                this.transform.GetChild((int)HeroId.NONE).gameObject.SetActive(false);
            }
        }

        this.gameObject.name = "Player" + m_iHeroId;

        m_sPlayerName = gameObject.name;
        HUDController.instance.InitUIPlayer(m_sPlayerName,m_iHeroId,MAX_HEALTH,MAX_ENERGY);

        renderers = GetComponentsInChildren<Renderer>();
    }