Наследование: MonoBehaviour
Пример #1
0
    public static Helm Factory(int cellID)
    {
        Helm helm = Helm.Factory();

        helm.Cell = Cell.FromId(cellID);
        return(helm);
    }
Пример #2
0
    public void AddHelmRPC(int viewID, string hero)
    {
        Helm toAdd   = PhotonView.Find(viewID).gameObject.GetComponent <Helm>();
        Hero toAddTo = findHero(hero);

        toAddTo.heroInventory.AddHelm2(toAdd);
    }
Пример #3
0
        /// <inheritdoc />
        public Armor Convert(ItemDTO value, object state)
        {
            var entity = new Helm();

            this.Merge(entity, value, state);
            return(entity);
        }
Пример #4
0
    public static Helm Factory(string hero)
    {
        Helm helm = Helm.Factory();

        GameManager.instance.findHero(hero).heroInventory.AddItem(helm);
        return(helm);
    }
Пример #5
0
    // Power Up Manager
    public void PowerUpManager(float timer)
    {
        if (helmActive)
        {
            Helm.SetActive(true);
            helmTimer -= Time.deltaTime;

            if (helmTimer < 0)
            {
                helmActive = false;
                helmTimer  = timer;
            }
        }
        else
        {
            Helm.SetActive(false);
        }

        if (shieldActive)
        {
            Shield.SetActive(true);
            shieldTimer -= Time.deltaTime;

            if (shieldTimer < 0)
            {
                shieldActive = false;
                shieldTimer  = timer;
            }
        }
        else
        {
            Shield.SetActive(false);
        }
    }
Пример #6
0
 public void RemoveHelm(Helm item)
 {
     if (helm.GetComponent <PhotonView>().ViewID == item.GetComponent <PhotonView>().ViewID)
     {
         int viewID = item.GetComponent <PhotonView>().ViewID;
         GameManager.instance.photonView.RPC("RemoveHelmRPC", RpcTarget.AllViaServer, new object[] { viewID, parentHero });
     }
     else
     {
         Debug.Log("Error hero inventory remove helm");
     }
 }
Пример #7
0
    public void SwitchTo(string station)
    {
        // disable all camera
        LobbyCamera.enabled    = false;
        HelmCamera.enabled     = false;
        TacticalCamera.enabled = false;
        SensorsCamera.enabled  = false;
        SensorsCamera.enabled  = false;

        // inactivate all interfaces
        Lobby.SetActive(false);
        Helm.SetActive(false);
        Tactical.SetActive(false);
        Sensors.SetActive(false);
        Sensors.SetActive(false);

        // activate the appropriate station
        switch (station)
        {
        case "lobby":
            LobbyCamera.enabled = true;
            Lobby.SetActive(true);
            Lobby.GetComponent <Lobby>().Activate();
            break;

        case "helm":
            HelmCamera.enabled = true;
            Helm.SetActive(true);
            Helm.GetComponent <Helm>().Activate();
            break;

        case "tactical":
            TacticalCamera.enabled = true;
            Tactical.SetActive(true);
            Tactical.GetComponent <Tactical>().Activate();
            break;

        case "sensors":
            SensorsCamera.enabled = true;
            Sensors.SetActive(true);
            Sensors.GetComponent <Sensors>().Activate();
            break;

        case "scanners":
            ScannersCamera.enabled = true;
            Scanners.SetActive(true);
            //Scanners.GetComponent<Scanners>().Activate();
            break;
        }
    }
Пример #8
0
 public bool AddHelm(Helm item)
 {
     if (helm == null)
     {
         int viewID = item.GetComponent <PhotonView>().ViewID;
         GameManager.instance.photonView.RPC("AddHelmRPC", RpcTarget.AllViaServer, new object[] { viewID, parentHero });
         return(true);
     }
     else
     {
         //Error already a helm
         EventManager.TriggerError(1);
         return(false);
     }
 }
