コード例 #1
0
ファイル: Survivor.cs プロジェクト: PeakPei/TheWall_Unity2D
    void Start()
    {
        uiMaster      = GameObject.FindGameObjectWithTag("GM").GetComponent <UI_Master> ();
        dialoguePanel = uiMaster.dialoguePanel;
        dialogueText  = uiMaster.dialogueText;
        charPortrait  = uiMaster.charPortrait;
        survivorPanel = uiMaster.survivorPanel;
        charName      = uiMaster.charName;

        myTransform = transform;

        if (mySprite == null)
        {
            // when this Survivor is spawned they need a name
            name = GetName(false);
            // get the Sprite (for the Player's UI if this Survivor joins a town)
            mySprite = GetComponent <SpriteRenderer> ().sprite;
        }



        // get the current mood Type
        moodType = GetMoodType();
        // and store the current mood
        currMood = mood;

        if (townCentral == null)
        {
            townCentral = GameObject.FindGameObjectWithTag("Town_Central").GetComponent <Town_Central>();
        }
    }
コード例 #2
0
ファイル: UI_Master.cs プロジェクト: PeakPei/TheWall_Unity2D
 void Start()
 {
     // check that we're not in the game over screen
     if (Application.loadedLevel == 0)
     {
         townCentral = GameObject.FindGameObjectWithTag("Town_Central").GetComponent <Town_Central>();
     }
 }
コード例 #3
0
    void Start()
    {
        townCentral = GameObject.FindGameObjectWithTag("Town_Central").GetComponent <Town_Central> ();
        // boost the gather timer
//		townCentral.gatherTimeBoost = townCentral.gatherTimeBoost + timeBoost;

        // add habitants to Survivor Vacancies
//		townCentral.survivorVacancies = townCentral.survivorVacancies + maxHabitants;
//		townCentral.maxGatherers = townCentral.maxGatherers + maxHabitants;

        // decrease this town tile's HP because house's lower their defenses
        townTileProps = GetComponentInParent <TownTile_Properties> ();
        townTileProps.tileHitPoints = townTileProps.tileHitPoints - hpLoss;
    }
コード例 #4
0
    void Start()
    {
        gmScript = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster> ();
        if (Application.loadedLevel == 0)
        {
            townCentral     = GameObject.FindGameObjectWithTag("Town_Central").GetComponent <Town_Central>();
            camFollowScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera_Follow>();
            mapScript       = GetComponent <Map_Manager>();
        }

        myTransform = transform;
        // FOR NOW im going to spawn a selection box here to be able to see what town tile i have selected
        GameObject tileSelectBox = Instantiate(selectionBox, myTransform.position, Quaternion.identity) as GameObject;

        tileSelectBox.transform.parent = myTransform;
        stopSelecting = false;
    }
コード例 #5
0
ファイル: Gatherer.cs プロジェクト: PeakPei/TheWall_Unity2D
    public Mouse_Controls mouse;     // to tell it to stop selecting


    void Start()
    {
        // check if name is null to see if this is a new gatherer or if it's already on the list
        if (name == null)
        {
            name = GetName(false);
        }

        myTransform   = transform;
        town          = GameObject.FindGameObjectWithTag("Town_Central");
        townResources = town.GetComponent <TownResources> ();
        townCentral   = town.GetComponent <Town_Central> ();
        GameObject map = GameObject.FindGameObjectWithTag("Map_Manager");

        mapManager = map.GetComponent <Map_Manager> ();
        mouse      = map.GetComponent <Mouse_Controls> ();

        gathering = true;
    }
コード例 #6
0
ファイル: Horde.cs プロジェクト: PeakPei/TheWall_Unity2D
    void Start()
    {
        gmScript    = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster> ();
        townCentral = GameObject.FindGameObjectWithTag("Town_Central").GetComponent <Town_Central> ();

        // get the Position of the Player's capital (so we can move the Rigidbody towards it)
        capitalPosition = gmScript.startingPlayerPos;
        rb = GetComponent <Rigidbody2D> ();

        // TEST: create 5 AI elite units
//		for (int x = 0; x <= 5; x++) {
//			hordeMembers.Add(new Unit_Data(description: "Some description.", allegiance: Unit_Data.Allegiance.monster, quality: Unit_Data.Quality.high, fireRate: 1, sDamage: 2f, mDamage: 3f, lDamage: 5f));
//		}

        // TEST2: create 1 AI high
//		hordeMembers.Add(new Unit_Data(description: "Some description.", allegiance: Unit_Data.Allegiance.monster, quality: Unit_Data.Quality.high, fireRate: 1, sDamage: 2f, mDamage: 3f, lDamage: 5f));

//		unitHolder.gameObject.AddComponent <AI_Enemy> ();
//		leader = unitHolder.GetComponent<AI_Enemy> ();
//		leader.ForceInit (Battle_Unit.Quality.high);

        myTransform = transform;
    }
コード例 #7
0
 void Awake()
 {
     hordeSpwn   = GetComponentInParent <HordeSpawner> ();
     townCentral = GameObject.FindGameObjectWithTag("Town_Central").GetComponent <Town_Central> ();
 }