コード例 #1
0
 // Setting up references
 void Awake()
 {
     obstacleSpawner = GameObject.FindGameObjectWithTag("ObstacleSpawner").GetComponent<ObstacleSpawner>();
     pickupSpawner = GameObject.FindGameObjectWithTag("PickupSpawner").GetComponent<PickupSpawner>();
     soundManager = GameObject.FindGameObjectWithTag("SoundManagerGO").GetComponent<SoundManager>();
     playerControls = player.GetComponent<CharacterUserControls>();
 }
コード例 #2
0
ファイル: Bomb.cs プロジェクト: hmcaio/UnityPorting
 void Awake()
 {
     // Setting up references.
     explosionFX = GameObject.FindGameObjectWithTag("ExplosionFX").GetComponent<ParticleSystem>();
     pickupSpawner = GameObject.Find("pickupManager").GetComponent<PickupSpawner>();
     layBombs = GameObject.FindGameObjectWithTag("Player").GetComponent<LayBombs>();
 }
コード例 #3
0
	void Awake ()
	{
		// Setting up the references.
		pickupSpawner = GameObject.Find("pickupManager").GetComponent<PickupSpawner>();
		anim = transform.root.GetComponent<Animator>();
        observers = new ArrayList();
        //attach(GameObject.Find("playerHealth").GetComponent<PlayerHealth>());
        //attach(GetComponent<PlayerHealth>());
    }
コード例 #4
0
	void Awake()
	{
        _player = GameObject.Find(Constants.Game.PLAYER_NAME);
        _pickupSpawner = GameObject.Find("Planet").GetComponent<PickupSpawner>();

		enemySpawner = FindObjectOfType<EnemySpawnerScript>();
		scoreManager = FindObjectOfType<HUDScoreScript>();
		hudMessage = GameObject.Find("HUDMessageCenter").GetComponent<HUDMessageScript>();
	}
コード例 #5
0
ファイル: Bomb.cs プロジェクト: theDrake/unity-experiments
 void Awake()
 {
     explosionFX =
       GameObject.FindGameObjectWithTag(
     "ExplosionFX"
       ).GetComponent<ParticleSystem>();
     pickupSpawner =
       GameObject.Find("pickupManager").GetComponent<PickupSpawner>();
     if (GameObject.FindGameObjectWithTag("Player"))
       layBombs =
     GameObject.FindGameObjectWithTag("Player").GetComponent<LayBombs>();
 }
コード例 #6
0
    public void OnRealTimeMessageReceived(bool isReliable, string senderId, byte[] data)
    {
        if (!gameLoaded)
        {
            return;
        }

        byte messageVersion = (byte)data[0];
        char messageType    = (char)data[1];

        if (messageType == 'U' && data.Length == updateMessageLength)
        {
            Dictionary <string, GameObject> players = levelManager.PlayerList();
            float posX           = System.BitConverter.ToSingle(data, 2);
            float posY           = System.BitConverter.ToSingle(data, 6);
            float velX           = System.BitConverter.ToSingle(data, 10);
            float velY           = System.BitConverter.ToSingle(data, 14);
            bool  facingLeft     = System.Convert.ToBoolean(data [18]);
            bool  attacking      = System.Convert.ToBoolean(data [19]);
            bool  blocking       = System.Convert.ToBoolean(data [20]);
            float health         = System.BitConverter.ToSingle(data, 21);
            float blockingAmount = System.BitConverter.ToSingle(data, 25);

            players [senderId].GetComponent <PlayerController> ().UpdateMultiplayerData(posX, posY, velX, velY, facingLeft, attacking, blocking, health, blockingAmount);
        }
        else if (messageType == 'H' && data.Length == hostMessageLength)
        {
            int spawnPoint  = System.BitConverter.ToInt32(data, 2);
            int pickupValue = System.BitConverter.ToInt32(data, 6);

            PickupSpawner spawner = levelManager.pickupSpawner;

            spawner.SetSpawn(spawnPoint, pickupValue);
        }
        else if (messageType == 'M' && data.Length == mapMessageLength)
        {
            int    mapIndex = System.BitConverter.ToInt32(data, 2);
            string mapName  = mapList[mapIndex];

            LoadMultiplayerGame(mapName);
        }
        else if (messageType == 'S' && data.Length == mapMessageLength)
        {
            int mapIndex = System.BitConverter.ToInt32(data, 2);
            GameObject.Find("Canvas").GetComponent <UIControl_MapSelector>().UpdateMap(mapIndex);
        }
    }
コード例 #7
0
    void Awake()
    {
        if (disableOnAwake)
        {
            gameObject.SetActive(false);
            return;
        }

        S = this;
        for (int i = 0; i < PlayerIdentity.numPlayersReal; i++)
        {
            StartCoroutine(RunTutorial(i));
            tutorialsRemaining += 1;
        }
        spawner         = FindObjectOfType <PickupSpawner>();
        spawner.enabled = false;
    }
コード例 #8
0
    // Start is called before the first frame update
    void Start()
    {
        //Set Game State to RUNNING
        currentState = gameStates.RUNNING;

        //Get Player
        player        = GameObject.FindGameObjectWithTag("Player");
        playerManager = player.GetComponent <PlayerManager>();

        //Get Spawner
        spawner       = GameObject.FindGameObjectWithTag("Spawner");
        pickupSpawner = spawner.GetComponent <PickupSpawner>();

        //Get Screen resolution in units
        height = Camera.main.orthographicSize * 2;
        width  = height * Screen.width / Screen.height;
    }
