예제 #1
0
    private IEnumerator InitDependency2()
    {
        yield return(new WaitForSeconds(0.1f));

        ActManager.Instance().Init();
        StartStory();
    }
예제 #2
0
    public override void OnInspectorGUI()
    {
        ActManager myTarget = (ActManager)target;

        EditorGUILayout.BeginHorizontal();
        Rect resetBut = new Rect(
            0, 0,
            UsefullUtils.GetPercent(Screen.width, 25),
            25
            );

        if (GUI.Button(resetBut, "Reset Start"))
        {
            myTarget.gameObject.GetComponent <ActController>().SetStartAtAct("");
        }

        Rect resetSBut = new Rect(
            UsefullUtils.GetPercent(Screen.width, 25) + 15, 0,
            UsefullUtils.GetPercent(Screen.width, 25),
            25
            );

        if (GUI.Button(resetSBut, "Reset Speed"))
        {
            myTarget.gameObject.GetComponent <ActController>().SetStartAtAct("");
        }

        // GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        // Show default inspector property editor
        DrawDefaultInspector();
    }
예제 #3
0
 //singleton
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         GameObject.Destroy(this);
     }
 }
예제 #4
0
    private void StartAct()
    {
        if (CurrentAct != null)
        {
            CurrentAct.GameObject.SetActive(false);
        }

        CurrentAct = ActManager.Instance().GetActObject(
            ActManager.Instance().GetActDict().ElementAt(ActIndex).Key
            );

        Acts.Add(CurrentAct);
        CurrentAct.InitAct(OnActEnd);
        ContinueStory();
    }
예제 #5
0
    private void OnActEnd()
    {
        ActIndex++;

        if (ActIndex >= ActManager.Instance().GetActDict().Count)
        {
            return;
        }

        if (_tStyle == TStyle.None)
        {
            StartAct();
        }
        else
        {
            Overlay.Transition(OverlayTransition.Complete, 1f, () => { StartAct(); });
        }

        _tStyle = TStyle.None;
    }
예제 #6
0
    void Start()
    {
        acts = ActManager.LoadActs();


        foreach (Act act in acts)
        {
            if (isPositive == Math.Sign(act.cost))
            {
                GameObject newButton = GameObject.Instantiate(prefButton) as GameObject;
                newButton.transform.Find("Cost").GetComponent <Text>().text   = act.cost.ToString();
                newButton.transform.Find("Target").GetComponent <Text>().text = act.target;


                newButton.transform.SetParent(content);
                newButton.transform.localScale = new Vector3(1, 1, 1);

                newButton.GetComponent <Button>().onClick.AddListener(() => {
                    act.makeAct(player);
                });
            }
        }
    }
예제 #7
0
    void StartStory()
    {
        Acts = new List <IAct>();

        if (string.IsNullOrWhiteSpace(StartAtAct))
        {
            StartAtAct = ActManager.Instance().GetActDict().ElementAt(0).Key;
            ActIndex   = 0;
        }
        else
        {
            if (UsefullUtils.IsDigitsOnly(StartAtAct))
            {
                ActIndex   = System.Convert.ToInt32(StartAtAct);
                StartAtAct = ActManager.Instance().GetActDict().ElementAt(ActIndex).Key;
            }
            else
            {
                ActIndex = System.Array.IndexOf(ActManager.Instance().GetActDict().Keys.ToArray(), StartAtAct);
            }
        }
        Debug.Log(ActIndex);
        StartAct();
    }
예제 #8
0
    public void AddActs()
    {
        Act act = GenerateAct();

        ActManager.UpdateActs(act);
    }
예제 #9
0
 public void SetDefaultActs()
 {
     ActManager.DefaultActs();
 }
예제 #10
0
 public void makeAct(PlayerManager player)
 {
     player.score += cost;
     ActManager.AddNodeActs(this);
 }
예제 #11
0
 void Awake()
 {
     _instance = this;
 }