Inheritance: MonoBehaviour
示例#1
0
    void Start()
    {
        player                = GameObject.Find("Player"); //Reference to Player Game Object
        playerScript          = player.GetComponent <PlayerController>();
        primaryController     = player.GetComponent <PrimaryController>();
        storeControllerScript = storeObject.GetComponent <StoreController>();
        ZombieSpawner         = GameObject.Find("ZombieSpawner");
        //spawnerScript = ZombieSpawner.GetComponent<Spawner>();
        zombieSpawnerScript = ZombieSpawner.GetComponent <ZombieSpawner>();

        optionsOverlay           = GameObject.Find("OptionsOverlay");
        optionsOverlayController = optionsOverlay.GetComponent <OptionsOverlayController>();
        optionsOverlayController.displayOverlayOff();

        soundController       = GameObject.Find("SoundController");
        soundControllerScript = soundController.GetComponent <SoundController>();

        rpController       = GameObject.Find("RPController");
        rpControllerScript = rpController.GetComponent <RPController>();


        if (PlayerPrefs.HasKey("PlayerName"))
        {
            playerName = PlayerPrefs.GetString("PlayerName");
        }


        //FB.API (Util.GetPictureURL ("me", 128, 128), Facebook.HttpMethod.GET, PictureCallBack);
    }
示例#2
0
    void Start()
    {
        player = GameObject.Find("Player");                                //Reference to Player Game Object
        playerControllerScript = player.GetComponent <PlayerController>(); // Reference to PlayerController Script
        secondaryController    = player.GetComponent <SecondaryController>();
        primaryController      = player.GetComponent <PrimaryController>();

        soundController       = GameObject.Find("SoundController");
        soundControllerScript = soundController.GetComponent <SoundController>();
        rpController          = GameObject.Find("RPController");
        rpControllerScript    = rpController.GetComponent <RPController>();

        zombieSpawner       = GameObject.Find("ZombieSpawner");
        zombieSpawnerScript = zombieSpawner.GetComponent <ZombieSpawner>();

        storeObject                = GameObject.Find("Store");
        storeControllerScript      = storeObject.GetComponent <StoreController>();
        primaryButtonsController   = storeObject.GetComponent <PrimaryButtonsController>();
        secondaryButtonsController = storeObject.GetComponent <SecondaryButtonsController>();
        survivorButtonsController  = storeObject.GetComponent <SurvivorButtonsController>();

        if (PlayerPrefs.HasKey("PlayerName"))
        {
            playerName = PlayerPrefs.GetString("PlayerName");
        }

        if (PlayerPrefs.HasKey("DisplayFreeRPBubble"))
        {
            displayFreeRPBubble = PlayerPrefs.GetInt("DisplayFreeRPBubble");
        }
        else
        {
            displayFreeRPBubble = 1;
        }
    }
示例#3
0
 void Awake()
 {
     if (zombie_spawner == null)
     {
         zombie_spawner = this;
     }
 }
示例#4
0
 void Start()
 {
     zombieSpawnerScript   = ZombieSpawner.GetComponent <ZombieSpawner> ();
     soundController       = GameObject.Find("SoundController");
     soundControllerScript = soundController.GetComponent <SoundController>();
     pS = PoolingSystem.Instance;
 }
 // Start is called before the first frame update
 void Start()
 {
     zomsp         = GameObject.FindObjectOfType <ZombieSpawner>();
     colbody123    = GetComponent <BoxCollider>();
     NumberOfWaves = 100;
     enemysleft    = 3;
     CurrentWave   = 0;
 }
示例#6
0
 // Start is called before the first frame update
 void Start()
 {
     instance      = FindObjectOfType <GameManager>();
     zombieSpawner = FindObjectOfType <ZombieSpawner>();
     time          = -3;
     level         = 1;
     score         = 0;
     acquiredItem  = 0;
 }
