示例#1
0
 //On start up
 void Awake()
 {
     animator              = transform.Find("Sprite").GetComponent <Animator> ();
     rb2d                  = GetComponent <Rigidbody2D> ();
     shotSpawn             = GetComponentInChildren <ShotSpawn> ();
     shotSpawn.player      = gameObject;
     isoSorting            = transform.Find("Sprite").GetComponent <IsoDynamicObject> ();
     sprite                = transform.Find("Sprite").GetComponent <SpriteRenderer> ();
     playerName            = SessionInfo.GetInstance().GetSessionOwner();
     attackTrigger.enabled = false;
 }
示例#2
0
    void Start()
    {
        //NEW CODE HERE
        GameObject shieldControllerObject   = GameObject.FindWithTag("ShieldController");
        GameObject playerHealthObject       = GameObject.FindWithTag("Health");
        GameObject gameControllerObject     = GameObject.FindWithTag("GameController");
        GameObject shotSpawnObject          = GameObject.FindWithTag("ShotSpawn");
        GameObject camShakeControllerObject =
            GameObject.FindWithTag("MainCamera");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <GameController>();
            camShake       =
                camShakeControllerObject.GetComponent <cameraShake>();
        }
        if (playerHealthObject != null)
        {
            playerHealth = playerHealthObject.GetComponent <PlayerHealth>();
        }
        if (shieldControllerObject != null)
        {
            shieldController = shieldControllerObject.GetComponent <ShieldController>();
        }
        if (shotSpawnObject != null)
        {
            shotSpawnController = shotSpawnObject.GetComponent <ShotSpawn>();
        }


        fileName = "shoot";
        file     = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt");
        //LoadShot();
        if (PlayerPrefs.HasKey("Shot"))
        {
            loadedFireType = PlayerPrefs.GetInt("Shot");
        }
        else
        {
            loadedFireType = 1;
        }


        fireType  = loadedFireType;
        rigidBody = gameObject.GetComponent <Rigidbody2D>();
    }
示例#3
0
    void Start()
    {
        //NEW CODE HERE
        GameObject shieldControllerObject = GameObject.FindWithTag("ShieldController");
        GameObject playerHealthObject = GameObject.FindWithTag("Health");
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        GameObject shotSpawnObject = GameObject.FindWithTag("ShotSpawn");
        GameObject camShakeControllerObject =
          GameObject.FindWithTag("MainCamera");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent<GameController>();
            camShake =
              camShakeControllerObject.GetComponent<cameraShake>();
        }
        if (playerHealthObject!=null)
        {
            playerHealth = playerHealthObject.GetComponent<PlayerHealth>();
        }
        if (shieldControllerObject != null)
        {
            shieldController = shieldControllerObject.GetComponent<ShieldController>();
        }
        if (shotSpawnObject != null)
        {
            shotSpawnController = shotSpawnObject.GetComponent<ShotSpawn>();
        }

        fileName = "shoot";
        file = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt");
        //LoadShot();
        if (PlayerPrefs.HasKey("Shot"))
        {
            loadedFireType = PlayerPrefs.GetInt("Shot");
        }
        else
        {
            loadedFireType = 1;
        }

        fireType = loadedFireType;
        rigidBody = gameObject.GetComponent<Rigidbody2D>();
    }