Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     mapData       = transform.Find("map").GetComponent <MapData>();
     makeMap       = transform.Find("map").GetComponent <MakeMap>();
     playerManager = transform.Find("PlayerManager").GetComponent <PlayerManager>();
     InitHero();
 }
Exemplo n.º 2
0
    private void Awake()
    {
        m_MonsterAnim = GetComponent <Animator>();
        map           = FindObjectOfType <MakeMap>();
        CurrentPos    = new Vector3(m_X, m_Y);

        Road = map.RoadMap;

        HP     = GameManager.Getinstance().Monster_HP;
        Max_HP = GameManager.Getinstance().Monster_HP;

        SetHP_Bar();
    }
Exemplo n.º 3
0
    private void moveNorth()
    {
        GameObject map       = GameObject.Find("Map");
        MakeMap    mapScript = map.GetComponent <MakeMap>();

        if ((int)this.transform.position.x < mapScript.map.Length)
        {
            ThirdPersonCharacter mycontroler = GetComponent <ThirdPersonCharacter>();
            mycontroler.Move(new Vector3(0, 0, 1), false, false);
            idle          = false;
            workRemaining = 15;
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// Возвращает вершину, заданную парой координат и делает её текущей
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="selected"></param>
 /// <returns></returns>
 public bool GetSelected(int x, int y, out Vertex selected)
 {
     selected = null;
     for (int i = 0; i < List.Count; i++)
     {
         if (MakeMap.IsPointInRectangle(List.ElementAt(i).X, List.ElementAt(i).Y, x, y))
         {
             selected = List.ElementAt(i);
             MakeMap.ViewPort.Invalidate();
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Возвращает вершину, заданную парой коорднинат
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public bool GetSelected(int x, int y)
        {
            for (int i = 0; i < List.Count; i++)
            {
                if (MakeMap.IsPointInRectangle(List.ElementAt(i).X, List.ElementAt(i).Y, x, y))
                {
                    MakeMap.ViewPort.SelectVertex(List.ElementAt(i));
                    return(true);
                }
            }

            MakeMap.ViewPort.UnSelectAll();
            return(false);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Возвращает из списка дугу, которой принадлежит
        /// точка, указанная парой координат
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public bool GetSelected(int x, int y)
        {
            for (int i = 0; i < List.Count; i++)
            {
                if (MakeMap.IsPointOnEdge(x, y, List.ElementAt(i).GetHead().X, List.ElementAt(i).GetHead().Y,
                                          List.ElementAt(i).GetEnd().X, List.ElementAt(i).GetEnd().Y))
                {
                    MakeMap.ViewPort.SelectEdge(List.ElementAt(i));
                    return(true);
                }
            }

            MakeMap.ViewPort.UnSelectAll();
            return(false);
        }
Exemplo n.º 7
0
	public static int Main (string [] args)
	{
		FileGenerator[] generators = new FileGenerator[]{
			new HeaderFileGenerator (),
			new SourceFileGenerator (),
			new ConvertFileGenerator (),
			new MphPrototypeFileGenerator (),
		};

		MakeMap composite = new MakeMap ();
		foreach (FileGenerator g in generators) {
			composite.FileCreators += new CreateFileHandler (g.CreateFile);
			composite.AssemblyAttributesHandler += 
				new AssemblyAttributesHandler (g.WriteAssemblyAttributes);
			composite.TypeHandler += new TypeHandler (g.WriteType);
			composite.FileClosers += new CloseFileHandler (g.CloseFile);
		}

		return composite.Run (args);
	}
Exemplo n.º 8
0
    void Start()
    {
        InitializeEntity();
        AutoTarget = new AstralProjection(gameObject);

        canAttack = true;
        if (attackingg == null)
        {
            attackingg = GameObject.FindGameObjectWithTag("Player");
            attacking  = attackingg.GetComponent <Entities>();
        }

        mapgen           = GameObject.FindGameObjectWithTag("MapGen").GetComponent <MakeMap>();
        initFloor        = mapgen.DungeonFloor;
        ai               = new MovementAI(mapgen.currentFloor());
        isWandering      = true;
        isBlindlyChasing = false;

        /*
         * path = ai.getPath (gameObject.transform.position, attackingg.transform.position);
         * ai.currentNode = path.pop ();
         */
    }
Exemplo n.º 9
0
    private void Start()
    {
        InitializeEntity();
        SelfCast    = new Heal(gameObject);
        SelfCast2   = new PoisonCloud(gameObject);
        AutoTarget  = new Fireball(gameObject);
        AutoTarget2 = new Mudball(gameObject);
        PosTarget   = new MagicMissle(gameObject);

        anim      = GetComponent <Animator> ();
        curHealth = gameObject.GetComponent <Status> ().getHealth();
        blood     = transform.Find("Blood").GetComponent <ParticleSystem>();

        Dungeon = GameObject.Find("MapGenerator").GetComponent <MakeMap>();

        weapon = transform.Find("Weapon");

        playerGUI = new PlayerGUI(this);


        paused         = false;
        Time.timeScale = 1;
    }
Exemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        //first use resources
        hunger--;
        warmth--;
        age++;
        if (happy > 0)
        {
            happy--;
        }
        if (birthCoolDown > 0)
        {
            birthCoolDown--;
        }

        //next consume if possible
        if (hunger < maxHunger - foodValue && food > 0)
        {
            food--;
            hunger += foodValue;
        }

        if (warmth < maxWarmth - clothValue && cloth > 0)
        {
            cloth--;
            warmth += clothValue;
        }

        if (lux > 0)
        {
            lux--;
            happy += luxValue;
        }



        //changes from last cycle are made.  Calculate fitness
        fitness = this.getFitness();

        if (idle)
        {
            //if idle we need to gather the information for the
            //input layer of the NN then forward feed the vector
            //this will give us an action to preform
            GameObject map         = GameObject.Find("Map");
            MakeMap    mapScript   = map.GetComponent <MakeMap>();
            Vector3    position    = this.transform.position;
            GameObject currentLoc  = mapScript.map[(int)position.x, (int)position.z];
            Tile       currentTile = currentLoc.GetComponent <Tile>();
            float[]    input       = { hunger - maxHunger / 2, warmth - maxWarmth / 2,    happy, gold, currentTile.foodProduction,
                                       currentTile.clothingProduction,  currentTile.luxProduction,
                                       currentTile.goldProduction };


            float[] output = myBrain.FeedForward(input);

            action = 0;


            for (int i = 0; i < output.Length; i++)
            {
                if (output[i] >= output[action])
                {
                    action = i;
                }
            }
            switch (action)
            {
            case 0:
                makeFood(currentTile);
                break;

            case 1:
                makeCloth(currentTile);
                break;

            case 3:
                makeLux(currentTile);
                break;

            case 4:
                makeGold(currentTile);
                break;

            case 5:
                moveNorth();
                break;

            case 6:
                moveSouth();
                break;

            case 7:
                moveEast();
                break;

            case 8:
                moveWest();
                break;

            default:
                //do nothing;
                break;
            }
        }
        else
        {
            workRemaining--;
            if (workRemaining <= 0)
            {
                idle = true;
                ThirdPersonCharacter mycontroler = GetComponent <ThirdPersonCharacter>();
                mycontroler.Move(new Vector3(0, 0, 0), false, false);
            }
        }
    }