Пример #9
0
    public void AddHelm2(Helm item)
    {
        string id = convertToKey(item.GetComponent <PhotonView>().ViewID);

        helm = item;
        AllTokens.Add(id, (Helm)item);
        if (GameManager.instance.MainHero.TokenName.Equals(parentHero))
        {
            EventManager.TriggerInventoryUIHeroUpdate(this);
        }
        else if (parentHero.Equals(CharChoice.choice.TokenName))
        {
            EventManager.TriggerInventoryUIHeroPeak(this);
        }
    }
Пример #10
0
 public void Dispose()
 {
     Armor.Dispose();
     MainHand.Dispose();
     OffHand.Dispose();
     Ring.Dispose();
     Ring2.Dispose();
     Amulet.Dispose();
     Helm.Dispose();
     Gloves.Dispose();
     Boots.Dispose();
     Belt.Dispose();
     Flasks.ForEach(vm => vm.Dispose());
     TreeJewels.ForEach(vm => vm.Dispose());
     ItemJewels.Values.Flatten().ForEach(vm => vm.Dispose());
 }
Пример #11
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Chart != null ? Chart.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Directory != null ? Directory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Helm != null ? Helm.GetHashCode() : 0);
         // hashCode = (hashCode * 397) ^ (Ksonnet != null ? Ksonnet.GetHashCode() : 0);
         // hashCode = (hashCode * 397) ^ (Kustomize != null ? Kustomize.GetHashCode() : 0);
         // hashCode = (hashCode * 397) ^ (Plugin != null ? Plugin.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Path != null ? Path.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RepoUrl != null ? RepoUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TargetRevision != null ? TargetRevision.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #12
0
    private void ReceiveMessage(string json)
    {
        // examine the generic message
        var generic = JsonUtility.FromJson <Message>(json);

        Debug.Log($"received: {json}");

        // determine message and value
        if (generic.c == "telemetry")
        {
            var actual = JsonUtility.FromJson <Message <TelemetryPayload> >(json);
            if (actual.p.id == "00000000-0000-0000-0000-000000000000")
            {
                if (Helm.isActiveAndEnabled)
                {
                    Helm.ReceiveTelemetry(actual.p);
                }
            }
            if (Sensors.isActiveAndEnabled)
            {
                Sensors.ReceiveTelemetry(actual.p);
            }
        }
        if (generic.c == "helm" && Helm.isActiveAndEnabled)
        {
            var actual = JsonUtility.FromJson <Message <FromHelmStation> >(json);
            Helm.ReceiveFromHelmStation(actual.p);
        }
        if (generic.c == "tactical" && Tactical.isActiveAndEnabled)
        {
            var actual = JsonUtility.FromJson <Message <FromTacticalStation> >(json);
            Tactical.ReceiveFromTacticalStation(actual.p);
        }
        if (generic.c == "zone")
        {
            Sensors.ReceiveZone(json);
        }

        // take note of the last received message
        LastReceivedAt = Time.realtimeSinceStartup;
    }
