コード例 #1
0
    public void OnCantMove <T>(T component) where T : Component
    {
        if (Player.Instance.GetState() == Player.PlayerState.Ghosting && !component.transform.GetComponent <Statue>())
        {
            return;
        }
        ReactiveEntity interactable = component.GetComponent <ReactiveEntity>();

        if (interactable != null && GetComponent <Player>())
        {
            // interact with interactable
            Debug.Log(transform.gameObject.name + " interacting with: " + interactable.transform.gameObject.name);
            interactable.Interact <ReactiveEntity>(GetComponent <Player>());
        }
    }
コード例 #2
0
    public void OnCantMove <T>(T component) where T : Component
    {
        ReactiveEntity interactable = component.GetComponent <ReactiveEntity>();

        if (interactable != null)
        {
            // interact with interactable Have to decide if npcs can interact with stuff
            //interactable.Interact<Player>(Player.Instance);
            //Debug.Log(transform.gameObject.name + " interacting with: " + interactable.transform.gameObject.name);

            if ((interactable.CompareTag("Player") || interactable.CompareTag("NPC")) && GetComponent <NPC>())
            {
                // do stuff with enemy (if running into player, enemy is prolly trying to attack player so maybe do something like:
                Debug.Log(transform.gameObject.name + " interacting with: " + interactable.transform.gameObject.name);
                interactable.Interact(GetComponent <NPC>());
            }
        }
    }