Inheritance: NetworkBehaviour
Esempio n. 1
0
    public static void LoadSave()
    {
        //print("loading");
        // string filePath = Application.persistentDataPath + gameDataPath;

        /*
         * if (File.Exists(filePath)) {
         *  print("found game");
         *  //Save save = JsonUtility.FromJson<Save>(File.ReadAllText(filePath));
         *  InventoryScript.ReadFromSave(save);
         *  ItemLoadScript.ReadFromSave(save);
         *  EnemyPosScript.ReadFromSave(save);
         *  SceneManager.LoadScene(save.savedScene);
         * }
         * else {
         *  StartGame();
         * }*/
        if (officialState == null)
        {
            StartGame();
        }
        else
        {
            InventoryScript.ReadFromSave(officialState);
            ItemLoadScript.ReadFromSave(officialState);
            EnemyPosScript.ReadFromSave(officialState);
            SceneManager.LoadScene(officialState.savedScene);
        }
    }
Esempio n. 2
0
    void moveToPanel(int spaceIndex)
    {
        //print(getStorageList().GetChild(0).childCount);
        if (getStorageList().GetChild(spaceIndex).childCount == 1)
        {
            if (spaceIndex == invPosition)
            {
                transform.localPosition = Vector3.zero;
            }
            else
            {
                Transform temp = transform.parent;
                transform.SetParent(getStorageList().GetChild(spaceIndex));
                getStorageList().GetChild(spaceIndex).GetChild(0).SetParent(temp);
                transform.localPosition = Vector3.zero;
                getStorageList().GetChild(invPosition).GetChild(0).localPosition = Vector3.zero;
                getStorageList().GetChild(invPosition).GetChild(0).GetComponent <WeaponScript>().changeInvPosition(invPosition);
                //ADD WEAPON AND ARMOR TOGETHER

                invPosition = spaceIndex;
            }
        }
        else
        {
            InventoryScript.setOccupied(invPosition, false);
            InventoryScript.setOccupied(spaceIndex, true);
            transform.SetParent(getStorageList().GetChild(spaceIndex));
            transform.localPosition = Vector3.zero;
            invPosition             = spaceIndex;
        }
    }
Esempio n. 3
0
 // Start is called before the first frame update
 void Start()
 {
     move_script      = GetComponent <movePlayer>();
     combat_script    = GetComponent <CombatScript>();
     inventory_script = GetComponent <InventoryScript>();
     grab_script      = GetComponent <GrabScript>();
 }
Esempio n. 4
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.collider.CompareTag("Monster"))
        {
            //Play the sfx immediately/.
            audioSource.clip = sfx;
            audioSource.Play();

            //Do the effect.
            //Get inventory
            inventory = GameObject.Find("Inventory").GetComponent <InventoryScript>();

            //Select random element
            int index = Random.Range(0, 4);


            //Reduce random item by one
            inventory.ChangeItemValue(IndexToItem(index), -1);

            //Spawn an indicator
            GameObject indicator = Instantiate(Resources.Load("Prefabs/HitIndicator"), position, Quaternion.identity, GameObject.Find("Canvas").transform) as GameObject;
            indicator.GetComponent <DamageDisplayText>().value    = "-1";
            indicator.GetComponent <DamageDisplayText>().affinity = ItemToAffinity(IndexToItem(index));
            indicator.GetComponent <DamageDisplayText>().StartCoroutine(
                indicator.GetComponent <DamageDisplayText>().BeginFade());
        }
    }
Esempio n. 5
0
    void Start()
    {
        turn      = FindTurn();
        invScript = InventoryScript.Instance; //loadInfo.GetComponent<InventoryScript>();

        /*DisplayText("it is <color=cyan>" + turn.name + "</color>'s turn");
         * if (turn.tag == "Player")
         * {
         *  inputState = InputState.Category;
         *  DisplayText("Choose an attack!");
         * }
         * else
         * {
         *  inputState = InputState.Wait;
         * }*/

        //inputField.onEndEdit.AddListener(ProcessPlayerText);

        /*UpdateStatsText();
         * if (TurnEnded != null)
         * {
         *  Debug.Log("Turn ended");
         *  TurnEnded();
         * }*/
        UpdateInputArea();

        NextTurn();
    }
    public void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(this);
            return;
        }
        else
        {
            DontDestroyOnLoad(this);
            Instance = this;
        }

        foreach (Item item in Resources.LoadAll <Item>("Item Prefabs"))
        {
            Database.Add(item.name, item);
            Debug.Log(item.name);
        }

        if (!inventory.ContainsKey(currency))
        {
            ModifyInventory(0, currency);
        }

        /*ModifyInventory("BodyFluid", 3);
         * ModifyInventory("BrainFluid", 3);
         * ModifyInventory("SoulFluid", 3);
         * ModifyInventory("LifeJuice", 3);
         * ModifyInventory("Rock", 3);
         * ModifyInventory("DebugKill", 10);*/
    }
