Exemple #1
0
    public void GetPivotAndselectionArea()
    {
        access       = GameObject.Find("HangisiHareketEtsin").GetComponent <HangisiHareketEtsin>();
        soldiers     = new List <GameObject>();
        GetCommander = GameObject.FindWithTag("Komutan").GetComponent <OrduHareket>();
        Soldier      = GameObject.Find(access.movementObject.name).GetComponent <ParentTakip>();
        if (access.movementObject.tag == "Askerler1")
        {
            GetMovementObjectSoldier = Soldier.target.gameObject;
        }

        if (access.movementObject != null && (access.movementObject.tag == "selectionArea" || access.movementObject.tag == "Askerler1"))
        {
            var a = 0;
            if (access.movementObject.tag == "selectionArea")
            {
                GetMovementObjectParent = access.movementObject.transform.parent.gameObject;
            }
            else if (access.movementObject.tag == "Askerler1")
            {
                GetMovementObjectParent = GetMovementObjectSoldier.transform.parent.gameObject;
            }
            TakeList(GetMovementObjectParent);
        }
    }
Exemple #2
0
    void Start()
    {
        access         = GameObject.Find("HangisiHareketEtsin").GetComponent <HangisiHareketEtsin>();
        navMeshAgent   = GameObject.FindWithTag("Askerler1").GetComponent <NavMeshAgent>();
        targetPosition = transform.position;

        commanders = new List <Komutan>();
    }
Exemple #3
0
    void Update()
    {
        movementObject = GameObject.Find("HangisiHareketEtsin").GetComponent <HangisiHareketEtsin>();
        soldiers       = new List <GameObject>();

        if (UnitProperty.ReFormation == true)
        {
            GetMovementObjectParent = Commander;
            parentReserve           = GetMovementObjectParent;
            TakeList(Commander);
            FormationChange(UnitProperty.ActiveFormation, Commander, parentReserve);
            UnitProperty.ReFormation = false;
        }

        if (ClickedF1 && (movementObject.movementObject.tag == "selectionArea" || movementObject.movementObject.tag == "Askerler1"))//hareket edecek varmı diye kontrol et
        {
            GetPivotAndselectionArea();
            parentReserve = GetMovementObjectParent;
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                FormationChange(formation1(), GetMovementObjectParent, parentReserve);
            }
            else if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                FormationChange(formation2(), GetMovementObjectParent, parentReserve);
            }
            else if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                FormationChange(formation3(), GetMovementObjectParent, parentReserve);
            }
        }

        if (Input.GetKeyDown(KeyCode.F1))
        {
            ClickedF1 = true;
        }
    }