Пример #1
0
    void Update()
    {
        //Movement of the player
        CameraControler.SetCamera(IDs);
        if (Input.GetAxisRaw("Horizontal") > 0.5f)
        {
            transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * Speed * Time.deltaTime, 0f, 0f));
            Attackrange.transform.localPosition = new Vector3(attackRangePositionX, attackRangePositionY, attackRangePositionZ);
            Attackrange.transform.localRotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);
        }
        if (Input.GetAxisRaw("Horizontal") < -0.5f)
        {
            transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * Speed * Time.deltaTime, 0f, 0f));
            Attackrange.transform.localPosition = new Vector3(-attackRangePositionX, attackRangePositionY, attackRangePositionZ);
            Attackrange.transform.localRotation = Quaternion.Euler(0.0f, 180.0f, 0.0f);
        }
        if (Input.GetAxisRaw("Vertical") > 0.5f)
        {
            transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * Speed * Time.deltaTime, 0f));
        }
        if (Input.GetAxisRaw("Vertical") < -0.5f)
        {
            transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * Speed * Time.deltaTime, 0f));
        }
        Level = Mathf.Round((FortitudoLevel + PernicitasLevel + IntelligentiaLevel + CharismaLevel + PraecantatioLevel) / 5f);

        //calculating the stats of the player
        Power    = BasePower + inv.items[0].Power + inv.items[1].Power + inv.items[2].Power;
        Defence  = BaseDefence;
        Mpower   = BaseMpower + inv.items[0].Mpower + inv.items[1].Mpower + inv.items[2].Mpower;
        Mdefence = BaseMdefence;
        Speed    = BaseSpeed;
        inv.Houi(IDs);
        AttackTrigger.setattack(IDs);
        scrolltextmanager.Set(IDs);
        Tooltip.settooltip(IDs);
        Statsloader.SetupStats(IDs);
        PlayerAttack.SetAttack(IDs);
        CameraControler.SetCamera(IDs);
        showinv.setupinventory(IDs);
        ThunderArrow.Starting(IDs);
        Tooltip.settooltip(IDs);


        if (SceneManager.GetActiveScene().name != "Multiplayer Arena")
        {
            teleporter.SetCharacter(IDs);
            shopdamage.shopset(IDs);
        }

        if (Health <= 0)
        {
            Debug.Log("You have been defeated :(");
            Destroy(gameObject);
        }
    }
Пример #2
0
    void RegisterPlayer(string _ID)
    {
        IDs            = _ID;
        transform.name = "Character" + _ID;
        Character      = Player.transform.FindChild("Character" + _ID).gameObject;



        Healthbarcanvas     = Character.transform.FindChild("Healthbar canvas").gameObject;
        HealthBarBackground = Healthbarcanvas.transform.FindChild("Health background").gameObject;
        HealthIndicator     = HealthBarBackground.transform.FindChild("Health indicator").gameObject;
        Healthbar           = HealthIndicator.GetComponent <Image>();
        ThunderArrow        = Character.GetComponent <ThunderArrow>();
        Attackrange         = Character.transform.FindChild("AttackRange").gameObject;
        AttackTrigger       = Attackrange.GetComponent <AttackTrigger>();
        ItemTest            = Character.GetComponent <ItemTest>();
        inventorycanvas     = Player.transform.FindChild("Canvas").gameObject;
        tooltip             = inventorycanvas.transform.FindChild("Tooltip").gameObject;
        INVcancas           = inventorycanvas.GetComponent <Canvas>();
        Battletextmanager   = Player.transform.FindChild("BattleTextManager").gameObject;
        scrolltextmanager   = Battletextmanager.GetComponent <scrolltextmanager>();
        Inventory           = Player.transform.FindChild("Inventory").gameObject;
        showinv             = inventorycanvas.GetComponent <showinv>();
        inv         = Inventory.GetComponent <Inventory>();
        statscanvas = Player.transform.FindChild("Canvas - stats - map").gameObject;
        StatsPanel  = statscanvas.transform.FindChild("Stats Panel").gameObject;
        Statsloader = StatsPanel.GetComponent <Statsloader>();

        Camera = Player.transform.FindChild("Camera").gameObject;

        if (SceneManager.GetActiveScene().name != "Multiplayer Arena")
        {
            Teleporter = GameObject.Find("teleporter");
            teleporter = Teleporter.GetComponent <Teleporter>();
            teleporter.SetCharacter(_ID);
            shop       = GameObject.Find("Shop");
            shopdamage = shop.GetComponent <shopdamage>();
            shopdamage.shopset(_ID);
        }
        CameraControler = Camera.GetComponent <CameraControler>();
        PlayerAttack    = Character.GetComponent <PlayerAttack>();
        Tooltip         = tooltip.GetComponent <Tooltip>();
        ThunderArrow.Starting(_ID);
        AttackTrigger.setattack(_ID);
        scrolltextmanager.Set(_ID);
        inv.Houi(_ID);
        showinv.setupinventory(_ID);
        PlayerAttack.SetAttack(_ID);
        Statsloader.SetupStats(_ID);
        CameraControler.SetCamera(_ID);
        Tooltip.settooltip(_ID);
        inv.fillinventory();
    }