Esempio n. 7
0
 void OnMouseDrag()
 {
     transform.localPosition = new Vector3(Input.mousePosition.x / InventoryScript.getRatios().x, Input.mousePosition.y / InventoryScript.getRatios().y, 0) -
                               new Vector3(inventoryScreen.GetComponent <RectTransform>().rect.width / (2 * InventoryScript.getRatios().x),
                                           inventoryScreen.GetComponent <RectTransform>().rect.height / (2 * InventoryScript.getRatios().y), 0) -
                               transform.parent.position;
 }
Esempio n. 8
0
	// Use this for initialization
	void Start () {

		// REFERENCE GAMEOBJECTS
		this.character = GameObject.FindGameObjectWithTag("Player");
		this.skeleton = GameObject.FindGameObjectWithTag("Skeleton");
		this.skeleton1 = GameObject.FindGameObjectsWithTag("Skeleton1");
		this.skeleton2 = GameObject.FindGameObjectsWithTag("Skeleton2");
		this.skeleton3 = GameObject.FindGameObjectsWithTag("Skeleton3");
		this.skeleton5 = GameObject.FindGameObjectsWithTag("Skeleton5");
		this.miniicedemon7 = GameObject.FindGameObjectsWithTag("MiniIceDemon7");
		this.miniicedemon8 = GameObject.FindGameObjectsWithTag("MiniIceDemon8");

		this.firedemon4 = GameObject.FindGameObjectWithTag("FireDemon4");
		this.icedemon6 = GameObject.FindGameObjectWithTag("IceDemon6");
		this.boss = GameObject.FindGameObjectWithTag("Boss");

		this.chest = GameObject.FindGameObjectsWithTag("Chest");

		this.inventory = character.GetComponentInChildren <InventoryScript> ();

		// LOAD TEXTURES
		this.playerIcon = Resources.Load<Texture2D>("MiniMap/character_v2");
		this.enemyIcon = Resources.Load<Texture2D>("MiniMap/enemy");
		this.bossIcon = Resources.Load<Texture2D>("MiniMap/boss");
		this.chestIcon = Resources.Load<Texture2D>("MiniMap/chest");
		this.openChestIcon = Resources.Load<Texture2D>("MiniMap/chest_open");
	}
Esempio n. 9
0
    //On ground pos = -6.14f
    //On top position = -1.353f

    // Use this for initialization
    void Start()
    {
        trapRoof       = GameObject.FindWithTag("TrapRoof");
        invScript      = GameObject.Find("KeyInventory").GetComponent <InventoryScript>();
        roofSound      = GetComponent <AudioSource>();
        roofSound.clip = collapseSound;
    }
    // Use this for initialization
    void Start()
    {
        inventory = GameObject.Find("KeyInventory");
        itemScript = inventory.GetComponent<InventoryScript>();

        canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
    }
Esempio n. 11
0
 private void OnEnable()
 {
     dragging       = false;
     Cursor.visible = true;
     key1.SetActive(InventoryScript.ContainsItem(0));
     key2.SetActive(InventoryScript.ContainsItem(1));
 }
Esempio n. 12
0
 void Start()
 {
     background = transform.GetChild (0);
     sprite = transform.GetChild (1).GetComponent<UnityEngine.UI.Image> ();
     inventory_ui = transform.parent.parent.parent.GetComponent<InventoryScript> ();
     data = null;
 }
Esempio n. 13
0
 // Use this for initialization
 void Start()
 {
     m_instance      = this;
     controller      = GameObject.Find("FPSController").GetComponent <FirstPersonController> ();
     inventoryCanvas = GameObject.Find("MenuBackboard");
     inventoryCanvas.SetActive(false);
 }
Esempio n. 14
0
	void Start(){
		
		this.character = GameObject.FindGameObjectWithTag ("Player");
		this.cs = this.character.GetComponent<CharacterScript> ();
		inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<InventoryScript> ();

	}
Esempio n. 15
0
 /// <summary>
 /// Function called at the creation of the player UI to let the script know which player it is for.
 /// </summary>
 /// <param name="player"></param>
 public void SetPlayerTarget(GameObject player)
 {
     this.player        = player;
     playerInventory    = this.player.GetComponentInChildren <InventoryScript>();
     playerManager      = this.player.GetComponentInChildren <PlayerManager>();
     inventorySlotNames = playerInventory.GetAllInventorySlotNames();
 }