示例#7
0
 void Awake()
 {
     zombieAnimations = GetComponent <Animator>();
     networkAnim      = GetComponent <NetworkAnimator>();
     agent            = GetComponent <NavMeshAgent>();
     networkIdentity  = GetComponent <NetworkIdentity>();
     PLAYER           = GameObject.FindWithTag("Player");
     Explode.GetComponent <ParticleSystem>().Stop();
     es = GameObject.Find("ZombieSpawner").GetComponent <ZombieSpawner>();
 }
示例#8
0
    public static void RemovePlayer(GameObject g)
    {
        Destroy(g);
        players.Remove(g);

        if (players.Count == 0)
        {
            World.ExterminateTheWorld();
            ZombieSpawner.ExterminateTheWorld();
        }
    }
示例#9
0
 void GetRound()
 {
     if (zSpawner == null && FindObjectOfType <ZombieSpawner>())
     {
         zSpawner = FindObjectOfType <ZombieSpawner>();
     }
     if (zSpawner != null)
     {
         round.text = "Round: " + zSpawner.roundCounter.ToString();
     }
 }
示例#10
0
 // Use this for initialization
 protected void Start()
 {
     zombieSpawner = FindObjectOfType <ZombieSpawner>();
     wavesManager  = FindObjectOfType <WavesManager>();
     aliveZombies.Add(this);
     SetUpGame.MakeSmaller(gameObject);
     CreateZombie();
     player      = FindObjectOfType <PlayerAttack>();
     rigidBody2d = GetComponent <Rigidbody2D>();
     InvokeRepeating("CheckForSamePosZombies", 4.765f, 5f);
 }
示例#11
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        newGameButton.onClick.AddListener(NewGame);
        soldier = GameObject.Find("Soldier").GetComponent <Soldier>();
        spawner = GameObject.Find("Spawner").GetComponent <ZombieSpawner>();
    }
    // Start is called before the first frame update
    void Start()
    {
        player        = GameObject.Find("Player");
        zombieSpawner = GameObject.Find("Main Camera").GetComponent <ZombieSpawner>();
        //위와 같은 코드
        var mainCamera = GameObject.Find("Main Camera");

        if (mainCamera)
        {
            zombieSpawner = mainCamera.GetComponent <ZombieSpawner>();
        }
    }
示例#13
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
示例#14
0
 // Start is called before the first frame update
 void Start()
 {
     stats        = GameObject.FindGameObjectWithTag("StatsCollection").GetComponent <Stats>();
     gore         = GameObject.Find("GoreManager").GetComponent <Gore>();
     spawner      = GameObject.FindGameObjectWithTag("ZombieSpawner").GetComponent <ZombieSpawner>();
     canFace      = true;
     enemyAI      = GetComponent <EnemyAI>();
     player       = GameObject.Find("Player");
     rb           = GetComponent <Rigidbody2D>();
     ani          = GetComponent <ZombieAnimator>();
     currentState = EnemyState.MOVETOPLAYER;
 }
示例#15
0
 // Use this for initialization
 void Start()
 {
     gameSound     = GetComponent <GameSound>();
     zombieSpawner = GetComponent <ZombieSpawner>();
     if (!camBehaviour)
     {
         camBehaviour = Camera.main.GetComponent <CameraBehaviour>();
     }
     uiGameScreenPanel.SetActive(false);
     uiGameoverPanel.SetActive(false);
     uiStartScreenPanel.SetActive(true);
 }
 /// <summary>
 /// Accept按钮单击回调
 /// </summary>
 public void AcceptButtonClick()
 {
     QuestManager.Instance().questState = QuestManager.QuestState.ACCEPT;
     if (QuestManager.Instance().questState == QuestManager.QuestState.ACCEPT)
     {
         ZombieSpawner.Instance().SpawnZombieByType(questZombieIndex);
         quest_fox_content1.SetActive(false);
         quest_fox_content2.SetActive(true);
         acceptButton.SetActive(false);
         cancelButton.SetActive(false);
         okButton.SetActive(true);
     }
 }
