private void Awake()
 {
     if (!_instance)
     {
         _instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
 void Awake()
 {
     if (singleton == null)
     {
         singleton  = this;
         fillObject = healthSlider.fillRect.gameObject;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #3
0
    public override void OnStart()
    {
        i = this;

        base.SetScreenAction(thisScreen: ScreenState.Game);

        this.ObserveEveryValueChanged(currentStageIndex => Variables.currentSceneBuildIndex)
        .Subscribe(currentStageIndex => { ShowStageNumText(); })
        .AddTo(this.gameObject);

        gameObject.SetActive(true);
        tutrialHandController.OnStart();
        retryButton.onClick.AddListener(OnClickRetryButton);
    }
Example #4
0
    public override void OnStart()
    {
        i = i ?? this;
        base.SetScreenAction(thisScreen: ScreenState.Game);

        this.ObserveEveryValueChanged(currentStageIndex => Variables.currentStageIndex)
        .Subscribe(currentStageIndex => { ShowStageNumText(); })
        .AddTo(this.gameObject);

        this.ObserveEveryValueChanged(humanCount => Variables.humanCount)
        .Subscribe(humanCount => humanCountText.text = humanCount.ToString())
        .AddTo(this.gameObject);

        gameObject.SetActive(true);
    }
Example #5
0
    public override void OnStart()
    {
        i = this;
        base.SetScreenAction(thisScreen: ScreenState.Game);

        this.ObserveEveryValueChanged(currentSceneBuildIndex => Variables.currentSceneBuildIndex)
        .Subscribe(currentSceneBuildIndex => { ShowStageNumText(); })
        .AddTo(this.gameObject);

        this.ObserveEveryValueChanged(tapCountLeft => GameManager.i?.tapCountLeft)
        .Subscribe(tapCountLeft => { tapCountText.text = "x " + tapCountLeft; })
        .AddTo(this.gameObject);

        gameObject.SetActive(true);
        retryButton.onClick.AddListener(base.ReLoadScene);
        tutrialHandController.OnStart();
    }
Example #6
0
    public override void OnStart()
    {
        if (i == null)
        {
            i = this;
        }
        base.SetScreenAction(thisScreen: ScreenState.Game);

        this.ObserveEveryValueChanged(point => Variables.status.point)
        .Subscribe(point => { pointText.text = "★ " + point; })
        .AddTo(this.gameObject);

        this.ObserveEveryValueChanged(level => Variables.status.growthIndex + 1)
        .Subscribe(level =>
        {
            levelUpTextAnim(level);
            levelText.text = "Player\nLv." + level;
        })
        .AddTo(this.gameObject);

        gameObject.SetActive(true);
    }
Example #7
0
    // Start is called before the first frame update
    void Start()
    {
        idle                = true;
        wantsToHug          = false;
        hugging             = false;
        enoughHugging       = false;
        walkingTowardsPoint = false;

        idleBody.SetActive(true);
        huggingBody.SetActive(false);
        WalkingEffectEmissionActive(false);
        LovingEffectEmissionActive(false);

        anim = GetComponent <Animator>();
        // lastTimeHuggingDecission = Time.time;
        player = GameObject.Find("Player").GetComponent <Player> ();
        speed  = speed + Random.Range(0, speedNoise);

        gameCanvasManager = FindObjectOfType <GameCanvasManager>();

        SetRandomHat();
    }
Example #8
0
    private void Awake()
    {
        instance = this;

        if (players == null)
        {
            players = new List <Player>();
        }
        gameSceneManager  = this.GetComponent <GameSceneManager>();
        gameCanvasManager = this.GetComponent <GameCanvasManager>();

        if (playerTag == "")
        {
            Debug.LogError("You need to define a tag for the player");
        }
        if (disablingObjectTag == "")
        {
            Debug.LogError("You need to define a tag for the disabling objects");
        }
        if (checkpointTag == "")
        {
            Debug.LogError("You need to define a tag for the checkpoints");
        }
    }
Example #9
0
 void Start()
 {
     canvasManager      = GameObject.Find("GameCanvas").GetComponent <GameCanvasManager>();
     highScoreManager   = GameObject.Find("GameController").GetComponent <HighScoreManager>();
     sceneLoaderManager = GameObject.Find("SceneLoader").GetComponent <SceneLoaderManager>();
 }