コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        _lifeAmount = GetComponent <LifeAmount>();
        _lifeObvs   = new LifeObvs(this);
        _lifeAmount.Subject.AddObvs(_lifeObvs);

        _lastHealth = _lifeAmount.CurrentHealth;

        _cameara = GameObject.FindGameObjectWithTag(CustomTags.MainCamera);
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        if (playerLife == null)
        {
            playerLife = GameObject.FindGameObjectWithTag(CustomTags.Player).GetComponent <LifeAmount>();
        }

        if (gameTimeCountDown == null)
        {
            gameTimeCountDown = GetComponent <GameCountDown>();
        }

        if (faceRecogniser == null)
        {
            faceRecogniser = GetComponent <FaceRecogniser>();
        }

        if (score == null)
        {
            score = GetComponent <Score>();
        }

        if (distance == null)
        {
            distance = GetComponent <Distance>();
        }

        if (backgroundVideo == null)
        {
            backgroundVideo = GameObject.FindGameObjectWithTag(CustomTags.Background).GetComponent <VideoPlayer>();
            Debug.Assert(backgroundVideo != null);
        }

        if (dude == null)
        {
            dude = GameObject.FindGameObjectWithTag(CustomTags.Dude);
        }

        _countDownObvs = new GameCountDownObvs(this);
        _lifeObvs      = new LifeObvs(this);
        playerLife.Subject.AddObvs(_lifeObvs);
        gameTimeCountDown.Subject.AddObvs(_countDownObvs);

        _speed = 0.5f;
    }