Exemplo n.º 1
0
    private void CreateTarget(int step, int maxStep)
    {
        Action      CallWithStop = () => { StartCoroutine(WaitCreateTarget(step, maxStep)); };
        Base_OnGood base_OnGood  = new Base_OnGood(nameGoodPrefab);
        Base_OnBad  base_OnBad   = new Base_OnBad(nameBadPrefab);
        Base_OnStop base_OnStop  = new Base_OnStop(CallWithStop);

        CreateTarget(namePrefab, nameObjectMove, transformGenerate, targetsToMove, base_OnGood, base_OnBad, base_OnStop);
    }
Exemplo n.º 2
0
    protected void CreateTarget(
        string namePrefab,
        string nameObjectMove,
        Transform transformGenerate,
        List <Transform> targetsToMove,
        Base_OnGood _OnGood,
        Base_OnBad _OnBad,
        Base_OnStop _OnStop
        )
    {
        GameObject    targetObject  = Instantiate(Load.Prefab.Get(namePrefab), transformGenerate);
        MoveSubEffect moveSubEffect = targetObject.GetComponent <MoveSubEffect>();
        Transform     targetMove    = targetsToMove.Random();

        EnterTextController.RemoveAll();
        moveSubEffect.baseSetText.Show(nameObjectMove);
        moveSubEffect.baseSetText.OnGood = (str, textObj) =>
        {
            _OnGood.Initialization(transformGenerate, moveSubEffect, targetObject, targetMove);
            _OnGood?.Call();
        };

        moveSubEffect.baseSetText.OnBed = (str, textObj) =>
        {
            _OnBad.Initialization(transformGenerate, moveSubEffect, targetObject, targetMove);
            _OnBad?.Call();
        };

        moveSubEffect.moveObject.OnStop = () =>
        {
            _OnStop.Initialization(targetObject);
            _OnStop?.Call();
        };


        moveSubEffect.MoveTo(targetObject.transform, targetMove);
    }