Exemple #1
0
        public override void Start()
        {
//			if (rnd.NextDouble() >= 0.6) {
//				this.take_subway = true;
//			}
            current_uid = human_uid++;

            var daddy = get_parent_script();

            //			Debug.Log ("Human's daddy :" + daddy.gameObject);
            father_containers = daddy.childObjects;
            father_containers.humans.Add(this);


            static_init(get_parent_script());
            if (daddy.gameObject.name.Contains("Second"))
            {
                // 需要根据固定的apf来生成对应的场。
                generate_fixed_apf();
            }

            rb = GetComponent <Rigidbody2D> ();
            // 防止旋转
            rb.freezeRotation = true;
            // 添加自己的对象

            init_radius();
            init_weight();
            init_destine();
            init_speed();

            //			Debug.Log ("New Human: position:" + transform.position +", and map_position: " + daddy.pos2mapv(transform.position));
            // TODO: 将 in_disaster
            in_disaster = false;
        }
Exemple #2
0
        void Awake()
        {
            childObjects = new ChildObjects();

            //			var pos = this.transform.position;
            //			pos.z = uid_z;
            //			transform.position = pos;
            //			++uid_z;
        }
Exemple #3
0
        /*
         * 变换对象的父对象、
         * 非我别动
         */
        public void change_new_father_container(MonoBehaviour to_script)
        {
            BackgroundController new_father_script = to_script as BackgroundController;

            this.transform.parent = new_father_script.transform;
            father_containers     = new_father_script.childObjects;
            if (father_containers == null)
            {
                Debug.Log("Fathers are null.");
            }
        }
Exemple #4
0
        public override void Start()
        {
//			var daddy = transform.parent;
//			if (!daddy) print("Object has no parent");
//			var script = daddy.GetComponent<BackgroundController>();
//			if (!script) print("Parent has no EnemyData script");
//			Debug.Log ("DestController ready to get parent script.");
            var script = get_parent_script();

            father_containers = script.childObjects;
            father_containers.dests.Add(this);
            gameObject.layer = script.myLayer;

            HelperScript.change_z(this);

//			Debug.Log ("Add a Dest in layer in " + father_containers.backGround);
        }
Exemple #5
0
        // Use this for initialization
        public override void Start()
        {
//			var daddy = transform.parent;
//			if (!daddy) print("Object has no parent");
//			var script = daddy.GetComponent<BackgroundController>();
//			if (!script) print("Parent has no EnemyData script");

//			Debug.Log ("BlockController ready to get parent script.");
            // 获得父对象的脚本
            var script = get_parent_script();

            father_containers = script.childObjects;
            father_containers.blocks.Add(this);
            gameObject.layer = script.myLayer;

            HelperScript.change_z(this);

//			Debug.Log ("Add a Block.");

            SpriteRenderer render = GetComponent <SpriteRenderer> ();

//			valid_rb = GetComponent<Rigidbody2D> ();
            bounds = render.bounds;
        }