Esempio n. 16
0
	// Use this for initialization
	void Awake () {
		//print (PlayerPrefs.GetString("Difficult"));
		// --- LOAD RESOURCES TO CHARACTER ---
		//this.prefab = Resources.Load<GameObject>("Prefabs/MainCharacters/Level02/hombre_lvl2");
		this.prefab = Resources.Load<GameObject>("Prefabs/MainCharacters/Level02/"+PlayerPrefs.GetString("Player")+"_lvl2");
		this.character = Instantiate (prefab, respawn.transform.position, prefab.transform.rotation) as GameObject;
		this.cs = this.character.GetComponent<CharacterScript> ();
		this.cm = this.character.GetComponent<ClickToMove_lvl2> ();

		this.invent = this.character.GetComponentInChildren <InventoryScript> ();
		this.map = GameObject.FindGameObjectWithTag ("Minimap").GetComponent<miniMapLv2> ();
		this.music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> ();

		// Memory Card Save/Load data
		this.mc = GameObject.FindGameObjectWithTag ("MemoryCard").GetComponent<MemoryCard> ();
		this.save = this.mc.saveData();
		this.load = this.mc.loadData();
		time_play = this.load.loadTimePlayed ();


		// --- LOAD RESOURCES TO MENU ---
		gui = new PauseMenuGUI();
		gui.initResources ();
		
		
		this.c = this.ambientLight.light.color;

	}
Esempio n. 17
0
    void OnCollisionEnter2D(Collision2D collison)
    {
        movePlayer move_script = collison.otherCollider.gameObject.GetComponent <movePlayer>();

        if (collison.gameObject.tag.Contains("Player"))
        {
            InventoryScript inventory = collison.gameObject.GetComponent <InventoryScript>();
            if (inventory != null)
            {
                SoundEffectScript.Instance.playUpgradeSound(gameObject.transform.position);
                inventory.addPuntigamerCount(1);

                // spwan puntigamer icon
                Vector3    position = collison.gameObject.transform.position + new Vector3(0.0f, 3.0f, 0.0f);
                GameObject icon     = Instantiate(puntigamer_sprite, position, Quaternion.identity);
                icon.transform.SetParent(collison.gameObject.transform);

                ParticleEffectsScript.Instance.speedBoostEffect(position, collison.gameObject, 1.0f);

                Destroy(gameObject);
            }
        }
        else
        {
            if (collison.relativeVelocity.magnitude > max_impact)
            {
                SoundEffectScript.Instance.playBreakingGlass(gameObject.transform.position);
                Collider2D collider = gameObject.GetComponent <Collider2D>();
                Vector3    offset   = new Vector3(0.0f, collider.bounds.max.y * 0.5f, 0.0f);
                ParticleEffectsScript.Instance.beerExplosion(transform.position + offset);
                Destroy(gameObject);
            }
        }
    }
Esempio n. 18
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        InventoryScript       playerInventory = collider.gameObject.GetComponent <InventoryScript> ();
        AnimationController2D animator        = door.GetComponent <AnimationController2D> ();

        if (playerInventory != null && door != null)
        {
            foreach (string keycard in playerInventory.inventory)
            {
                if (keycard.Equals(KeyToOpen))
                {
                    rend.color = Green;
                    if (animator != null)
                    {
                        animator.setAnimation("door open");
                    }
                    if (DoorOpen != null)
                    {
                        if (!played)
                        {
                            DoorOpen.Play();
                            played = true;
                        }
                    }
                    door.layer = LayerMask.NameToLayer("Default");
                }
            }
        }
    }
Esempio n. 19
0
 void Start()
 {
     shopInventoryItems = GameObject.FindGameObjectWithTag("ShopInv").GetComponent <InventoryScript>();
     userInventoryItems = GameObject.FindGameObjectWithTag("UserInv").GetComponent <InventoryScript>();
     shopTradeItems     = GameObject.FindGameObjectWithTag("ShopTrade").GetComponent <TradeScript>();
     userTradeItems     = GameObject.FindGameObjectWithTag("UserTrade").GetComponent <TradeScript>();
 }
Esempio n. 20
0
 public void RemoveItems(InventoryScript shopList)
 {
     for (int i = shopList.itemList.Count - 1; i >= 0; i--)
     {
         shopList.itemList.RemoveAt(i);
     }
 }
