Ejemplo n.º 1
0
    public virtual void Die()
    {
        if (isPlayer != true)
        {
            //Destroy(gameObject);


            isAlive = false;
            Bounds b = gameObject.collider.bounds;
            Destroy(gameObject.collider);
            GraphUpdateObject guo = new GraphUpdateObject(b);
            AstarPath.active.UpdateGraphs(guo, 0.0f);
            AstarPath.active.FlushGraphUpdates();
            anim.Play("human_death");
            CharacterController cc = GetComponent(typeof(CharacterController)) as CharacterController;
            cc.enabled   = false;
            this.enabled = false;


            Sapien sa = gameObject.GetComponent <Sapien>();
            if (sa != null)
            {
                Destroy(sa);
            }
            SimpleSmoothModifier ssm = gameObject.GetComponent <SimpleSmoothModifier>();
            if (ssm != null)
            {
                Destroy(ssm);
            }
            Seeker s = gameObject.GetComponent <Seeker>();
            if (s != null)
            {
                Destroy(s);
            }
            CapsuleCollider cap = gameObject.GetComponent <CapsuleCollider>();
            if (cap != null)
            {
                Destroy(cap);
            }
        }
        else
        {
            anim.Play("human_death");
        }
    }
Ejemplo n.º 2
0
        public UnlockH1(string output_dir, string g_path, string t_path, string s_path)
        {
            if (!string.IsNullOrEmpty(g_path))
            {
                try { GuerillaInterface = new Guerilla(output_dir, g_path); }
                catch (BlamLib.Debug.ExceptionLog) { EncounteredInvalidExe = true; }
            }

            if (!string.IsNullOrEmpty(t_path))
            {
                try { ToolInterface = new Tool(output_dir, t_path); }
                catch (BlamLib.Debug.ExceptionLog) { EncounteredInvalidExe = true; }
            }

            if (!string.IsNullOrEmpty(s_path))
            {
                try { SapienInterface = new Sapien(output_dir, s_path); }
                catch (BlamLib.Debug.ExceptionLog) { EncounteredInvalidExe = true; }
            }
        }
Ejemplo n.º 3
0
		public UnlockH2(string output_dir, string g_path, string t_path, string s_path)
		{
			if (!string.IsNullOrEmpty(g_path))
				try { GuerillaInterface = new Guerilla(output_dir, g_path); }
				catch (BlamLib.Debug.ExceptionLog) { EncounteredInvalidExe = true; }

			if (!string.IsNullOrEmpty(t_path))
				try { ToolInterface = new Tool(output_dir, t_path); }
				catch (BlamLib.Debug.ExceptionLog) { EncounteredInvalidExe = true; }

			if (!string.IsNullOrEmpty(s_path))
				try { SapienInterface = new Sapien(output_dir, s_path); }
				catch (BlamLib.Debug.ExceptionLog) { EncounteredInvalidExe = true; }
		}
Ejemplo n.º 4
0
    public static void generate(Level level, int width, int height)
    {
        GameObject sapien = (GameObject)Resources.Load("mob_homo_sapien", typeof(GameObject));
        GameObject flores = (GameObject)Resources.Load("mob_homo_floresiensis", typeof(GameObject));

        level.tiles = new Tile[width, height];
        level.block = new Block[width, height];
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                float perlinX, perlinY;
                perlinX = i * 0.7f;
                perlinY = j * 0.7f;

                GameObject go    = (GameObject)GameObject.Instantiate(Tile.allTileModels[Tile.Type.STONE], new Vector3(i * 2, 0, j * 2), Quaternion.Euler(new Vector3(0, 0, 0)));
                Bounds     btile = go.collider.bounds;
                //Pathfinding.Console.Write ("// Placing Object\n");
                GraphUpdateObject guo = new GraphUpdateObject(btile);
                AstarPath.active.UpdateGraphs(guo);
                level.tiles[i, j] = go.GetComponent <Tile>();

                Block.Type blockType;

                //GENERATE END GAME
                if (j == height - 1 && i == width / 2)
                {
                    for (int x = -width / 2; x < width / 2; x++)
                    {
                        for (int y = 0; y < 14; y++)
                        {
                            GameObject tile = (GameObject)GameObject.Instantiate(Tile.allTileModels[Tile.Type.STONE], new Vector3((x + i) * 2, 0, (y + j) * 2), Quaternion.Euler(new Vector3(0, 0, 0)));
                        }
                    }

                    continue;
                }

                if (j > 0 && j < 4 && i > width / 2 - 2 && i < width / 2 + 2)
                {
                    continue;
                }


                if (i == 0 || i == width - 1 || j == 0 || j == height - 1)
                {
                    blockType = Block.Type.BORDER;
                }
                else
                {
                    blockType = Block.Type.STONE;
                }

                currentSeed = defaultSeed;
                if (blockType == Block.Type.BORDER || perlinNoise(perlinX, perlinY, 0.6f) > -0.2f)
                {
                    GameObject block = (GameObject)GameObject.Instantiate(Block.allBlockModels[blockType], new Vector3(i * 2, 0, j * 2), Quaternion.Euler(new Vector3(0, 0, 0)));

                    Bounds b = block.collider.bounds;
                    //Pathfinding.Console.Write ("// Placing Object\n");
                    GraphUpdateObject guo1 = new GraphUpdateObject(b);
                    AstarPath.active.UpdateGraphs(guo1);
                    level.block[i, j] = block.GetComponent <Block>();
                    level.block[i, j].Init(blockType, level, i, j);
                }
                else
                {
                    if (UnityEngine.Random.Range(0, 1f) < 0.04f)
                    {
                        currentSeed = defaultSeed + 123;

                        if (perlinNoise(perlinX, perlinY, 0.2f) > 0.0f)
                        {
                            GameObject npc = (GameObject)GameObject.Instantiate(sapien, new Vector3(i * 2, 0, j * 2), Quaternion.identity);
                            Sapien     mob = npc.GetComponent <Sapien>();
                            mob.type  = 0;
                            mob.level = level;
                            level.allMobs.Add(mob);
                        }
                        else
                        {
                            GameObject npc = (GameObject)GameObject.Instantiate(flores, new Vector3(i * 2, 0, j * 2), Quaternion.identity);
                            Sapien     mob = npc.GetComponent <Sapien>();
                            mob.type  = 1;
                            mob.level = level;
                            level.allMobs.Add(mob);
                        }
                    }
                }
            }
        }

        OnGenerateMap(level, width, height);
    }