Пример #1
0
 public CreatureEntity(ObjectGUID objectGUID, creature creature, VanillaWorld vanillaWorld)
     : base(objectGUID)
 {
     this.VanillaWorld = vanillaWorld;
     this.Creature     = creature;
     this.Template     = CreatureTemplateDatabase.SingleOrDefault(ct => ct.Entry == creature.id);
 }
Пример #2
0
        public void AddCreatureEntity(creature creature)
        {
            var guid           = new ObjectGUID((ulong)creature.guid, TypeID.TYPEID_UNIT);
            var creatureEntity = new CreatureEntity(guid, creature, vanillaWorld);

            CreatureEntities.Add(creatureEntity);
            creatureEntity.Setup();
        }
Пример #3
0
    public List <creature> randomCreatures(int num)
    {
        Debug.Log("Spawn creatures to simulate preset list");

        List <creature> toSpawnAnimals = new List <creature>();

        for (int i = 0; i < num; i++)
        {
            creature toAdd = new creature(i);
            toSpawnAnimals.Add(toAdd);
        }
        Debug.Log(toSpawnAnimals.Count);
        return(toSpawnAnimals);
    }
Пример #4
0
        private void CreatureSearchButton_Click(object sender, EventArgs e)
        {
            BestiarioDAO bes = new BestiarioDAO();
            creature     ce  = bes.Search(c.Text);

            creatureXpTextBox.Text             = ce.xp.ToString();
            creatureLvlTextBox.Text            = ce.lvl.ToString();
            creatureNameTextBox.Text           = ce.name.ToString();
            creatureHeightTextBox.Text         = ce.height.ToString();
            creatureWeightTextBox.Text         = ce.weight.ToString();
            creatureManaTextBox.Text           = ce.mana.ToString();
            creatureLifeTextBox.Text           = ce.life.ToString();
            creatureBackgroundRichTextBox.Text = ce.bk.ToString();
        }
Пример #5
0
        public CreatureInfo(ObjectGUID objectGUID, creature creature, creature_template template) : base(objectGUID)
        {
            DisplayID = NativeDisplayID = creature.modelid;
            Health    = (int)creature.curhealth;
            MaxHealth = (int)template.MaxLevelHealth;
            Level     = template.MaxLevel;

            NPCFlags        = (int)template.NpcFlags;
            DynamicFlags    = (int)template.DynamicFlags;
            UnitFlag        = (int)template.UnitFlags;
            FactionTemplate = (uint)template.FactionAlliance;
            Entry           = template.Entry; //Used to set the creature name.

            CombatReach = 30f;
        }
Пример #6
0
    public void spawnAnimal()
    {
        Debug.Log("spawning creature");
        //Connect creature list to

        int      randomIndex = Random.Range(0, STATICWalkingScene.spawnCreatures.Count);
        creature spawnThis   = STATICWalkingScene.spawnCreatures[randomIndex];

        //Actual CODE for Spawning Creature
        GameObject toSpawn = prefabCreature;

        toSpawn.AddComponent <PolygonCollider2D> ();

        //Set fields for BATTLE information
        toSpawn.GetComponent <creature> ().spawned      = true;
        toSpawn.GetComponent <creature> ().num          = spawnThis.num;
        toSpawn.GetComponent <creature> ().sceneControl = this.gameObject;

        creature = toSpawn;

        //Need to spawn OFF SCREEN
        Instantiate(toSpawn, new Vector3(-4.0f, -2.0f), Quaternion.identity);
    }
Пример #7
0
    public void create_map()
    {
        create_enclosure();
        MapData map_data = global_instance.Instance.GetMapData();
        if(map_data != null)
        {
            for (int i = 0; i < map_data.width_; i++)
            {
                for (int j = 0; j < map_data.height_; j++)
                {
                    int group = map_data.groups_[i, j];
                    if (group != 11)
                    {
                        int temp_x = (_max_x - map_data.width_) / 2 + i;
                        int temp_y = /*(_max_y - map_data.height_)+ */j + 20;
                        crash_mole mole_entry = global_instance.Instance._crash_manager.get_crash_mole_addr(temp_x, 9, temp_y)._crash_mole;
                        if (mole_entry == null)
                        {
                            crash_base_obj obj = null;
                            if (group != 10)
                            {
                                obj = global_instance.Instance._crash_manager.create_crash_obj(temp_x, temp_y);
                            }
                            else
                            {
                                obj = global_instance.Instance._crash_manager.create_flag_obj(temp_x, temp_y);
                            }

                            mole_entry = global_instance.Instance._crash_manager.create_crash_mole();
                            mole_entry.add_crash_obj(obj);
                            mole_entry._color_group = group;
                            global_instance.Instance._crash_manager.add_crash_mole(mole_entry);
                            create_mole(i, j, mole_entry);
                        }
                    }
                }
            }
        }

        for (int x = 0; x < (int)_max_x; x++)
        {
            for (int z = 0; z < (int)_max_z; z++)
            {
                for (int y = 0; y < (int)_max_y; y++)
                {
                    if (_crash_objs[x, z, y]._crash_obj != null)
                    {
                        crash_base_obj entry = _crash_objs[x, z, y]._crash_obj;
                        switch(entry.get_obj_type())
                        {
                            case crash_obj_type.normal:
                                {
                                    GameObject obj_temp = Object.Instantiate<GameObject>(_source_crash_mole_obj);
                                    _Game_objs.Add(obj_temp);
                                    crash_obj crash_obj_temp = (crash_obj)entry;                                  
                                    crash_obj_temp._grid = obj_temp.GetComponent<crashmolegrid>();
                                    crash_obj_temp._grid.set_group(_crash_objs[x, z, y]._crash_obj._crash_mole._color_group);    
                                }
                                break;
                            case crash_obj_type.flag:
                                {
                                    GameObject obj_temp = Object.Instantiate<GameObject>(_source_flag_mole_obj);
                                    _Game_objs.Add(obj_temp);
                                    crash_obj_flag crash_temp = (crash_obj_flag)entry;
                                    crash_temp._flag = obj_temp.GetComponent<crash_flag>();                                
                                }
                                break;
                        }
                        float x_temp = x * _grid_distance;
                        float z_temp = z * _grid_distance;
                        float y_temp = y * _grid_distance;
                        entry.set_position(x_temp, y_temp, z_temp);
                    }                    
                }
            }
        }

        foreach (crash_mole entry in _crash_moles_list)
        {
            entry.update_side();
        }

        if(_creature == null)
        {
            GameObject obj_temp = Resources.Load<GameObject>("prefab/creature");
            GameObject obj_creature = Object.Instantiate<GameObject>(obj_temp);
            _creature = obj_creature.GetComponent<creature>();            
            _creature.set_creature_type(creature_type.creature_2);              
        }
        _camera_dir = camera_dir.front;
        _want_camera_dir = want_move_dir.no;
        _creature.gameObject.SetActive(true);
        _creature.set_position(22, 2, 3);

        _camera_dir = camera_dir.front;
        _want_camera_dir = want_move_dir.no;
        Camera.main.transform.position = get_camera_pos(_camera_dir);
        Camera.main.transform.eulerAngles = get_camera_rotation(_camera_dir);

        global_instance.Instance._ngui_edit_manager._camera_map.transform.position = get_map_camera_pos(_camera_dir);
        global_instance.Instance._ngui_edit_manager._camera_map.transform.eulerAngles = get_camera_rotation(_camera_dir);

        for (int i = 0 ;i < 4; i ++)
        {
            _dir_btn_down[i] = false;
        }

        next_update();
    }