Пример #1
0
    // public int maxTime = 0;

    // private GameController() {
    //     stepCollection = new CookingStepCollection();
    // }

    // public static GameController GetInstance()
    // {
    //     return instance;
    // }

    private void Awake()   // 必须比别的脚本先调用
    {
        Screen.SetResolution(1600, 900, false);
        stepCollection = new CookingStepCollection();
        MenuHolder     = GameObject.FindWithTag("MenuHolder").GetComponent <MenuHolder>();
        timeHolder1    = GameObject.FindWithTag("TimeHolder1").GetComponent <TimeHolder>();
        timeHolder2    = GameObject.FindWithTag("TimeHolder2").GetComponent <TimeHolder>();
    }
Пример #2
0
    void Start()
    {
        dragRect = GetComponent <RectTransform>();
        transform.SetSiblingIndex(1); // 把这个物体放在最上,防止按不到

        MenuHolder  = GameObject.FindWithTag("MenuHolder").GetComponent <MenuHolder>();
        timeHolder1 = GameObject.FindWithTag("TimeHolder1").GetComponent <TimeHolder>();
        timeHolder2 = GameObject.FindWithTag("TimeHolder2").GetComponent <TimeHolder>();

        menuRect    = MenuHolder.transform.parent.GetComponent <RectTransform>();
        timeRect1   = timeHolder1.GetComponent <RectTransform>();
        timeRect2   = timeHolder2.GetComponent <RectTransform>();
        cookingStep = GetComponent <CookingStep>();

        children = GetComponentsInChildren <Transform>();
        clock    = children.Where(x => x.name == "ClockImage").First();

        rt         = children.Where(x => x.name == "Image").First().GetComponent <RectTransform>();
        frameImage = children.Where(x => x.name == "FrameImage").First().GetComponent <RectTransform>();

        animationController = FindObjectOfType <AnimationController>();
        cookingSteps        = FindObjectOfType <GameController>().stepCollection;
    }
Пример #3
0
 void Start()
 {
     csp       = FindObjectOfType <GameController>().stepCollection;
     FailSound = GameObject.Find("FailSound").GetComponent <AudioSource>();
 }