예제 #1
0
    // Use this for initialization
    void Start()
    {
        SceneCEO sceo = GameObject.Find("SceneCEO").GetComponent <SceneCEO>();

        for (int i = 0; i < sceo.spawnedManagerList.Count; i++)
        {
            if (sceo.spawnedManagerList[i].GetComponent <SwarmMovementManager>() != null)
            {
                friendlySwarmManager = sceo.spawnedManagerList[i].GetComponent <SwarmMovementManager>();
            }
        }

        //rubbleFab = Resources.Load<GameObject>("Prefabs/Rubble");
        barrelObj   = Resources.Load <GameObject>("Prefabs/OilBarrel");
        barrelObjBG = Resources.Load <GameObject>("Prefabs/OilBarrelBG");
        fireObj     = Resources.Load <GameObject>("Prefabs/FireParticle");
        rubbleSpr   = Resources.Load <Sprite>("Images/Gas_Station_Destroy");
        if (stats == null)
        {
            Debug.Log(Time.time + " " + gameObject.name + " missing stats");
        }
        statsObj = (Instantiate(stats) as GameObject).GetComponent <BuildingStats>();

        DoInitialSpawn();


        GetComponent <SpriteRenderer>().sortingOrder = -(int)((transform.position.y + ySortingOffset) * 100);
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        SceneCEO sceo = GameObject.Find("SceneCEO").GetComponent <SceneCEO>();

        for (int i = 0; i < sceo.spawnedManagerList.Count; i++)
        {
            if (sceo.spawnedManagerList[i].GetComponent <SwarmMovementManager>() != null)
            {
                friendlySwarmManager = sceo.spawnedManagerList[i].GetComponent <SwarmMovementManager>();
            }
        }

        compyPrefab           = Resources.Load <GameObject>("Prefabs/Compy");
        dilophoPrefab         = Resources.Load <GameObject>("Prefabs/Dilophosaurus");
        sabreToothTigerPrefab = Resources.Load <GameObject>("Prefabs/SabreToothTiger");
        triceratopsPrefab     = Resources.Load <GameObject>("Prefabs/Triceratops");
        trexPrefab            = Resources.Load <GameObject>("Prefabs/T-Rex");
        spinoPrefab           = Resources.Load <GameObject>("Prefabs/Spinosaurus");
        playerDino            = GameObject.Find("PlayerDino").GetComponent <Player>();

        dinoIndexToObjectMap = new Dictionary <int, GameObject>();
        dinoIndexToObjectMap.Add(0, compyPrefab);
        dinoIndexToObjectMap.Add(1, dilophoPrefab);
        dinoIndexToObjectMap.Add(2, sabreToothTigerPrefab);
        dinoIndexToObjectMap.Add(3, triceratopsPrefab);
        dinoIndexToObjectMap.Add(4, trexPrefab);
        dinoIndexToObjectMap.Add(5, spinoPrefab);

        panels = new List <Transform>();
        GameObject canvas = GameObject.Find("Canvas");

        oilAmountText = canvas.transform.Find("OilPanel").Find("Count").GetComponent <Text>();
        panels.Add(canvas.transform.Find("Panel1"));
        panels.Add(canvas.transform.Find("Panel2"));
        panels.Add(canvas.transform.Find("Panel3"));
        panels.Add(canvas.transform.Find("Panel4"));
        panels.Add(canvas.transform.Find("Panel5"));
        panels.Add(canvas.transform.Find("Panel6"));

        // Bring back is UI cost elements need to be updated.
        //UpdateCostPanels();
        UpdateDisplays();
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        bitePrefab = Resources.Load <GameObject>("Prefabs/Fangs");
        SceneCEO sceo = GameObject.Find("SceneCEO").GetComponent <SceneCEO>();

        for (int i = 0; i < sceo.spawnedManagerList.Count; i++)
        {
            if (sceo.spawnedManagerList[i].GetComponent <SwarmMovementManager>() != null)
            {
                swarmManager = sceo.spawnedManagerList[i].GetComponent <SwarmMovementManager>();
            }
        }

        stats              = (Instantiate(statsFab) as GameObject).GetComponent <AgentStats>();
        curBehavior        = Instantiate(normalBehaviorPrefab);
        lastTimeDirChanged = Time.time - dirChangeDelay + 0.1f; //force update
        curTargetPos       = lastTargetPos = transform.position;
        //Debug.Log(gameObject.name + " start pos " + transform.position + ", curTargetPos=" + curTargetPos + ", lastTargetPos=" + lastTargetPos + ", bMap=" + curBehavior.name);
        //Debug.Log(gameObject.name + " maxMovePerSec=" + stats.maxMoveSpeedPerSec + ", strideDist=" + stride + ", timeBetweenSteps=" + dirChangeDelay);
        firstUpdate = true;
        retardCheck();
    }