// Update is called once per frame void Update() { if (canBash) { if (Input.GetKeyDown(KeyCode.B)) { StartBash(objectToBash); } } if (bashableObjectsInRange.Count > 0) { canBash = true; } else if (bashableObjectsInRange.Count == 0) { canBash = false; } if (bashableObjectsInRange.Count == 1) { objectToBash = bashableObjectsInRange[0]; } else if (bashableObjectsInRange.Count > 1) { objectToBash = FindClosest.FindClosestObject(bashableObjectsInRange, this.gameObject); } }
public GameObject GetClosestAlly(IGoap allyType, GameObject allySeeker) { GameObject potentialMate = null; //change this potentialMate = FindClosest.FindClosestObject(enemyDirectory[allyType.GetType()], allySeeker); return(potentialMate); }
GameObject FindMate() { GameObject potentialMate = null; //change this BlueDwarf[] potentialBlueDwarfMates = GameObject.FindObjectsOfType <BlueDwarf>(); List <GameObject> blueDwarfGOs = new List <GameObject>(); if (potentialBlueDwarfMates.Length > 0) { //Debug.Log("Found some mates"); } foreach (BlueDwarf bd in potentialBlueDwarfMates) { blueDwarfGOs.Add(bd.gameObject); } if (blueDwarfGOs.Count == 1 && blueDwarfGOs.Contains(this.gameObject)) { return(null); } potentialMate = FindClosest.FindClosestObject(blueDwarfGOs, this.gameObject); return(potentialMate); }
// Update is called once per frame void Update() { #region sword if (Input.GetMouseButtonDown(0)) { if (swordState == 0) { //play sword drawing animation swordState = 1; bowState = 0; Debug.Log("Drawn Sword"); } else if (swordState == 1) { swordState = 2; Debug.Log("Sword is swinging"); swordState = 1; } } #endregion sword #region bow if (Input.GetMouseButtonDown(1)) { if (bowState == 0) { Debug.Log("Drawn bow"); bowState = 1; //play bow drawing animation } else if (bowState == 1) { anim.Play("testBowShot"); StartCoroutine("FireBow"); } else { Debug.Log("Bow is already firing or someone be haxing"); } Debug.Log("finished bow logic"); } #endregion bow #region focus if (Input.GetKeyDown(KeyCode.LeftShift)) { swordState = 0; bowState = 0; } if (Input.GetKeyDown(KeyCode.LeftControl)) { NewFocus(); FocusNow(); } if (Input.GetKeyUp(KeyCode.LeftControl)) { RemoveFocus(); } if (Input.GetKeyDown(KeyCode.E)) { GameObject closestInteractable = FindClosest.FindClosestObject("Interactable"); Interactable interactableToInteractWith = closestInteractable.GetComponent <Interactable>(); //interactableToInteractWith.OnInteractionEntry(); } #endregion focus }