Пример #13
0
    private static void UpdateUVs(Config[] configs)
    {
        foreach (var config in configs)
        {
            var armorMeshFolderPath  = "Assets/Character_Editor/Meshes/" + config.folderName + "/Armor/";
            var weaponMeshFolderPath = "Assets/Character_Editor/Meshes/" + config.folderName + "/Weapon/";

            var meshPaths = new Dictionary <int, string>()
            {
                { Arm.GetMerheOrder(MeshType.ArmRight), armorMeshFolderPath + "Armor_Arm/ArmRight" },
                { Arm.GetMerheOrder(MeshType.ArmLeft), armorMeshFolderPath + "Armor_Arm/ArmLeft" },
                { Belt.GetMerheOrder(), armorMeshFolderPath + "Armor_Belt" },
                { BeltAdd.GetMerheOrder(), armorMeshFolderPath + "Armor_BeltAdd" },
                { Hair.GetMerheOrder(), armorMeshFolderPath + "Armor_Hair" },
                { Helm.GetMerheOrder(), armorMeshFolderPath + "Armor_Helm" },
                { Beard.GetMerheOrder(), armorMeshFolderPath + "Armor_Jaw" },
                { FaceFeature.GetMerheOrder(), armorMeshFolderPath + "Armor_Feature" },
                { Leg.GetMerheOrder(MeshType.LegRight), armorMeshFolderPath + "Armor_Leg/LegRight" },
                { Leg.GetMerheOrder(MeshType.LegLeft), armorMeshFolderPath + "Armor_Leg/LegLeft" },
                { Shoulder.GetMerheOrder(MeshType.ShoulderRight), armorMeshFolderPath + "Armor_Shoulder/ShoulderRight" },
                { Shoulder.GetMerheOrder(MeshType.ShoulderLeft), armorMeshFolderPath + "Armor_Shoulder/ShoulderLeft" },
                { Torso.GetMerheOrder(), armorMeshFolderPath + "Armor_Torso" },
                { TorsoAdd.GetMerheOrder(), armorMeshFolderPath + "Armor_TorsoAdd" },
                { Hand.GetMerheOrder(MeshType.HandRight), weaponMeshFolderPath + "HandRight" },
                { Hand.GetMerheOrder(MeshType.HandLeft), weaponMeshFolderPath + "HandLeft" },
            };


            var myList = meshPaths.ToList();
            myList.Sort((pair1, pair2) => pair1.Key.CompareTo(pair2.Key));

            int   atlasSize = 4;
            float uvsStep   = 1f / atlasSize;

            for (int itemNum = 0; itemNum < myList.Count; itemNum++)
            {
                if (!AssetDatabase.IsValidFolder(myList[itemNum].Value))
                {
                    continue;
                }

                var meshGUIDs = AssetDatabase.FindAssets("t:GameObject", new string[] { myList[itemNum].Value });
                for (int meshNum = 0; meshNum < meshGUIDs.Length; meshNum++)
                {
                    var tempMesh = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath(meshGUIDs[meshNum]));
                    // Mesh tempMesh = UnityEngine.Object.Instantiate(meshObject);

                    //Update LOD parts for each armor item
                    var armorsParts = tempMesh.GetComponentsInChildren <MeshFilter>();
                    for (var armLOD = 0; armLOD < armorsParts.Length; armLOD++)
                    {
                        if (armorsParts[armLOD] != null)
                        {
                            var mTempMesh = (Mesh)GameObject.Instantiate(armorsParts[armLOD].sharedMesh);

                            //Update UVS for new atlas
                            Vector2[] uvs = mTempMesh.uv;
                            for (int i = 0; i < uvs.Length; i++)
                            {
                                uvs[i] = new Vector2(uvs[i].x / atlasSize + uvsStep * (itemNum % atlasSize),
                                                     uvs[i].y / atlasSize + uvsStep * (atlasSize - 1 - (itemNum / atlasSize)));
                            }

                            mTempMesh.uv = uvs;
                            //assigne the selected LOD Mesh with new UV's to the new mesh to be exported
                            if (!Directory.Exists(myList[itemNum].Value + "/Meshes/"))
                            {
                                Directory.CreateDirectory(myList[itemNum].Value + "/Meshes/");
                            }

                            CreateOrReplaceAsset <Mesh>(mTempMesh,
                                                        myList[itemNum].Value + "/Meshes/" + armorsParts[armLOD].sharedMesh.name + "_New.asset");

                            AssetDatabase.SaveAssets();
                        }
                    }
                }
            }

            var prefabsPath = "Assets/Character_Editor/Prefabs/" + config.folderName;
            var prefabGUIDs = AssetDatabase.FindAssets("t:Prefab", new string[] { prefabsPath });
            for (int prefNum = 0; prefNum < prefabGUIDs.Length; prefNum++)
            {
                var pPath = AssetDatabase.GUIDToAssetPath(prefabGUIDs[prefNum]);
                if (pPath.Contains("/Model/"))
                {
                    var originalPrefab         = AssetDatabase.LoadAssetAtPath <GameObject>(pPath);
                    var originalPrefabInstance = GameObject.Instantiate(originalPrefab);
                    originalPrefabInstance.name = originalPrefab.name;

                    foreach (var filter in originalPrefabInstance.GetComponentsInChildren <MeshFilter>())
                    {
                        var lodMeshPath = AssetDatabase.GetAssetPath(filter.sharedMesh);
                        var index       = lodMeshPath.LastIndexOf("/");
                        if (index != -1)
                        {
                            lodMeshPath = lodMeshPath.Substring(0, index) + "/Meshes/" + filter.sharedMesh.name + "_New.asset";

                            var changedMesh = AssetDatabase.LoadAssetAtPath <Mesh>(lodMeshPath);
                            filter.mesh = changedMesh;

                            var newDirPath  = pPath.Substring(0, pPath.IndexOf("Model/")) + "StaticModel/";
                            var fullDirPath = Application.dataPath.Substring(0, Application.dataPath.Length - 6) + newDirPath;
                            if (Directory.Exists(fullDirPath))
                            {
                                Directory.Delete(fullDirPath, true);
                            }

                            Directory.CreateDirectory(fullDirPath);

                            Object prefab = PrefabUtility.CreateEmptyPrefab(newDirPath + originalPrefabInstance.name + ".prefab");
                            PrefabUtility.ReplacePrefab(originalPrefabInstance, prefab, ReplacePrefabOptions.ConnectToPrefab);

                            AssetDatabase.SaveAssets();
                        }
                    }
                    GameObject.DestroyImmediate(originalPrefabInstance);
                }
            }
        }
    }
