// 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); } }
// Use this for initialization void Start() { bg = GameObject.FindGameObjectWithTag("BuildGround"); towerArray = FindObjectOfType <ChangeCursor>(); pT = FindObjectOfType <Parent_Tower>(); close = GetComponent <FindClosest>(); }
void MakeInstance() { if (instance == null) { instance = this; } }
void Start() { findClosest = GetComponent <FindClosest>(); radius = GetComponent <SphereCollider>(); radius.enabled = false; radius.isTrigger = true; radius.radius = InteractionRadius; }
public GameObject GetClosestAlly(IGoap allyType, GameObject allySeeker) { GameObject potentialMate = null; //change this potentialMate = FindClosest.FindClosestObject(enemyDirectory[allyType.GetType()], allySeeker); return(potentialMate); }
void Start() { Cursor.visible = false; anim = GetComponent <Animator>(); smoothLook = cam.GetComponent <SmoothLookAt>(); folowPlayer = cam.GetComponent <FolowPlayer>(); CameraControll = cam.GetComponent <CameraControll>(); playerMovement = GetComponent <PlayerMovement>(); FindClosest = GetComponent <FindClosest>(); }
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); }