Exemplo n.º 1
0
 // 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>();
 }
Exemplo n.º 3
0
 void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 4
0
 void Start()
 {
     findClosest      = GetComponent <FindClosest>();
     radius           = GetComponent <SphereCollider>();
     radius.enabled   = false;
     radius.isTrigger = true;
     radius.radius    = InteractionRadius;
 }
Exemplo n.º 5
0
    public GameObject GetClosestAlly(IGoap allyType, GameObject allySeeker)
    {
        GameObject potentialMate = null;

        //change this
        potentialMate = FindClosest.FindClosestObject(enemyDirectory[allyType.GetType()], allySeeker);

        return(potentialMate);
    }
Exemplo n.º 6
0
 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>();
 }
Exemplo n.º 7
0
    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);
    }