Пример #14
0
    //////////////////////////////////
    // START 			    		//
    //////////////////////////////////
    void Start()
    {
        // This is used so that there will not be a constant call, with Wrahh calling eg shield, and shield calling Wrahh, as they need information about each other
        if(shield == null)
            shield = new Shield();
        if(helm == null)
            helm = new Helm();

        // At the begging of the game, Wrahh is stripped of everything, and he therefore does not have a shield, no helmet, no grenades, and no armor
        shieldOn = false;
        helmOn = false;
        weaponParts = 0;
        lobsterParts = 0;
        shieldArmor = 0;
        helmArmor = 0;

        // Loads the standard weapon (his bare hands) in to all slots in the weapon array
        for(int i = 0; i < 5; i++)
        {
            weapons[i] = gameObject.AddComponent<Weapon>();
        }

        // Sets the start slot to the first slot in the array, and set his current weapon
        currentSlot = 0;
        currentWeapon = weapons[currentSlot];

        // Lots of sounds being loaded
        walkSoundPlaying = false;
        numberOfSounds = 17;
        numberOfWalkingSounds = 14;
        numberOfFallingSounds = 1+numberOfWalkingSounds;
        numberOfHitGroundSounds = 1+numberOfFallingSounds;
        numberOfPunchSounds = 1+numberOfHitGroundSounds;
        for (int i = 0; i<numberOfSounds;i++)
        {
            this.gameObject.AddComponent<AudioSource>();
        }
        sounds = GetComponents<AudioSource>();						//all audio source components on the object it put in the "sounds" array in the order they are listed on the object
        for (int i = 0; i<numberOfSounds;i++)
        {
            while(i<numberOfWalkingSounds)
            {
                sounds[i].clip = Resources.Load("sounds/walk-"+(1+i)) as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch = 1f;
                sounds[i].volume = 0.1f;
                i++;
            }

            while(i<numberOfFallingSounds)
            {
                sounds[i].clip = Resources.Load("sounds/screamFall") as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch = 1.0f;
                sounds[i].volume = 1.0f;
                sounds[i].loop = true;
                i++;
            }

            while(i<numberOfHitGroundSounds)
            {
                sounds[i].clip = Resources.Load("sounds/hitGround") as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch = 1.0f;
                sounds[i].volume = 1.0f;
                sounds[i].loop = false;
                i++;
            }
            while(i<numberOfPunchSounds)
            {
                sounds[i].clip = Resources.Load("sounds/punch") as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch = 1.0f;
                sounds[i].volume = 0.5f;
                sounds[i].loop = false;
                i++;
            }
        }

        //From parent "GameCharacters.cs":
        moveSpeed = 10000.0f; // The moveSpeed is very high, because he is heavy, and he is moved by adding force
        facingRight = true;
        MAX_MOVE_SPEED = 30.0f;
        health = 100;
        setStandardPhysics();
        accessAnimator();
    }
