Esempio n. 1
0
 public void zako2_init(ref Vector3 position, ref Quaternion rotation)
 {
     rigidbody_.init(ref position, ref rotation);
     collider_ = MyCollider.createEnemy();
     MyCollider.initSphereEnemy(collider_, ref position, 1f /* radius */);
     lock_target_      = LockTarget.create(this, new LockTarget.CalcPosition(calc_lock_position_center));
     enumerator_       = zako2_act(); // この瞬間は実行されない
     on_update_        = new OnUpdateFunc(zako2_update);
     on_render_update_ = new OnRenderUpdateFunc(zako2_render_update);
     life_             = 100f;
 }
Esempio n. 2
0
        public void dragon_init()
        {
            var position = new Vector3(-10f, -5f, 10f);

            rigidbody_.init(ref position, ref CV.QuaternionIdentity);
            rigidbody_.setDamper(2f);
            rigidbody_.setRotateDamper(20f);
            collider_ = MyCollider.createEnemy();
            MyCollider.initSphereEnemy(collider_, ref position, 1f /* radius */);
            lock_target_      = LockTarget.create(this, new LockTarget.CalcPosition(calc_lock_position_dragon));
            enumerator_       = dragon_act(); // この瞬間は実行されない
            on_update_        = new OnUpdateFunc(dragon_update);
            on_render_update_ = new OnRenderUpdateFunc(dragon_render_update);
            life_             = 10000000f;
            dragon_           = dragon_pool_;
            dragon_.init(this, ref rigidbody_.transform_.position_, ref rigidbody_.transform_.rotation_);
        }
Esempio n. 3
0
 public void init(Task task,
                  int idx,
                  ref Vector3 position,
                  ref Quaternion rotation,
                  DrawBuffer.Type draw_type)
 {
     rigidbody_.init(ref position, ref rotation);
     rigidbody_.setRotateDamper(8);
     collider_ = MyCollider.createEnemy();
     MyCollider.initSphereEnemy(collider_, ref position, 1f /* radius */);
     idx_         = idx;
     lock_target_ = LockTarget.create(task, new LockTarget.CalcPosition(this.calc_lock_position));
     locator_     = (idx_ == 0 ?
                     new Vector3(0f, 0f, 0f) :
                     new Vector3(0f, 0f, -3f));
     draw_type_ = draw_type;
 }
Esempio n. 4
0
        void Start()
        {
            TaskManager.Instance.init();
            // Sight.Instance.init();
            LockTarget.createPool();
            list_ = new List <TestTask>();
            GameObject prefab = null;

            for (var i = 0; i < MAX; ++i)
            {
                GameObject go;
                if (prefab == null)
                {
                    prefab = GameObject.Find("Cube");
                    go     = prefab;
                }
                else
                {
                    float range = 8;
                    go = Instantiate(prefab, new Vector3(Random.Range(-range, range),
                                                         Random.Range(-range, range),
                                                         Random.Range(-range, range)),
                                     Quaternion.identity) as GameObject;
                }
                var task = new TestTask();
                var pos  = go.transform.position;
                var rot  = go.transform.rotation;
                task.init();
                task.rigidbody_.init(ref pos, ref rot);
                var lock_target = LockTarget.create(task, new LockTarget.CalcPosition(task.calc_position));
                task.lock_target_ = lock_target;
                task.owner_       = go;
                list_.Add(task);
            }
            camera_ = Camera.main;

            player_ = Player.create();
        }
Esempio n. 5
0
        // private DrawBuffer dummy_draw_buffer_;

        void Start()
        {
            TaskManager.Instance.init();
            Sight.Instance.init(null /* material */);
            LockTarget.createPool();
            list_ = new List <TestTask>();
            GameObject prefab = null;

            for (var i = 0; i < MAX; ++i)
            {
                GameObject go;
                if (prefab == null)
                {
                    prefab = GameObject.Find("Cube");
                    go     = prefab;
                }
                else
                {
                    float range = 8;
                    go = Instantiate(prefab, new Vector3(Random.Range(-range, range),
                                                         Random.Range(-range, range),
                                                         Random.Range(-range, range)),
                                     Quaternion.identity) as GameObject;
                }
                var task = new TestTask();
                var pos  = go.transform.position;
                var rot  = go.transform.rotation;
                task.init(ref pos, ref rot);
                var lock_target = LockTarget.create(task, ref CV.Vector3Zero);
                task.lock_target_ = lock_target;
                task.owner_       = go;
                list_.Add(task);
            }
            camera_ = Camera.main;

            my_camera_ = MyCamera.create();
            // dummy_draw_buffer_ = new DrawBuffer();
        }
Esempio n. 6
0
        public void init(ref Vector3 position, ref Quaternion rotation, Type type)
        {
            base.init(ref position, ref rotation);
            collider_ = MyCollider.createEnemy();
            MyCollider.initSphereEnemy(collider_, ref position, 1f /* radius */);
            var lock_pos = new Vector3(0, 0, 0);

            lock_target_ = LockTarget.create(this, ref lock_pos);

            type_  = type;
            phase_ = Phase.Alive;
            switch (type_)
            {
            case Type.None:
                Debug.Assert(false);
                break;

            case Type.Zako:
                /* ここで GC.allocate が発生してしまう */
                enumerator_ = zako_act();                 // この瞬間は実行されない
                break;
            }
        }