Exemple #1
0
        private void Awake()
        {
            GameObject player = GameObject.FindGameObjectWithTag(Constant.TAG_PLAYER);

            _playerStats = player.GetComponent <AttributeController>();

            _entries = new List <AttributeEntry>();
            for (int i = 0; i < _playerStats.AttributeTable.Count; ++i)
            {
                GameObject entry = Instantiate(AttributeEntryPrefab, AttributeEntryParent);
                _entries.Add(entry.GetComponent <AttributeEntry>());
            }
        }
        // Use this for initialization
        void Start()
        {
            _rigidBody = GetComponent <Rigidbody2D>();
            _animator  = GetComponent <Animator>();
            _animator.SetFloat("Angle", 0f);

            _pickupOption = GetComponent <PickupOptionController>();
            _inventory    = GetComponent <InventoryController>();
            _equipment    = GetComponent <EquipmentController>();
            _stats        = GetComponent <AttributeController>();
            _airItem      = GetComponent <AirItemController>();

            _lastPosition = transform.position;
        }
 public void OnConsume(InventoryController playerInventory, AttributeController playerStats, SlotPosition slotPosition)
 {
     Debug.Log("Consume " + Name);
     playerInventory.ConsumeItem(slotPosition);
     ApplyBuff(playerStats);
 }
 public void OnUnequip(EquipmentController playerEquipment, AttributeController playerStats)
 {
     Debug.Log("Unequip " + Name);
     playerEquipment.RemoveItem(_equipmentType);
     UnapplyBuff(playerStats);
 }
 public void OnEquip(EquipmentController playerEquipment, AttributeController playerStats)
 {
     Debug.Log("Equip " + Name);
     playerEquipment.AddItem(Copy());
     ApplyBuff(playerStats);
 }
 public void OnUse(AttributeController playerStats, ItemObject itemObject)
 {
     Debug.Log("Use " + Name);
     ApplyBuff(playerStats);
     itemObject.DestroySelf();
 }
Exemple #7
0
 protected void UnapplyBuff(AttributeController playerStats)
 {
     Debug.Log("UnapplyBuff " + Name);
     playerStats.UnapplyBuff(_buffTable);
 }