Пример #15
0
    // Use this for initialization
    void Start()
    {
        //Initialize Abilities - TODO Should this be done statically?
        dStrike = new Decisive_Strike();
        dStrike.setScript(this);
        courage = new Courage();
        courage.setScript(this);
        judgement = new Judgement();
        judgement.setScript(this);
        dJustice = new Demacian_Justice();
        dJustice.setScript(this);
        valor = new Valor();
        valor.setScript(this);

        level = 1;

        IconWidth = judgementTexture.width;
        IconHeight = judgementTexture.height;

        //Initially not running
        running = false;

        idling = true;

        a = gameObject.GetComponent(typeof(Animation)) as Animation;

        originalRotation = transform.localRotation;
        spinning = false;

        alive = true;

        inventory = new Item[inventorySize];

        TwoHandedSword startingSword = new TwoHandedSword();
        startingSword.randomizeWeapon(1, 1);
        awardItem(startingSword);

        Helm startingHelm = new Helm();
        startingHelm.randomizeArmor(1, 1);
        awardItem(startingHelm);

        Chest startingChest = new Chest();
        startingChest.randomizeArmor(1, 1);
        awardItem(startingChest);

        Gloves startingGloves = new Gloves();
        startingGloves.randomizeArmor(1, 1);
        awardItem(startingGloves);

        Boots startingBoots = new Boots();
        startingBoots.randomizeArmor(1, 1);
        awardItem(startingBoots);

        checkpointTexture = Resources.Load("CheckpointTexture/CheckpointMaybe") as Texture2D;
        playerPortrait = Resources.Load("CheckpointTexture/garen_circle") as Texture2D;
        playerManaTexture = Resources.Load("PlayerTextures/mana") as Texture2D;

        leftClickOverlay = Resources.Load("InstructionPage/leftclick") as Texture2D;
        rightClickOverlay = Resources.Load("InstructionPage/rightclick") as Texture2D;

        winTexture = Resources.Load("GUITextures/victoryFull") as Texture2D;
        lossTexture = Resources.Load("GUITextures/defeatFull") as Texture2D;
        continueButton = Resources.Load("InstructionPage/Continue") as Texture2D;
        continueButtonHighlighted = Resources.Load("InstructionPage/Continue2") as Texture2D;

        equipment = new Item[5]; //TODO decide on size

        equipmentRect = new Rect(50, 50, 300, 300);
        inventoryRect = new Rect(Screen.width - 350, 50, 300, Mathf.Ceil(inventorySize / 6) * 50 + 20);
        confirmRect = new Rect((Screen.width / 2) - 150, Screen.height / 4, 300, 300);
        continueRect = new Rect((Screen.width / 2) - (continueButton.width / 2), Screen.height * (3.0f/4.0f), continueButton.width, continueButton.height);

        movementSpeed = 1;

        recalculateStats();

        if(PlayerPrefs.GetString("IsSaveGame") == "true"){
            name = PlayerPrefs.GetString("SaveFileName");
            Load();
        }

        currentHealth = maxHealth;

        Save();
    }
