void Start() { _attributeManager = GetComponent <AttributeManager>(); _health = _attributeManager.GetAttribute <float>(AttributeType.Health); _healthMax = _attributeManager.GetAttribute <float>(AttributeType.HealthMax); _health.AddOnValueChangedDelegate(OnHealthChanged); _healthMax.AddOnValueChangedDelegate(OnHealthChanged); _character = GetComponent <BaseCharacter>(); }
/// <summary> /// Initialize the default values. /// </summary> protected override void Awake() { base.Awake(); // The item may have been added at runtime in which case the look source has already been populated. var characterLocomotion = m_Character.GetCachedComponent <UltimateCharacterLocomotion>(); m_LookSource = characterLocomotion.LookSource; m_UseAnimatorAudioStateSet.DeserializeAnimatorAudioStateSelector(m_Item, characterLocomotion); m_UseAnimatorAudioStateSet.Awake(m_Item.gameObject); m_AttributeManager = GetComponent <AttributeManager>(); if (m_AttributeManager != null) { m_UseAttribute = m_AttributeManager.GetAttribute(m_UseAttributeName); if (m_UseAttribute != null) { EventHandler.RegisterEvent(m_UseAttribute, "OnAttributeReachedDestinationValue", UseDepleted); } } m_CharacterUseAttributeManager = m_Character.GetCachedComponent <AttributeManager>(); if (m_CharacterUseAttributeManager != null) { m_CharacterUseAttribute = m_CharacterUseAttributeManager.GetAttribute(m_CharacterUseAttributeName); } m_NextAllowedUseTime = Time.time; EventHandler.RegisterEvent <ILookSource>(m_Character, "OnCharacterAttachLookSource", OnAttachLookSource); }
public void InsertCompuerta() { //validar la carga de la interfaz if (ctrl_blockTab == null) return; String pth = System.IO.Path.Combine(ctrl_blockTab.Directory_Path, this.ctrl_blockTab.Blockname); if (File.Exists(pth)) { Lab3.BlockManager blkMan = new Lab3.BlockManager(pth); Point3d pt; if (Lab2.Selector.Point("Selecciona el punto de inserción", out pt)) { blkMan.Load("Compuerta"); ObjectId id = blkMan.Insert(pt); AttributeManager attMan = new AttributeManager(id); attMan.SetAttribute("InputA", "1,1,0,0"); attMan.SetAttribute("InputB", "1,0,1,0"); attMan.SetAttribute("OUTPUT", "1,0,0,0"); String strA = attMan.GetAttribute("InputA"); } } else { } }
void Start() { _attributeManager = GetComponent <AttributeManager>(); Attribute <float> mana = _attributeManager.GetAttribute <float>(AttributeType.Mana); mana.AddOnValueChangedDelegate(OnManaChanged); }
/// <summary> /// Initialize the default values. /// </summary> protected override void Awake() { base.Awake(); m_AttributeManager = GetComponent <AttributeManager>(); if (!string.IsNullOrEmpty(m_DurabilityAttributeName)) { if (m_AttributeManager == null) { Debug.LogError("Error: The shield " + m_GameObject.name + " has a durability attribute specified but no Attribute Manager component."); } else { m_DurabilityAttribute = m_AttributeManager.GetAttribute(m_DurabilityAttributeName); if (m_DurabilityAttribute != null) { EventHandler.RegisterEvent(m_DurabilityAttribute, "OnAttributeReachedDestinationValue", DurabilityDepleted); } } } m_ImpactAnimatorAudioStateSet.DeserializeAnimatorAudioStateSelector(m_Item, m_Character.GetCachedComponent <UltimateCharacterLocomotion>()); m_ImpactAnimatorAudioStateSet.Awake(m_Item.gameObject); EventHandler.RegisterEvent <bool, bool>(m_Character, "OnAimAbilityStart", OnAim); }
public HitSingleCharacterSkill(GameObject p_owner, int p_attributeCooldown) : base("HitSingleCharacterSkill", p_owner, null) { Requirements.Add(new GameStartReq()); AttributeManager attributeManager = p_owner.GetComponent <AttributeManager>(); CooldownDurationAtt = attributeManager.GetAttribute <float>(p_attributeCooldown); }
/// <summary> /// Retrieves the health component. /// </summary> public override void OnStart() { var target = GetDefaultGameObject(m_TargetGameObject.Value); if (target != m_PrevTarget) { m_AttributeManager = target.GetCachedComponent <AttributeManager>(); m_PrevTarget = target; } if (m_AttributeManager != null && m_AttributeName.Value != m_PrevAttributeName) { m_Attribute = m_AttributeManager.GetAttribute(m_AttributeName.Value); m_PrevAttributeName = m_AttributeName.Value; } }
private void UpdateAttributeRPC(string name, float value, float minValue, float maxValue, float autoUpdateAmount, float autoUpdateInterval, float autoUpdateStartDelay, int autoUpdateValueType) { var attribute = m_AttributeManager.GetAttribute(name); if (attribute == null) { return; } attribute.Value = value; attribute.MinValue = minValue; attribute.MaxValue = maxValue; attribute.AutoUpdateAmount = autoUpdateAmount; attribute.AutoUpdateInterval = autoUpdateInterval; attribute.AutoUpdateStartDelay = autoUpdateStartDelay; attribute.AutoUpdateValueType = (Attribute.AutoUpdateValue)autoUpdateValueType; }
/// <summary> /// Attaches the monitor to the specified character. /// </summary> /// <param name="character">The character to attach the monitor to.</param> protected override void OnAttachCharacter(GameObject character) { if (m_Character != null) { if (m_AttributeManager != null && m_AttributeManager.gameObject == character) { EventHandler.UnregisterEvent <Attribute>(m_AttributeManager.gameObject, "OnAttributeUpdateValue", OnUpdateValue); m_AttributeManager = null; } } base.OnAttachCharacter(character); if (m_Character == null) { return; } if (m_AttributeManager == null) { m_AttributeManager = m_Character.GetCachedComponent <AttributeManager>(); EventHandler.RegisterEvent <Attribute>(m_AttributeManager.gameObject, "OnAttributeUpdateValue", OnUpdateValue); } if (m_AttributeManager == null) { enabled = false; gameObject.SetActive(false); return; } m_Attribute = m_AttributeManager.GetAttribute(m_AttributeName); if (m_Attribute == null) { enabled = false; gameObject.SetActive(false); return; } enabled = true; m_Slider.value = (m_Attribute.Value - m_Attribute.MinValue) / (m_Attribute.MaxValue - m_Attribute.MinValue); gameObject.SetActive(CanShowUI()); }