コード例 #1
0
    private void InitializeGuardedTile()        // run when an owner is assigned to this guarded tile.
    {
        if (PlayerDetector != null)
        {
            Destroy(PlayerDetector.gameObject);
        }
        if (AudioManager.Instance != null)
        {
            AudioManager.Instance.PlaySFX(GuardTileClaimed);
        }
        AreaOfAttack.enabled   = true;
        PlayerDetector.enabled = false;
        ButtonRender.material  = OwnedMaterial;
        PlayerPersonalization ownerPersonalization = state.EntityOwner.GetComponent <PlayerPersonalization>();

        colorIntensity = Player_Colors.GetColorIntensity(ownerPersonalization.GetColor());
        OwnerText.text = ownerPersonalization.GetName() + "'s tile";

        Color GuardedMaterialColor = state.EntityOwner.GetComponent <PlayerPersonalization>().PlayerGraphics.material.color;

        ButtonRender.material.color = GuardedMaterialColor;
        ButtonRender.material.SetColor("_EmissionColor", GuardedMaterialColor * colorIntensity * 0.6f); // change this multiplier.
        print("I am now claimed!");
        ButtonAnim.Play(AnimHashID);
    }
コード例 #2
0
    public override void Attached()
    {
        Personalization = GetComponent <PlayerPersonalization>();

        if (BoltNetwork.IsServer)
        {
            var evnt = PlayerJoinedEvent.Create();
            evnt.Message = "Hello There";
            evnt.Send();
        }

        if (entity.IsOwner)             // only activate the camera for the player. Nobody else's camera!
        {
            Personalization.SetName();
            Personalization.SetHat_Eye();
            EntityCamera.gameObject.SetActive(true);
            CinematicCamera.SetActive(true);
            var evntPly = GetPlayerPersonalizationEvent.Create();
            evntPly.PlayerEntity = entity;
            evntPly.Send();
        }
    }