Пример #16
0
 // Implement this method in a buddy class to set properties that are specific to 'Helm' (if any)
 partial void Merge(Helm entity, ItemDTO dto, object state);
Пример #17
0
    //////////////////////////////////
    // START                        //
    //////////////////////////////////
    void Start()
    {
        // This is used so that there will not be a constant call, with Wrahh calling eg shield, and shield calling Wrahh, as they need information about each other
        if (shield == null)
        {
            shield = new Shield();
        }
        if (helm == null)
        {
            helm = new Helm();
        }

        // At the begging of the game, Wrahh is stripped of everything, and he therefore does not have a shield, no helmet, no grenades, and no armor
        shieldOn     = false;
        helmOn       = false;
        weaponParts  = 0;
        lobsterParts = 0;
        shieldArmor  = 0;
        helmArmor    = 0;

        // Loads the standard weapon (his bare hands) in to all slots in the weapon array
        for (int i = 0; i < 5; i++)
        {
            weapons[i] = gameObject.AddComponent <Weapon>();
        }

        // Sets the start slot to the first slot in the array, and set his current weapon
        currentSlot   = 0;
        currentWeapon = weapons[currentSlot];

        // Lots of sounds being loaded
        walkSoundPlaying        = false;
        numberOfSounds          = 17;
        numberOfWalkingSounds   = 14;
        numberOfFallingSounds   = 1 + numberOfWalkingSounds;
        numberOfHitGroundSounds = 1 + numberOfFallingSounds;
        numberOfPunchSounds     = 1 + numberOfHitGroundSounds;
        for (int i = 0; i < numberOfSounds; i++)
        {
            this.gameObject.AddComponent <AudioSource>();
        }
        sounds = GetComponents <AudioSource>();                                                 //all audio source components on the object it put in the "sounds" array in the order they are listed on the object
        for (int i = 0; i < numberOfSounds; i++)
        {
            while (i < numberOfWalkingSounds)
            {
                sounds[i].clip        = Resources.Load("sounds/walk-" + (1 + i)) as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch       = 1f;
                sounds[i].volume      = 0.1f;
                i++;
            }

            while (i < numberOfFallingSounds)
            {
                sounds[i].clip        = Resources.Load("sounds/screamFall") as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch       = 1.0f;
                sounds[i].volume      = 1.0f;
                sounds[i].loop        = true;
                i++;
            }

            while (i < numberOfHitGroundSounds)
            {
                sounds[i].clip        = Resources.Load("sounds/hitGround") as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch       = 1.0f;
                sounds[i].volume      = 1.0f;
                sounds[i].loop        = false;
                i++;
            }
            while (i < numberOfPunchSounds)
            {
                sounds[i].clip        = Resources.Load("sounds/punch") as AudioClip;
                sounds[i].playOnAwake = false;
                sounds[i].rolloffMode = AudioRolloffMode.Linear;
                sounds[i].pitch       = 1.0f;
                sounds[i].volume      = 0.5f;
                sounds[i].loop        = false;
                i++;
            }
        }

        //From parent "GameCharacters.cs":
        moveSpeed      = 10000.0f;    // The moveSpeed is very high, because he is heavy, and he is moved by adding force
        facingRight    = true;
        MAX_MOVE_SPEED = 30.0f;
        health         = 100;
        setStandardPhysics();
        accessAnimator();
    }