Esempio n. 21
0
    // Use this for initialization
    void Start()
    {
        inventory  = GameObject.Find("KeyInventory");
        itemScript = inventory.GetComponent <InventoryScript>();

        canvas = GameObject.Find("Canvas").GetComponent <Canvas>();
    }
 //On ground pos = -6.14f
 //On top position = -1.353f
 // Use this for initialization
 void Start()
 {
     trapRoof = GameObject.FindWithTag("TrapRoof");
     invScript = GameObject.Find("KeyInventory").GetComponent<InventoryScript>();
     roofSound = GetComponent<AudioSource>();
     roofSound.clip = collapseSound;
 }
Esempio n. 23
0
    // Update is called once per frame
    void Update()
    {
        GameObject inventory = GameObject.FindGameObjectWithTag("Inventory");

        if (inventory != null)
        {
            InventoryScript script = inventory.GetComponent <InventoryScript>();

            int slotCounter = 0;

            foreach (GunParameters gp in script.GetWeaponsInInventory())
            {
                slotCounter += 1;

                if (slotCounter == 1)
                {
                    if (gp != null)
                    {
                        slot1.gunParams = gp;
                    }
                }
                else if (slotCounter == 2)
                {
                    if (gp != null)
                    {
                        slot2.gunParams = gp;
                    }
                }
            }
        }
    }
Esempio n. 24
0
    private bool loaded;            //if the scene is loading - make it true so wont load again

    // Use this for initialization
    void Start()
    {
        Time.timeScale  = 1;
        savePlayerStats = GameObject.Find("SavePlayerStats");
        dialogueManager = GameObject.Find("Dialogue Manager");
        InventoryScript.ClearInventory();
        if (savePlayerStats != null)
        {
            Destroy(savePlayerStats);
        }
        if (dialogueManager != null)
        {
            Destroy(dialogueManager);
        }
        Cursor.visible   = true;
        Cursor.lockState = CursorLockMode.None;

        if (File.Exists(Application.dataPath + "/SaveGame.dat"))
        {
            loadCahapterButton.GetComponent <Button> ().interactable = true;
        }
        else
        {
            loadCahapterButton.GetComponent <Button> ().interactable = false;
        }
        if (File.Exists(Application.dataPath + "/SaveGameAtSavePoint.dat"))
        {
            loadSavePointButton.GetComponent <Button> ().interactable = true;
        }
        else
        {
            loadSavePointButton.GetComponent <Button> ().interactable = false;
        }
        StartCoroutine(ChangeEventSystem());
    }
Esempio n. 25
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Esempio n. 26
0
 //RELEASE
 void OnMouseUp()
 {
     nowDragging = false;
     if (hit)
     {
         if (hitInfo.transform.tag == "Space")// && InventoryScript.)
         {
             moveToPanel(getPanelObject(hitInfo.transform.name));
         }
         else if (hitInfo.transform.tag == "Weapon")
         {
             transform.SetParent(transform.parent.parent.parent.GetChild(1).GetChild(0));
             transform.localPosition = Vector3.zero;
             transform.localScale    = 2 * transform.localScale;
             invPosition             = 20;
             InventoryScript.setEquippedWeapon(hitInfo.transform.name);
         }
         else if (hitInfo.transform.tag == "Disenchant")
         {
         }
         else
         {
             transform.localPosition = Vector3.zero;
         }
     }
     else
     {
         transform.localPosition = Vector3.zero;
     }
 }
Esempio n. 27
0
 public void Setup(ItemScript currentItem, InventoryScript currentScrollList)
 {
     item            = currentItem;
     nameLabel.text  = item.itemName;
     amountText.text = "x" + item.amount.ToString();
     scrollList      = currentScrollList;
 }
Esempio n. 28
0
 public void instantiator()
 {
     if (InventoryScript.isSpaceAvailable())
     {
         createWeapon();
     }
     returnToInventory();
 }
 // Use this for initialization
 void Start()
 {
     pillarWalls = GameObject.FindGameObjectsWithTag("PillarWall");
     pillars = GameObject.FindGameObjectsWithTag("Pillars");
     invScript = GameObject.Find("KeyInventory").GetComponent<InventoryScript>();
     roomAudio = GetComponent<AudioSource>();
     roomAudio.clip = roomSound;
 }
