コード例 #1
0
    // called when client is started, aka the player is spawned -> initialize stuff
    // NOTE: this is that function that is called not just on the client
    public override void OnStartClient()
    {
        // get the settings (since the StartupManager object also contains the NetworkManager,
        // we can be sure it's there
        StartupManager myManager = FindObjectOfType<StartupManager>();
        settings = myManager.settings;

        // set initial and current health
        initialHealth = currentHealth = settings.health;

        isJumping = false;
        hasRangeWeapon = false;
        isGrabbing = false;
        usingWeapon = false;

        // get WeaponController
        weaponController = GetComponent<WeaponController>();
        weaponController.Initialize(weaponAnchor, myManager.GetWeaponObjectPool());

        if( rayCastObject == null )
        {
            Debug.Log("SimpleCharacterController: OnStartClient: Can't do ray cast; disabling jumping...");
        }

        // initialize controls
        actions = PlayerActions.CreateWithDefaultBindings();

        // TODO check what PlayerPrefs do exactly (prolly control scheme bs)
    }