Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (playerTag == "")
        {
            Debug.LogError("Player Tag not set!", this);
            return;
        }

        if (dialogProperties == null)
        {
            Debug.LogError("DialogProperties not set!", this);
            return;
        }

        if (stayBackMessage == null)
        {
            Debug.LogError("StayBackMessage not set!", this);
            return;
        }

        if (other.gameObject.tag == playerTag)
        {
            PlayerAccessibility playerAccessibility = other.gameObject.GetComponentInChildren <PlayerAccessibility>();

            if (playerAccessibility == null)
            {
                Debug.LogError("PlayerAccessibility could not be found on player!", this);
                return;
            }

            dialogProperties.player = playerAccessibility;
            player = other.gameObject;
            stayBackMessage.Show();
        }
    }
    public bool Validate()
    {
        bool returnVal = true;

        if (textPrefab == null)
        {
            Debug.LogError("No textPrefab attached!", this);;
            returnVal = false;
        }

        if (buttonPrefab == null)
        {
            Debug.LogError("No buttonPrefab attached!", this);;
            returnVal = false;
        }



        if (autoAssignPlayer)
        {
            GameObject playerObject = GameObject.FindWithTag(playerTag);

            if (playerObject == null)
            {
                Debug.LogError("No player found in scene!", this);
            }
            else
            {
                player = playerObject.GetComponent <PlayerAccessibility>();
            }
        }

        if (player == null)
        {
            Debug.LogError("No player attached!", this);;
            returnVal = false;
        }

        return(returnVal);
    }