コード例 #9
0
ファイル: PlayerManager.cs プロジェクト: thomasdepraz/Snake
    // Start is called before the first frame update
    void Start()
    {
        //Get GameManager
        manager     = GameObject.FindGameObjectWithTag("GameManager");
        gameManager = manager.GetComponent <GameManager>();

        //Get Spawner
        pickupSpawner = spawner.GetComponent <PickupSpawner>();

        //Get player trail
        playerTrail = gameObject.GetComponent <PlayerTrail>();

        //Get player movement
        playerMovement = gameObject.GetComponent <PlayerMovement>();

        //GetHeadPosition
        headPoint = head.position;
    }
コード例 #10
0
    private void Awake()
    {
        if (Instance)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        _pickupQueue = new Queue <GameObject>(pickups.Length);
        foreach (var pickup in pickups)
        {
            var pickupObject = Instantiate(pickup, transform, true);
            pickupObject.SetActive(false);
            _pickupQueue.Enqueue(pickupObject);
        }
    }
コード例 #11
0
ファイル: Inventory.cs プロジェクト: AkhilMenon007/GCFG
 public void DropItem(Item discardItem, int discardAmount)
 {
     for (int i = 0; i < discardAmount;)
     {
         int count;
         if (i + 5 < discardAmount)
         {
             count = 5;
         }
         else
         {
             count = discardAmount - i;
         }
         var spawnLocation = transform.position + UnityEngine.Random.onUnitSphere * 3f;
         spawnLocation.y = 3f;
         PickupSpawner.SpawnPickup(discardItem, count, spawnLocation, transform.rotation);
         i += count;
     }
 }
コード例 #12
0
ファイル: PickupSpawner.cs プロジェクト: kvietcong/Sub-Sinker
    public override void OnStartServer()
    {
        if (instance != null)
        {
            Debug.LogError("More than one PickupSpawner in scene.");
        }
        else
        {
            instance = this;
        }

        spawned = false;
        GameObject serverManager = Instantiate(serverManagerPrefab, new Vector3(), Quaternion.identity);

        NetworkServer.Spawn(serverManager);

        ammoSpawnTimer   = Random.Range(2f, 10f);
        healthSpawnTimer = Random.Range(2f, 10f);

        t = 0;
    }
コード例 #13
0
 // Use this for initialization
 void Start()
 {
     pickup        = GameObject.Find("PickupSpawner").GetComponent <PickupSpawner>();
     arrowRenderer = GetComponentInChildren <MeshRenderer>();
 }
コード例 #14
0
ファイル: Pickup.cs プロジェクト: PeWiNi/MonguinsAndBeyond
 public void SetSpawner(PickupSpawner pickupS)
 {
     spawner = pickupS;
 }
コード例 #15
0
 private void Start()
 {
     pickupSpawner = gameObject.GetComponentInParent <PickupSpawner>();
 }
コード例 #16
0
    private PickupSpawner pickupSpawner;        // Reference to the pickup spawner.


    void Awake()
    {
        // Setting up the references.
        pickupSpawner = GameObject.Find("pickupManager").GetComponent <PickupSpawner>();
    }
コード例 #17
0
    private PickupSpawner pickupSpawner; // Reference to the pickup spawner.

    #endregion Fields

    #region Methods

    void Awake()
    {
        pickupSpawner =
          GameObject.Find("pickupManager").GetComponent<PickupSpawner>();
        anim = transform.root.GetComponent<Animator>();
    }
コード例 #18
0
    private bool landed;                 // Whether or not the crate has landed.

    void Awake()
    {
        pickupSpawner =
            GameObject.Find("pickupManager").GetComponent <PickupSpawner>();
        anim = transform.root.GetComponent <Animator>();
    }
コード例 #19
0
ファイル: Bomb.cs プロジェクト: lassewedin/AlienAttack
 void Awake()
 {
     explosionFX   = GameObject.FindGameObjectWithTag("ExplosionFX").GetComponent <ParticleSystem>();
     layBombs      = GameObject.FindGameObjectWithTag("Player").GetComponent <LayBombs>();
     pickupSpawner = GameObject.Find("pickupManager").GetComponent <PickupSpawner>();
 }
コード例 #20
0
    void Start () {
       scoreBoard = FindObjectOfType<ScoreBoard>();
        PickupSpawner pickupSpawner = FindObjectOfType<PickupSpawner>();
        enemyDeathListener = pickupSpawner;
		
	}
コード例 #21
0
 void Start()
 {
     spawner      = GameObject.FindGameObjectWithTag("Spawner").GetComponent <PickupSpawner>();
     totalPickups = spawner.numberOfPickups;
     ShowPickupsText();
 }
コード例 #22
0
ファイル: HealthPickup.cs プロジェクト: benbon/qjsbunitynew
	private bool landed;					// Whether or not the crate has landed.


	void Awake ()
	{
		// Setting up the references.
		pickupSpawner = GameObject.Find("pickupManager").GetComponent<PickupSpawner>();
		anim = transform.root.GetComponent<Animator>();
	}
コード例 #23
0
ファイル: Bomb.cs プロジェクト: swwoosh/unity-class
    private ParticleSystem explosionFX;         // Reference to the particle system of the explosion effect.


    void Awake()
    {
        // Setting up references.
        explosionFX   = GameObject.FindGameObjectWithTag("ExplosionFX").GetComponent <ParticleSystem>();
        pickupSpawner = GameObject.Find("pickupManager").GetComponent <PickupSpawner>();
    }
コード例 #24
0
    private bool landed = false;            // Whether or not the crate has landed yet.


    void Awake()
    {
        // Setting up the reference.
        pickupSpawner = GameObject.Find("PickupSpawner").GetComponent <PickupSpawner>();
        anim          = transform.root.GetComponent <Animator>();
    }
コード例 #25
0
 public void Initialize(PickupSpawner spawner)
 {
     this.spawner = spawner;
 }