Ejemplo n.º 1
0
    /*
     * 某人下车
     */
    private void add_person()
    {
        if (!ConfigConstexpr.human_addable())
        {
            return;
        }
        ++add_person_cnt;
//		Debug.Log ("My daddy: " + get_parent_script().transform);
        var pos = generate_pos();

        Debug.Log("Add Pos = " + pos + " with father " + this.gameObject.name);
//		PersonAdder.LayerChange ();

        var gameobj = HumanController.add_human(pos, parentTransform.gameObject);

        gameobj.transform.parent = p_script.transform;          // reset father.

        gameobj.gameObject.layer = p_script.gameObject.layer;
        HumanController p_c = gameobj.GetComponent <HumanController> ();

        p_c.transform.parent = parentTransform;
        PersonAdder.LayerChange(p_c, p_script);
        p_c.take_subway = false;
        p_c.Start();
    }
Ejemplo n.º 2
0
 private bool used;          // 是否使用过
 void Start()
 {
     used = false;
     this.GetComponent <Button> ().onClick.AddListener(
         delegate() {
         if (!used)
         {
             // TODO: 召唤一个计时器
             ConfigConstexpr.set_disaster();
             DisasterBase.StartDisaster();
             used = true;
         }
     }
         );
 }
Ejemplo n.º 3
0
 public void OnTriggerEnter2D(Collider2D other)
 {
     if (!can_go_up || ConfigConstexpr.get_instance().has_disaster)
     {
         return;
     }
     if (other.CompareTag("Human"))
     {
         ++pass_by_cnt;
         HumanController hc = other.GetComponent <HumanController> ();
         if (hc.take_subway)
         {
             other.gameObject.SetActive(false);
             Debug.Log("Some one take the subway and go away");
         }
     }
 }