示例#17
0
        void Start()
        {
            this.LevelCreator            = this.GetComponent <LevelCreator>();
            this.PayerController         = this.GetComponent <PlayerSpawner>();
            this.UserInputController     = this.GetComponent <UserInputController>();
            this.CoinSpawner             = this.GetComponent <CoinSpawner>();
            this.CoinController          = this.GetComponent <CoinController>();
            this.ZombieSpawner           = this.GetComponent <ZombieSpawner>();
            this.ZombieSpawner.LevelRoot = this.LevelRoot.transform;
            this.Camera = UnityEngine.Camera.main;

            this.StartGame();
        }
示例#18
0
文件: Zombie.cs 项目: ash-eff/LD48
    private void Awake()
    {
        audioHolder = FindObjectOfType <AudioHolder>();
        zombieHurt  = audioHolder.zombieHurt;
        zombieDead  = audioHolder.zombieDead;

        gameController   = FindObjectOfType <GameController>();
        playerController = FindObjectOfType <PlayerController>();
        matWhite         = Resources.Load("WhiteFlash", typeof(Material)) as Material;
        matDefault       = spr.material;
        zombieSpawner    = FindObjectOfType <ZombieSpawner>();
        currentSpeed     = 6f;
        randomOffset     = new Vector3(Random.Range(-.5f, .5f), Random.Range(-.5f, .5f), 0);
    }
示例#19
0
    // Use this for initialization
    void Awake()
    {
        // Get components
        animator         = GetComponent <Animator>();
        zombieDeathSound = GetComponent <AudioSource>();
        capCollider      = GetComponent <CapsuleCollider>();
        hit = GetComponentInChildren <ParticleSystem>();

        // Get instance of ZombieSpawner
        zombieManager = GameObject.FindGameObjectWithTag("Manager").GetComponent <ZombieSpawner>();

        // Make the Zombie have full health upon spawn.
        currentHealth = health;
    }
    void Start()
    {
        player              = GameObject.Find("Player");
        ZombieSpawner       = GameObject.Find("ZombieSpawner");
        soundController     = GameObject.Find("SoundController");
        playerScript        = player.GetComponent <PlayerController> ();
        secondaryController = player.GetComponent <SecondaryController> ();

        storeControllerScript     = storeObject.GetComponent <StoreController>();
        survivorButtonsController = storeObject.GetComponent <SurvivorButtonsController>();
        //spawnerScript = ZombieSpawner.GetComponent<Spawner> ();
        zombieSpawnerScript   = ZombieSpawner.GetComponent <ZombieSpawner> ();
        soundControllerScript = soundController.GetComponent <SoundController>();
    }
示例#21
0
    private void SetLaneSpawner()
    {
        var spawners = FindObjectsOfType <ZombieSpawner>();

        foreach (ZombieSpawner spawner in spawners)
        {
            bool IsCloseEnough = (Mathf.Abs(spawner.transform.position.y - transform.position.y) <= Mathf.Epsilon);

            if (IsCloseEnough)
            {
                myLaneSpawner = spawner;
            }
        }
    }
示例#22
0
	// Use this for initialization
	void Start () {
		mainMenuCanvas = GameObject.Find( "MainMenu" ).gameObject.GetComponent<Canvas>();
		optionsCanvas = GameObject.Find( "OptionsMenu" ).gameObject.GetComponent<Canvas>();
		loseCanvas = GameObject.Find( "LoseMenu" ).gameObject.GetComponent<Canvas>();
		winCanvas = GameObject.Find( "WinMenu" ).gameObject.GetComponent<Canvas>();
		player = GameObject.Find( "Player" ).gameObject.GetComponent<Player>();
		daycycle = GameObject.Find( "Stars" ).gameObject.GetComponent<Daycycle>();
		zombieSpawner = GameObject.Find( "ZombieSpawnPoints" ).gameObject.GetComponent<ZombieSpawner>();
		firstPersonController = GameObject.Find( "Player" ).GetComponent<FirstPersonController>();

		ChangeState( GameState.MainMenu );
		firstPersonController.enabled = false;
		Cursor.visible = true;
		daycycle.SetTimeScale( 20f );
	}
