Exemple #1
0
    void Start()
    {
        go = gameObject;

        if (go != null)
        {
            if (go.GetComponent <PlayerController>()) //<<------ if this object is the player
            {
                pHealthSystem = go.GetComponent <PlayerHealthSystem>();
            }
            else if (go.GetComponent <EnemyHandleInteract>()) //<<------------ if this object is an enemy
            {
                eHandleInteract = go.GetComponent <EnemyHandleInteract>();
            }
            else if (go.GetComponent <BreakableObject>()) //<<------- if this object is a breakable object
            {
                bO = go.GetComponent <BreakableObject>();
            }
            else if (go.GetComponent <RollingObject>()) //<<--------- if this object is a rolling object
            {
                rO = go.GetComponent <RollingObject>();
            }
        }
        else
        {
            Debug.LogError("No game object assigned to slot!");
        }
    }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        PlayerController pRef = other.gameObject.GetComponent <PlayerController>();
        RollingObject    ro   = other.GetComponent <RollingObject>();

        if (pRef != null || ro != null)
        {
            PlayCinematic();
        }
    }