コード例 #1
0
 void Start()
 {
     currentTrain = this.GetComponent <Train>();
     foreach (Transform child in targetTrain.transform)
     {
         if (child.CompareTag("TrainCart"))
         {
             TrainCart tc = child.GetComponent <TrainCart>();
             targetCartList.Add(tc);
             tc.allowIncreasePoint = AllowIncreasePoint;
         }
     }
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        currentTrain.playerTrainCartPosition = targetTrain.playerTrainCartPosition;
        for (int i = 0; i < currentTrain.trainList.Count; i++)
        {
            if (currentTrain.trainList[i] == null || targetCartList[i] == null)
            {
                continue;
            }
            TrainCart      tc = currentTrain.trainList[i].GetComponent <TrainCart>();
            SpriteRenderer sr = tc.transform.GetComponentInChildren <SpriteRenderer>();

            tc.numberOfPeople = targetCartList[i].numberOfPeople;
            tc.Durability     = targetCartList[i].Durability;
            tc.IsBreak        = targetCartList[i].IsBreak;
            sr.sprite         = targetCartList[i].transform.GetComponentInChildren <SpriteRenderer>().sprite;
        }
    }
コード例 #3
0
 void Start()
 {
     trainCart = this.GetComponent <TrainCart>();
     TextDis   = this.transform.GetChild(3).GetComponent <TextMeshPro>();
 }