Esempio n. 30
0
 // Use this for initialization
 void Start()
 {
     pillarWalls    = GameObject.FindGameObjectsWithTag("PillarWall");
     pillars        = GameObject.FindGameObjectsWithTag("Pillars");
     invScript      = GameObject.Find("KeyInventory").GetComponent <InventoryScript>();
     roomAudio      = GetComponent <AudioSource>();
     roomAudio.clip = roomSound;
 }
 private void Start()
 {
     targetPoint = this.transform.position;
     RB          = this.GetComponent <Rigidbody2D>();
     SM          = GameObject.FindGameObjectWithTag("StatManager").GetComponent <StatManager>();
     IS          = InventoryScript.Instance;
     WS          = GameObject.FindGameObjectWithTag("World").GetComponent <WorldSelector>();
 }
 // Use this for initialization
 void Start()
 {
     defaultRot = transform.eulerAngles;
     openRot    = new Vector3(defaultRot.x, defaultRot.y + DoorOpenAngle, defaultRot.z);
     canvas     = GameObject.Find("Canvas").GetComponent <Canvas>();
     inventory  = GameObject.Find("KeyInventory");
     itemScript = inventory.GetComponent <InventoryScript>();
 }
 // Use this for initialization
 void Start()
 {
     defaultRot = transform.eulerAngles;
     openRot = new Vector3(defaultRot.x, defaultRot.y + DoorOpenAngle, defaultRot.z);
     canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
     inventory = GameObject.Find("KeyInventory");
     itemScript = inventory.GetComponent<InventoryScript>();
 }
Esempio n. 34
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null){
         DontDestroyOnLoad(gameObject);
         instance = this;
     } else if (instance != this){
         Destroy(gameObject);
     }
 }
    public void Initialize(Phone phone)
    {
        shop.gameObject.SetActive(false);
        phoneComponentList = new List <PhonePart>();
        FillComponentList(phone);
        shop.Initialize(phone);

        _inventory = FindObjectOfType <InventoryScript>();
    }