示例#23
0
    /////////////////////
    //COLLISION CHECKER//
    /////////////////////
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Zombie") || other.gameObject.CompareTag("Player"))
        {
            var otherPlayer           = other.gameObject;
            var otherPlayerAttributes = otherPlayer.GetComponent <PlayerAttributes>();
            var playerAttributes      = GetComponent <PlayerAttributes>();
            Debug.Log("PlayerMass" + otherPlayerAttributes.playerMass);
            Debug.Log("MyselfMass" + playerAttributes.playerMass);
            // If main player is smaller
            if (otherPlayerAttributes.playerMass > playerAttributes.playerMass)
            {
                PlayerNetworkController.Kill(playerAttributes.id, GetComponent <Transform>().position.x, GetComponent <Transform>().position.z);
            }

            // If other player is smaller
            else if (otherPlayerAttributes.playerMass < playerAttributes.playerMass)
            {
                PlayerNetworkController.Kill(otherPlayerAttributes.id, other.GetComponent <Transform>().position.x, other.GetComponent <Transform>().position.z);
                Debug.Log(GameAttributes.mainPlayer.GetComponent <PlayerAttributes>().id + " " + playerAttributes.id);
                if (GameAttributes.mainPlayer.GetComponent <PlayerAttributes>().id == playerAttributes.id)
                {
                    particles.Play();
                }
                if (other.gameObject.CompareTag("Zombie"))
                {
                    ZombieSpawner.ZombieCollide(other.gameObject.transform.parent.gameObject);
                }
            }
        }

        if (other.gameObject.CompareTag("Obstacle"))
        {
            var playerId   = GetComponent <PlayerAttributes>().id;
            var obstacleId = other.GetComponent <ObstacleController>().id;
            // Debug.Log(id);
            KnickKnackNetworkController.ObstacleCollision(playerId, obstacleId);
            GetComponent <PlayerMovement>().HitObstacle();
        }

        if (other.gameObject.CompareTag("Food"))
        {
            var playerId = GetComponent <PlayerAttributes>().id;
            var foodId   = other.GetComponent <FoodController>().id;
            // Debug.Log(id);
            KnickKnackNetworkController.FoodEaten(playerId, foodId);
        }
    }
示例#24
0
    void ZombieSpawnTask()
    {
        if ((activeZombies >= maxActiveZombies) || (totalSpawns >= maxTotalSpawns))
        {
            // Nothing to do, can't spawn anymore zombies
            CancelInvoke("ZombieSpawnTask");
            return;
        }

        ZombieSpawner point = spawnPoints[spawnPointIndex].GetComponent <ZombieSpawner>();

        point.SpawnZombie();

        activeZombies  += 1;
        totalSpawns    += 1;
        spawnPointIndex = (spawnPointIndex + 1) % spawnPoints.Count;
    }
示例#25
0
 public void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     if (Instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         this.zombieSpawner          = this.GetComponent <ZombieSpawner>();
         this.playerControls         = this.player.GetComponent <ControlsManager>();
         this.playerShooter          = this.player.GetComponent <Shooter>();
         this.playerControls.enabled = false;
         this.playerShooter.enabled  = true;
     }
 }
示例#26
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject hud = GameObject.FindGameObjectWithTag("PlayerHUD");

        playerHUD = hud.GetComponent <PlayerHUD>();

        GameObject s1 = GameObject.Find("ZombieSpawnPoint1");
        GameObject s2 = GameObject.Find("ZombieSpawnPoint2");

        spawner1 = s1.GetComponent <ZombieSpawner>();
        spawner2 = s2.GetComponent <ZombieSpawner>();

        int   numZombies  = (int)LevelData[0][0];
        float zombieDelay = (float)LevelData[0][1];
        int   maxAmmo     = (int)LevelData[0][2];

        playerHUD.ammoCounter.maxAmmo = maxAmmo;
        spawner1.StartSpawning(numZombies / 2, zombieDelay);
        spawner2.StartSpawning(numZombies / 2, zombieDelay);
    }