Пример #18
0
    void Start()
    {
        merchantPanel = transform.Find("MerchantUI").gameObject;
        buyPanel      = transform.Find("BuyPanel").gameObject;
        panelTitle    = buyPanel.transform.Find("Title").GetComponent <Text>();
        panelDesc     = buyPanel.transform.Find("Description").GetComponent <Text>();

        btns   = transform.Find("MerchantUI/").GetComponentsInChildren(typeof(Button));
        buyBtn = buyPanel.transform.Find("Buy Button").GetComponent <Button>();

        cancelBtn = buyPanel.transform.Find("Cancel Button").GetComponent <Button>();
        cancelBtn.onClick.AddListener(delegate { HidePanel(); });

        transform.Find("MerchantUI/Potion/Button/Text").GetComponent <UnityEngine.UI.Text>().text = "" + Witch.Instance.PotionPrice;

        for (int i = 0; i < btns.Length; i++)
        {
            Button btn = (Button)btns[i];

            if (btn.transform.parent.name == "Strength")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Strength.itemName, Strength.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Strength.Buy(); HidePanel(); });
                });
            }
            else if (btn.transform.parent.name == "Helm")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Helm.itemName, Helm.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Helm.Buy(); HidePanel(); });
                });
            }
            else if (btn.transform.parent.name == "Telescope")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Telescope.itemName, Telescope.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Telescope.Buy(); HidePanel(); });
                });
            }
            else if (btn.transform.parent.name == "Wineskin")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Wineskin.itemName, Wineskin.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Wineskin.Buy(); HidePanel(); });
                });
            }
            else if (btn.transform.parent.name == "Shield")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Shield.itemName, Shield.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Shield.Buy(); HidePanel(); });
                });
            }
            else if (btn.transform.parent.name == "Bow")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Bow.itemName, Bow.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Bow.Buy(); HidePanel(); });
                });
            }
            else if (btn.transform.parent.name == "Falcon")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Falcon.itemName, Falcon.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Falcon.Buy(); HidePanel(); });
                });
            }
            else if (btn.transform.parent.name == "Potion")
            {
                btn.onClick.AddListener(() => {
                    ShowPanel(Potion.itemName, Potion.desc);
                    buyBtn.onClick.RemoveAllListeners();
                    buyBtn.onClick.AddListener(() => { Potion.Buy(); HidePanel(); });
                });
            }
        }
    }
Пример #19
0
    // Use this for initialization
    void Start()
    {
        //Initialize Abilities - TODO Should this be done statically?
        tumble = new Tumble();
        tumble.setScript(this);
        silverBolts = new Silver_Bolts();
        silverBolts.setScript(this);
        condemn = new Condemn();
        condemn.setScript(this);
        finalHour = new Final_Hour();
        finalHour.setScript(this);
        shadowBolt = new ShadowBolt();
        shadowBolt.setScript(this);

        IconWidth = tumbleTexture.width;
        IconHeight = tumbleTexture.height;

        level = 1;

        //Initially not running
        running = false;

        idling = true;

        a = gameObject.GetComponent(typeof(Animation)) as Animation;

        originalRotation = transform.localRotation;

        alive = true;

        inventory = new Item[inventorySize];

        Bow startingBow = new Bow();
        startingBow.randomizeWeapon(1, 1);
        awardItem(startingBow);

        Helm startingHelm = new Helm();
        startingHelm.randomizeArmor(1, 1);
        awardItem(startingHelm);

        Chest startingChest = new Chest();
        startingChest.randomizeArmor(1, 1);
        awardItem(startingChest);

        Gloves startingGloves = new Gloves();
        startingGloves.randomizeArmor(1, 1);
        awardItem(startingGloves);

        Boots startingBoots = new Boots();
        startingBoots.randomizeArmor(1, 1);
        awardItem(startingBoots);

        checkpointTexture = Resources.Load("CheckpointTexture/CheckpointMaybe") as Texture2D;
        playerPortrait = Resources.Load("CheckpointTexture/vayne_circle") as Texture2D;
        playerManaTexture = Resources.Load("PlayerTextures/mana") as Texture2D;
        swiftDeathTexture = Resources.Load("VayneTextures/swiftDeath") as Texture2D;
        shadowBoltTexture = Resources.Load("VayneTextures/ShadowBolt") as Texture2D;

        leftClickOverlay = Resources.Load("InstructionPage/leftclick") as Texture2D;
        rightClickOverlay = Resources.Load("InstructionPage/rightclick") as Texture2D;

        winTexture = Resources.Load("GUITextures/victoryFull") as Texture2D;
        lossTexture = Resources.Load("GUITextures/defeatFull") as Texture2D;
        continueButton = Resources.Load("InstructionPage/Continue") as Texture2D;
        continueButtonHighlighted = Resources.Load("InstructionPage/Continue2") as Texture2D;

        equipment = new Item[6]; //TODO decide on size

        equipmentRect = new Rect(50, 50, 300, 300);
        inventoryRect = new Rect(Screen.width - 350, 50, 300, Mathf.Ceil(inventorySize / 6) * 50 + 20);
        confirmRect = new Rect((Screen.width / 2) - 150, Screen.height / 4, 300, 300);
        continueRect = new Rect((Screen.width / 2) - (continueButton.width / 2), Screen.height * (3.0f/4.0f), continueButton.width, continueButton.height);

        movementSpeed = 1;

        recalculateStats();

        if(PlayerPrefs.GetString("IsSaveGame") == "true"){
            name = PlayerPrefs.GetString("SaveFileName");
            Load();
        }

        currentHealth = maxHealth;
        currentMana = maxMana;

        Save();
    }
