예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Time.time >= nextLionSpawn && FlyingLion.GetNumberOf() < maxLions)
        {
            FlyingLion lion = Instantiate(lionPrefab) as FlyingLion;

            lion.gameObject.transform.position = RandomMonsterPosition();
            nextLionSpawn = Time.time + lionSpawnRate;

            if (Time.time > 180.0f)
            {
                lion.GetComponent <FlyingLion>()._approachSpeed *= 1.5f;
            }
            if (Time.time > 360.0f)
            {
                lion.GetComponent <FlyingLion>()._approachSpeed *= 1.5f;
            }
        }

        if (Time.time >= nextLizSpawn && LizardMonster.GetNumberOf() < maxLizards)
        {
            LizardMonster liz = Instantiate(lizPrefab) as LizardMonster;
            liz.transform.position = RandomMonsterPosition();
            nextLizSpawn           = Time.time + lizSpawnRate;

            if (Time.time > 240.0f)
            {
                liz.xSpeed *= 2.0f;
            }
        }
    }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     lionPrefab = Resources.Load <FlyingLion>("FlyingLion");
     lizPrefab  = Resources.Load <LizardMonster>("Lizard_monster");
 }