示例#27
0
    public void SaveData(Direction direction)
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        health        = player.GetComponent <PlayerMovement>().health;
        ammo          = player.GetComponentInChildren <WeaponDef>().ammo;
        currentWeapon = player.GetComponentInChildren <WeaponMenager>().currentWeapon;
        //get stats from origin zombie
        zombieDef            = GameObject.FindGameObjectWithTag("OriginZombie").GetComponent <ZombieDef>();
        zombieScore_current  = zombieDef.score;
        zombieDamage_current = zombieDef.damage;
        zombieHealth_current = zombieDef.health;
        zombieSpeed_current  = zombieDef.speed;
        //get stats from zombie spawner
        ZombieSpawner zombieSpawner = FindObjectOfType <ZombieSpawner>();

        zombieCounter_current = zombieSpawner.zombieCounter;
        timeBetwSpawn_current = zombieSpawner.timeBetwSpawn;
        //save
        FindObjectOfType <SaveData>().setData(currentLevel, health, ammo, scoreOverall, currentWeapon, direction /*, zombieScore_Current, zombieDamage_current, zombieHealth_current, zombieSpeed_current, zombieCounter_current, timeBetwSpawn_current*/);
    }
示例#28
0
 // Start is called before the first frame update
 void Start()
 {
     zombieSpawner = FindObjectOfType <ZombieSpawner>();
     NextWave();
 }
示例#29
0
 // Use this for initialization
 void Start()
 {
     outside = true;
     health = 100;
     myAnimator = GetComponent<Animator> ();
     navMeshAgent = GetComponent<NavMeshAgent> ();
     transform = GetComponent<Transform> ();
     player = GameObject.FindGameObjectWithTag ("Player");
     closestWindowLocation = getClosest (windowLocations);
     attackSound = GetComponent<AudioSource> ();
     zombieSpawner = GameObject.FindGameObjectWithTag("spawner").GetComponent<ZombieSpawner>();
 }
 private void Awake()
 {
     instance = this;
 }
示例#31
0
 void Start()
 {
     ZombieSpawn = GameObject.FindGameObjectWithTag("SpawnManager").GetComponent <ZombieSpawner>();
 }
示例#32
0
 // Use this for initialization
 void Start()
 {
     currentHealth            = maxHealth;
     killsIndicatorController = GameObject.FindGameObjectWithTag("Kills Indicator").GetComponent <KillsIndicatorController> ();
     zombieSpawner            = GameObject.FindGameObjectWithTag("Zombie Controller").GetComponent <ZombieSpawner> ();
 }
示例#33
0
    // Use this for initialization
    void Start()
    {
        pathingCooldown = Random.Range(0.0f, 0.1f);

        zombieSpawnerReference = groundReference.GetComponent<ZombieSpawner>();

        UpdateStats();

        if (!isZombie) {
            Wander ();
            myMat.material = green;
        }

        biteCooldown = biteSpeed;
    }
 // Use this for initialization
 void Start()
 {
     deadText.enabled = false;
     replayButton.gameObject.SetActive(false);
     zombieSpawner = GameObject.FindGameObjectWithTag ("spawner").GetComponent<ZombieSpawner>();
     pauseText.enabled = false;
     paused = false;
     crosshairScale = 0.75f;
 }
示例#35
0
 void Awake()
 {
     gameManager = GameObject.FindGameObjectWithTag ("GameManager");
     feedback = GameObject.FindGameObjectWithTag("Feedback").GetComponent<Feedback>();
     spawner = GameObject.FindGameObjectWithTag ("GameManager").GetComponent<ZombieSpawner> ();
     teleporterList = new ArrayList();
 }