Пример #20
0
    void Start()
    {
        // references
        Network = GameObject.Find("Interface").GetComponent <Network>();

        // make all camera objects active and all cameras but Lobby covered
        foreach (var camera in Resources.FindObjectsOfTypeAll <Camera>())
        {
            switch (camera.name)
            {
            case "LobbyCamera":
                LobbyCamera = camera;
                LobbyCamera.gameObject.SetActive(true);
                LobbyCamera.enabled = true;
                break;

            case "HelmCamera":
                HelmCamera = camera;
                HelmCamera.gameObject.SetActive(true);
                HelmCamera.enabled = false;
                break;

            case "TacticalCamera":
                TacticalCamera = camera;
                TacticalCamera.gameObject.SetActive(true);
                TacticalCamera.enabled = false;
                break;

            case "SensorsCamera":
                SensorsCamera = camera;
                SensorsCamera.gameObject.SetActive(true);
                SensorsCamera.enabled = false;
                Sensors = camera.GetComponentInParent <Sensors>().gameObject;
                Sensors.SetActive(false);
                break;

            case "ScannersCamera":
                ScannersCamera = camera;
                ScannersCamera.gameObject.SetActive(true);
                ScannersCamera.enabled = false;
                break;
            }
        }

        // make all interfaces inactive except the lobby
        foreach (var canvas in Resources.FindObjectsOfTypeAll <Canvas>())
        {
            switch (canvas.name)
            {
            case "Lobby":
                Lobby = canvas.gameObject;
                Lobby.SetActive(true);
                break;

            case "Helm":
                Helm = canvas.gameObject;
                Helm.SetActive(false);
                break;

            case "Tactical":
                Tactical = canvas.gameObject;
                Tactical.SetActive(false);
                break;

            case "Scanners":
                Scanners = canvas.gameObject;
                Scanners.SetActive(false);
                break;
            }
        }
    }
Пример #21
0
 public AbstractSailBoat(IBoat hull, HullColor red, Helm outboard)
 {
     this.hull     = hull;
     this.red      = red;
     this.outboard = outboard;
 }
 public MotorBoatBuilder(Hull fiberglass, Helm wheel, HullColor white)
 {
     this.fiberglass = fiberglass;
     this.wheel      = wheel;
     this.white      = white;
 }
 public AbstractMotorBoat(IBoat hull, HullColor white, Helm wheel)
 {
     this.hull  = hull;
     this.white = white;
     this.wheel = wheel;
 }