private void OnTriggerExit(Collider other) { InteractItem_Base item = other.GetComponentInParent <InteractItem_Base>(); if (item) { ItemsInSight.Remove(item); if (ItemExitEvent != null) { ItemExitEvent(item); } } else { Character_Base ch = other.GetComponent <Character_Base>(); if (ch) { CharactersInSight.Remove(ch); if (CharacterExitEvent != null) { CharacterExitEvent(ch); } } } }
private void OnTriggerEnter(Collider other) { InteractItem_Base item = other.GetComponentInParent <InteractItem_Base>(); if (item) { ItemsInSight.Add(item); if (NewItemEnterEvent != null) { NewItemEnterEvent(item); } } else { Character_Base ch = other.GetComponent <Character_Base>(); if (ch && ch.CState.isAlive) { CharactersInSight.Add(ch); if (NewCharacterEnterEvent != null) { NewCharacterEnterEvent(ch); } } } }
public override void SetUpActions() { base.SetUpActions(); float minDistance = Mathf.Infinity; foreach (InteractItem_Base item in InteractManager.instance.GetItemList(ItemType)) { float distance = Vector3.Distance(item.transform.position, ownerCharacter.transform.position); if (distance < minDistance) { minDistance = distance; TargetItem = item; } } if (TargetItem) { AddNewAction(new Action_NavigaitionTo(TargetItem.GetSlot().position, 2)); AddNewAction(new Action_RotateTowards(TargetItem.GetSlot().position + TargetItem.GetSlot().forward, 2f)); AddNewAction(new Action_WaitForInteract(TargetItem)); AddNewAction(new Action_NavigaitionTo(TargetItem.GetSlot().position, 0.5f)); AddNewAction(new Action_RotateTowards(TargetItem.GetSlot().position + TargetItem.GetSlot().forward, 2f)); AddNewAction(new Action_Interact(TargetItem, 1)); } }
private void Start() { animator = GetComponent <Animator>(); InteractItem = GetComponent <InteractItem_Base>(); InteractItem.InteractStartEvent += OnStartInteract; InteractItem.InteractEndEvent += OnEndInteract; }
private void OnTriggerEnter(Collider other) { Character_Base character = other.GetComponent <Character_Base>(); if (character) { if (character.CState.Camp == camp) { AllyCharacters.Add(character); AIBrains.Add(character.GetComponent <AI_Base>()); } else { EnemyCharacters.Add(character); } return; } InteractItem_Base item = other.GetComponentInParent <InteractItem_Base>(); if (item && !AllItems.Contains(item)) { AllItems.Add(item); } }
public Action_WaitForInteract(InteractItem_Base item) { Item = item; }
public void RemoveItem(InteractItem_Base item) { AllInteractItems[(int)item.type].Remove(item); }
public void RegistItem(InteractItem_Base item) { AllInteractItems[(int)item.type].Add(item); }
private void Start() { InteractItem = GetComponent <InteractItem_Base>(); InteractItem.InteractEndEvent += OnEndInteract; }
public Action_Interact(InteractItem_Base item, float duration, string animationName = "Interact") { Item = item; AnimationName = animationName; Duration = duration; }