Exemple #1
0
 // Update is called once per frame
 void Start()
 {
     player   = gameObject.GetComponent <UnarmedCharacter>();
     animator = gameObject.GetComponent <Animator>();
     //weapon = player.Weapon;
     health = player.MaxHealth;
 }
Exemple #2
0
    public void Buy()
    {
        UnarmedCharacter player = ShopManager.GetPlayer();

        if (Quantity > 0)
        {
            if (player.Coins >= item.Price)
            {
                if (Inventory.instance.items.Count < Inventory.instance.space)
                {
                    item.Buy();
                    Quantity--;
                    player.Coins     -= item.Price;
                    Quantity_txt.text = Quantity.ToString();
                }
                else
                {
                    pop_up.text = "Sadly, your inventory is full :(";
                }
            }
            else
            {
                pop_up.text = "YOU DON'T HAVE ENOUGH COINS!!!";
            }
        }
        else
        {
            pop_up.text = "Sorry we don't have this item anymore :')";
        }
    }
 private void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.CompareTag("Player"))
     {
         ally = col.gameObject.GetComponent <UnarmedCharacter>();
     }
 }
 private void Start()
 {
     player = GameObject.FindWithTag("Player").GetComponentInChildren <UnarmedCharacter>();
     ShopBox.SetActive(false);
     sentences              = new Queue <string>();
     NoButton.interactable  = false;
     YesButton.interactable = false;
 }
 // Start is called before the first frame update
 void Start()
 {
     player           = ThePlayer.GetComponent <UnarmedCharacter>();
     animator         = ThePlayer.GetComponent <Animator>();
     image.fillAmount = 0;
     _castSpell       = ThePlayer.GetComponent <CastSpell>();
     spellNb          = animator.GetInteger("Spell");
 }
 private void Start()
 {
     if (!photonView.IsMine)
     {
         enabled = false;
     }
     player = gameObject.GetComponent <UnarmedCharacter>();
 }
 private void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.CompareTag("Player"))
     {
         Debug.Log("AAAAHHHHHHHHHHHHH");
         player              = col.gameObject.GetComponent <UnarmedCharacter>();
         player.damagePower += 15;
     }
 }
Exemple #8
0
 private void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.CompareTag("Player"))
     {
         Debug.Log("Ninja-man");
         player   = col.gameObject.GetComponent <UnarmedCharacter>();
         animator = col.gameObject.GetComponent <Animator>();
         player.attackCooldown -= 0.4f;
         player.celerity       += 0.4f;
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (ally != null && duration > 0)
     {
         duration  -= 0.5f;
         ally.mana += 3;
     }
     else
     {
         duration = 5;
         ally     = null;
     }
 }
Exemple #10
0
    public void Savejson(UnarmedCharacter player, int saveslot = 0)
    {
        var res = JsonUtility.ToJson(player);

        Debug.Log(res);
        var path = "/save" + saveslot.ToString();

        if (File.Exists(path))
        {
            throw new NotImplementedException();
        }

        using (var sw = new StreamWriter(path))
        {
            sw.Write(res);
            Debug.Log("");
            sw.Close();
        }
    }
    // Start is called before the first frame update
    void Awake()
    {
        Random rnd = new Random();

        inventory = Inventory.instance;
        player    = GameObject.FindWithTag("Player").GetComponentInChildren <UnarmedCharacter>();

        slots = GetComponentsInChildren <ShopSlot>();

        //Consumable tmpCons = GetCons();
        int tmpQuanti = rnd.Next(10);
        //slots[0].AddItem(tmpCons,tmpQuanti);
        int        tmpCons  = rnd.Next(ConsumableList.ListConsumables.Length);
        Consumable SellCons = ConsumableList.ListConsumables[tmpCons];

        slots[0].AddItem(SellCons, tmpQuanti);

        //tmpCons = GetCons();
        tmpQuanti = rnd.Next(10);
        //slots[1].AddItem(tmpCons,tmpQuanti);
        tmpCons  = rnd.Next(ConsumableList.ListConsumables.Length);
        SellCons = ConsumableList.ListConsumables[tmpCons];
        slots[1].AddItem(SellCons, tmpQuanti);

        //tmpCons = GetCons();
        tmpQuanti = rnd.Next(10);
        //slots[2].AddItem(tmpCons,tmpQuanti);
        tmpCons  = rnd.Next(ConsumableList.ListConsumables.Length);
        SellCons = ConsumableList.ListConsumables[tmpCons];
        slots[2].AddItem(SellCons, tmpQuanti);

        //tmpCons = GetCons();
        tmpQuanti = rnd.Next(10);
        //slots[3].AddItem(tmpCons,tmpQuanti);
        tmpCons  = rnd.Next(ConsumableList.ListConsumables.Length);
        SellCons = ConsumableList.ListConsumables[tmpCons];
        slots[3].AddItem(SellCons, tmpQuanti);

        Equipment eq = GetEq();

        slots[4].AddItem(eq, 1);
    }
Exemple #12
0
    public void save(UnarmedCharacter player, int slot)
    {
        var damagePower = player.damagePower;
        var armorPower  = player.armorPower;
        var healt       = player.health;
        var mana        = player.mana;
        var status      = (int)player.status;
        var inventory   = player.inventoryUI.GetComponent <InventoryUI>().inventory;
        var items       = inventory.items;

        for (int i = 0; i < items.Count; i++)
        {
            int type;
            int eqslot;
            int pos;
            if (items[i] is Equipment)
            {
                var eq = (Equipment)items[i];
                type   = (int)eq.weapontype;
                eqslot = (int)eq.equipSlot;
            }
        }
    }
Exemple #13
0
 private void Start()
 {
     player = gameObject.GetComponent <UnarmedCharacter>();
 }
Exemple #14
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     player = animator.GetComponent <UnarmedCharacter>();
     animator.SetBool("AnimCanAttack", true);
 }
Exemple #15
0
 // Start is called before the first frame update
 void Start()
 {
     player           = ThePlayer.GetComponent <UnarmedCharacter>();
     animator         = ThePlayer.GetComponent <Animator>();
     image.fillAmount = 0;
 }
Exemple #16
0
        /*public void SetIsHiting(bool isHiting)
         * {
         *  this.isHiting=isHiting;
         * }*/

        private void Start()
        {
            animator = gameObject.GetComponentInParent <UnarmedCharacter>().gameObject.GetComponent <Animator>();
            player   = gameObject.GetComponentInParent <UnarmedCharacter>();
        }
Exemple #17
0
 void Start()
 {
     player   = gameObject.GetComponent <UnarmedCharacter>();
     animator = gameObject.GetComponent <Animator>();
 }
 private void Start()
 {
     player = GameObject.FindWithTag("Player").GetComponentInChildren <UnarmedCharacter>();
     //allImage = new Sprite[Enum.GetNames(typeof(Status)).Length];
 }
Exemple #19
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     player = animator.GetComponent <UnarmedCharacter>();
 }