Пример #1
0
    void Possess()
    {
        playerScript.possessing = true;
        player.SetActive(false);
        gameObject.GetComponent <SpriteRenderer>().color = possessedColor;
        iTween.ShakePosition(gameObject, shakeAmount, shakeTime);
        iTween.ShakeRotation(gameObject, shakeAmount, shakeTime);

        GameObject[] kids = GameObject.FindGameObjectsWithTag("Kid");
        foreach (GameObject kid in kids)
        {
            Kid kidScript = kid.GetComponent <Kid>();
            if (kidScript.floor == floor)
            {
                kidScript.alerted     = false;
                kidScript.scareMeter += scareDamage;
                kidScript.Scream();
            }
        }

        Invoke("DestroyMe", shakeTime);
    }