Esempio n. 36
0
 // Token: 0x06000229 RID: 553 RVA: 0x0002EB04 File Offset: 0x0002CF04
 private void Update()
 {
     if (this.Prompt.Circle[0].fillAmount == 0f)
     {
         InventoryScript inventory = this.Prompt.Yandere.Inventory;
         inventory.DirectionalMic = true;
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
Esempio n. 37
0
 // Use this for initialization
 void Start()
 {
     inventory = GetComponent <InventoryScript>();
     inventory.AddItem(ItemType.StrategyCard_Offense, 1);
     inventory.AddItem(ItemType.StrategyCard_Defense, 1);
     inventory.AddItem(ItemType.StrategyCard_Flank, 1);
     inventory.AddItem(ItemType.StrategyCard_Inflitrate, 1);
     inventory.AddItem(ItemType.StrategyCard_Suppress, 1);
 }
Esempio n. 38
0
    // Use this for initialization
    public NPCReport()
    {
        NPC_augments = new InventoryScript();

        if (data == null)
        {
            data = new NPCDataPoints();
        }
    }
Esempio n. 39
0
    public static Save CreateSaveGameObject()
    {
        Save save = new Save();

        InventoryScript.PopulateSave(save);
        ItemLoadScript.PopulateSave(save);
        EnemyPosScript.PopulateSave(save);
        return(save);
    }
Esempio n. 40
0
 void Start()
 {
     gunShoot = GetComponent<GunShootingScript>();
     gunPos = GetComponent<GunPositionScript>();
     player = GameObject.FindWithTag("Player");
     inventoryHandler = player.GetComponent<InventoryScript>();
     ammo = magAmmo;
     extraAmmo = maxMags * magAmmo;
     boxCollider = GetComponentInChildren<BoxCollider>().gameObject;
     gameObject.tag = "Weapon";
 }
Esempio n. 41
0
	// LOAD TEXTURE RESOURCES
	public void initResources () {

		this.level = PlayerPrefs.GetInt ("Level");
		// Memory Card Save/Load data
		this.mc = GameObject.FindGameObjectWithTag ("MemoryCard").GetComponent<MemoryCard> ();
		this.save = this.mc.saveData ();

		this.invent = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <InventoryScript> ();
		this.map = GameObject.FindGameObjectWithTag ("Minimap").GetComponent<miniMapLv1> ();
		this.map2 = GameObject.FindGameObjectWithTag ("Minimap").GetComponent<miniMapLv2> ();

		this.shadow = GameObject.FindGameObjectWithTag("Light");
		this.audio = GameObject.FindGameObjectWithTag("Audio");

		// MENU PAUSE
		this.backgroundTexture = Resources.Load<Texture2D>("PauseMenu/background_pause");
		
		this.continueTexture = Resources.Load<Texture2D>("PauseMenu/continue");
		this.hoverContinueTexture = Resources.Load<Texture2D>("PauseMenu/hover_continue");
		
		this.resetTexture = Resources.Load<Texture2D>("PauseMenu/reset");
		this.hoverResetTexture = Resources.Load<Texture2D>("PauseMenu/hover_reset");

		this.controlTexture = Resources.Load<Texture2D>("PauseMenu/controls");
		this.hoverControlTexture = Resources.Load<Texture2D>("PauseMenu/hover_controls");

		this.optionTexture = Resources.Load<Texture2D>("PauseMenu/option");
		this.hoverOptionTexture = Resources.Load<Texture2D>("PauseMenu/hover_option");
		
		this.exitTexture = Resources.Load<Texture2D>("PauseMenu/exit");
		this.hoverExitTexture = Resources.Load<Texture2D>("PauseMenu/hover_exit");

		// MENU KEYWORD
		this.keywordTexture = Resources.Load<Texture2D>("PauseMenu/keyword");

		// MENU CONFIRM
		this.confirmTexture = Resources.Load<Texture2D>("PauseMenu/background_confirm");

		// MENU OPTION
		this.backgroundOptionTexture = Resources.Load<Texture2D>("PauseMenu/background_opciones");
		this.checkTexture = Resources.Load<Texture2D>("PauseMenu/checked_checkbox");
		this.unCheckTexture = Resources.Load<Texture2D>("PauseMenu/unchecked_checkbox");

		this.yesTexture = Resources.Load<Texture2D>("PauseMenu/yes");
		this.hoverYesTexture = Resources.Load<Texture2D>("PauseMenu/hover_yes");
		
		this.noTexture = Resources.Load<Texture2D>("PauseMenu/no");
		this.hoverNoTexture = Resources.Load<Texture2D>("PauseMenu/hover_no");
		
		this.music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> ();
		
	}
Esempio n. 42
0
    // Use this for initialization
    void Start()
    {
        _hud = GameObject.Find("HUDMessage").GetComponent<HUDMessageScript>();
        _player = GameObject.Find("Rotator");
        _planet = GameObject.Find("Planet");
        _shipSpawner = _planet.GetComponent<EnemySpawnerScript>();
        _playerMovementScript = GameObject.FindWithTag("Player").GetComponent<PlayerMovement>();
        _playerInv = GameObject.FindWithTag("Player").GetComponent<InventoryScript>();
        _item = transform.GetChild(0);
        _finalDist = _planet.transform.localScale.x/2f; //raio do planeta

        transform.forward = (_planet.transform.position - transform.position).normalized;
        //transform.rotation = Quaternion.LookRotation((_player.transform.position - transform.position));

        StartCoroutine(RunAnimation());
    }
Esempio n. 43
0
	// Use this for initialization
	void Start () {

		// REFERENCE GAMEOBJECTS
		this.character = GameObject.FindGameObjectWithTag("Player");
		this.inventory = character.GetComponentInChildren <InventoryScript> ();
		this.enemies = GameObject.FindGameObjectsWithTag("Enemy");
		this.boss = GameObject.FindGameObjectWithTag("Boss");
		this.chest = GameObject.FindGameObjectsWithTag("Chest");

		// LOAD TEXTURES
		this.playerIcon = Resources.Load<Texture2D>("MiniMap/character_v2");
		this.enemyIcon = Resources.Load<Texture2D>("MiniMap/enemy");
		this.bossIcon = Resources.Load<Texture2D>("MiniMap/boss");
		this.chestIcon = Resources.Load<Texture2D>("MiniMap/chest");
		this.openChestIcon = Resources.Load<Texture2D>("MiniMap/chest_open");

		mapVisible = false;
	}
Esempio n. 44
0
    public void updateWeaponTexture(InventoryScript.WEAPON currentWeapon)
    {
        int index = (int)currentWeapon;
        Sprite weaponSprite = weaponSprites[index];
        if (weaponSprite == null)
            return;
        if (currentWeapon == InventoryScript.WEAPON.noWeapon)
        {
            imageScript.changeColorAlpha(0.0f);
            imageScript.changeColorAlphaBackground(0.0f);
        }
        else
        {
            imageScript.changeColorAlpha(1.0f);
            imageScript.changeColorAlphaBackground(1.0f);
        }
        imageScript.updateSprite(weaponSprite);

        uiweapon = currentWeapon;
    }
Esempio n. 45
0
	//Initialize the weapon cooldown arrays and find the players
	void Start () {


	    swingTime[0] = 1.0f;
	    swingTime[1] = 2.0f;
        swingTime[2] = 1.5f;

        killTime[0] = 3.0f;
        killTime[1] = 5.0f;
        killTime[2] = 4.0f;

        weaponRange[0] = 3.0f;
        weaponRange[1] = 4.0f;
        weaponRange[2] = 3.5f;

        GetListOfPlayers();

        m_playerInventory = gameObject.GetComponent<InventoryScript>();
        m_playerTools = gameObject.GetComponent<ToolScript>();
    }
Esempio n. 46
0
	// Use this for initialization
	void Start () {

		this.character = GameObject.FindGameObjectWithTag ("Player");
		this.cs = this.character.GetComponent<CharacterScript> ();
		this.cm = this.character.GetComponent<ClickToMove> ();
		//this.cm2 = this.character.GetComponent<ClickToMove_lvl2> ();

		// ADD TEXTURES
		this.actionBarTexture = Resources.Load<Texture2D>("ActionBar/actionbar");

		this.fireballTexture = Resources.Load<Texture2D>("ActionBar/skill_fireball");
		this.reloadFireballTexture = Resources.Load<Texture2D>("ActionBar/reload_fireball");
		this.PowerKnifeTexture = Resources.Load<Texture2D>("ActionBar/skill_powerKnife");
		this.reloadPowerKnifeTexture = Resources.Load<Texture2D>("ActionBar/reload_powerKnife");
		this.DarkAuraTexture = Resources.Load<Texture2D>("ActionBar/skill_aura");
		this.reloadDarkAuraTexture = Resources.Load<Texture2D>("ActionBar/reload_aura");

		this.attackIconTexture = Resources.Load<Texture2D>("ActionBar/icon_attack_v2");
		this.runIconTexture = Resources.Load<Texture2D>("ActionBar/icon_run");
		this.potionIconTexture = Resources.Load<Texture2D>("ActionBar/icon_elixir_v2");
		this.inventoryIconTexture = Resources.Load<Texture2D>("ActionBar/icon_inventory_v2");
		this.mapIconTexture = Resources.Load<Texture2D>("ActionBar/icon_map");

		//Debug.Log (this.actionBarTexture.name);

		inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<InventoryScript> ();

		//this.cs = GameObject.FindGameObjectWithTag ("Player").GetComponent<CharacterScript> ();

		this.text_style = new GUIStyle ();
		this.text_style.normal.textColor = Color.red;
		this.text_style.fontSize = 15;
		this.text_style.alignment = TextAnchor.UpperCenter ; 
		this.text_style.wordWrap = true; 

		disabledSkill1 = false;
		disabledSkill2 = false;
		disabledSkill3 = false;


	}
Esempio n. 47
0
	// Use this for initialization
	void Awake () {
		
		// --- LOAD RESOURCES TO CHARACTER ---
		this.prefab = Resources.Load<Transform>("Prefabs/MainCharacters/" + PlayerPrefs.GetString("Player"));
		Instantiate (prefab);
		this.character = GameObject.FindGameObjectWithTag ("Player");
		this.invent = this.character.GetComponentInChildren <InventoryScript> ();
		this.map = GameObject.FindGameObjectWithTag ("Minimap").GetComponent<miniMapLv1> ();
		this.cm = this.character.GetComponent<ClickToMove> ();
		this.cs = this.character.GetComponent<CharacterScript> ();

		// Memory Card Save/Load data
		this.mc = GameObject.FindGameObjectWithTag ("MemoryCard").GetComponent<MemoryCard> ();
		this.save = this.mc.saveData();
		this.load = this.mc.loadData();
		time_play = this.load.loadTimePlayed (); 

		this.npc_boss = GameObject.FindGameObjectWithTag("Boss");
		this.npc_enemy = GameObject.FindGameObjectsWithTag("Enemy");

		this.camera1 = GameObject.FindGameObjectWithTag ("MainCamera");
		this.camera1.SetActive (true);
		
		this.camera2 = GameObject.FindGameObjectWithTag ("CameraGoal");
		this.camera2.SetActive (false);

		this.music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> ();

		// --- LOAD RESOURCES TO MENU ---
		gui = new PauseMenuGUI ();
		gui.initResources ();
		
		
		this.c = this.ambientLight.light.color;
		pause = false;

	}
 // Use this for initialization
 void Start()
 {
     transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
     eventManager = GameObject.FindGameObjectWithTag("EventManager").GetComponent<EventManagerScript>();
     input = GameObject.Find ("EventManager").GetComponent<InputManagerScript>();
     inventory = GameObject.Find ("EventManager").GetComponent<InventoryScript>();
     currentPosition = start.GetComponent<ItemPositionScript>();
     positions = new ItemPositionScript[transform.childCount];
     for(int i = 0; i < transform.childCount; i++){
         positions[i] = transform.GetChild (i).GetComponent<ItemPositionScript>();
     }
 }
Esempio n. 49
0
 // Use this for initialization
 void Start()
 {
     m_instance = this;
     controller = GameObject.Find ("FPSController").GetComponent<FirstPersonController> ();
     inventoryCanvas = GameObject.Find ("MenuBackboard");
     inventoryCanvas.SetActive (false);
 }
 // Use this for initialization
 void Start()
 {
     inventory = GameObject.Find("KeyInventory").GetComponent<InventoryScript>();
 }
Esempio n. 51
0
 void Start()
 {
     inventory = gameObject.GetComponent<InventoryScript>();
     input = gameObject.GetComponent<KartInput>();
 }
    //AudioConversationScript acsManager = GameObject.FindGameObjectWithTag("AudioConversationManager").GetComponent<AudioConversationScript>();
    // Use this for initialization
    void Start()
    {
        /*currentConv = new Conversation();
        currentConv.currentText = "thisisawholelotofreallylongtextbuddyiknowitsgonnagotothenextlineisupertotallybetcha"; // Still greatest line of code in the game.
        currentConv.options = new string[5];
        currentConv.options[0] = "first";
        currentConv.options[1] = "secondy";
        currentConv.options[2] = "third";
        currentConv.options[3] = "fourth";
        currentConv.options[4] = "fifth";
        numResponses = 5;
        currentConv.currentInteractionType = "respond";
        minResponse = 0;
        maxResponse = 4;*/

        audioManager = GameObject.FindGameObjectWithTag ("AudioManager").GetComponent<AudioManagerScript>();;

        eventManager = GetComponent<EventManagerScript>();
        inventory = GetComponent<InventoryScript>();
        barter = GetComponent<BarterScript>();

        TextAsset[] files = Resources.LoadAll<TextAsset> ("Conversations");
        for(int i = 0; i < files.Length; i++){
            Conversation temp = ParseConversationFile(files[i]);
            if(temp.name != null){
                conversations[temp.name] = temp;
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     slides = GetComponent<SlidesScript>();
     slides.starting = false;
     familyManager = GameObject.FindGameObjectWithTag("FamilyManager").GetComponent<FamilyManagerScript>();
     itemPosManager = GameObject.FindGameObjectWithTag("ItemPositions").GetComponent<ItemPositionManagerScript>();
     transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
     walkHome = GameObject.FindGameObjectWithTag("WalkHome").GetComponent<SideScrollWalkScript>();;
     audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManagerScript>();
     baking = GetComponent<BakingScript>();
     finances = GetComponent<FinancesScript>();
     customerManager = GetComponent<CustomerManagerScript>();
     conversationManager = GetComponent<ConversationManagerScript>();
     inventory = GetComponent<InventoryScript>();
     input = GetComponent<InputManagerScript>();
     phase = "setup";
     dailyTransactions = new Transaction[customersToday];
 }
Esempio n. 54
0
 void Awake()
 {
     instance = this;
     slots = GetComponentsInChildren<InventorySlotScript>();
 }
Esempio n. 55
0
    // Use this for initialization
    void Start()
    {
        click = null;
        //gold.text = "100";
        mCamera = mainCamera.GetComponent<Camera>();
        itemDescriptionPanel = GameObject.Find("ButtonDescriptionPanel");
        itemDescriptionText = GameObject.Find("ButtonDescriptionText").GetComponent<Text>();
        damageText = GameObject.Find("DamageText").GetComponent<Text>();
        inventory = GameObject.Find("InventoryPanel").GetComponent<InventoryScript>();
        gold = GameObject.Find("GoldText").GetComponent<Text>();
        baseHealth = GameObject.Find("BaseHealthText").GetComponent<Text>();
        DeactivateInfo();

        click = GameObject.Find("NinjaContainer").GetComponent<WarriorAnimation>();
        click.SetSelectedCircle(true);
        healthText.text = (int)click.getCurrentHealth() + "/" + (int)click.getMaxHealth();
        manaText.text = click.getCurrentMana() + "/" + click.getMaxMana();
        name.text = click.getName();
        picture.sprite = click.getPicure();
        actionInspector.AddAllButtons(click.getButtons());

        if ( click is WarriorAnimation ) {
            damageText.text = "Damage: " + ((WarriorAnimation) click).Attack.Damage;
        }
        experienceBar.maxValue = click.getMaxExp();
        experienceBar.value = click.getCurrentExp();
        levelAndClassText.text = "Level " +click.getCurrentLevel() + " " + click.getClassName();
    }