Example #1
0
    private void OnEnable()
    {
        pointCollider = GetComponent <Collider>();

        blueScoreValue = 0;
        redScoreValue  = 0;

        blueScoreText.GetComponent <Text>().text = blueScoreValue.ToString();
        redScoreText.GetComponent <Text>().text  = redScoreValue.ToString();

        outlineParticle      = transform.GetComponentInChildren <LineRenderer>();
        outlineStartPosition = outlineParticle.gameObject.transform.position;


        instance = this;
    }
Example #2
0
    void LoadCapturePoints()
    {
        CapturePointData    data    = SaveSystem.LoadCP();
        CapturePointManager manager = FindObjectOfType <CapturePointManager>();
        int count = 0;

        for (int i = 0; i < manager.capturePoints.Length; i++)
        {
            manager.capturePoints[i].isCaptured = data.isCaptured[i];
            if (data.isCaptured[i])
            {
                count++;
            }
        }
        manager.mainCapturePointCurrentCount = count;
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (unitControl.currentTarget == null)
        {
            playerUnits = FindObjectsOfType <PlayerUnit>();
            Transform playerUnit = playerUnits[Random.Range(0, playerUnits.Length)].transform;

            if (Vector3.Distance(transform.position, playerUnit.position) > 3)
            {
                CapturePointManager point = FindObjectOfType <CapturePointManager>();
                unitControl.MoveUnit(point.transform.position);
            }
            else
            {
                unitControl.SetNewTarget(playerUnit);
            }
        }
    }
Example #4
0
    public EnemyData(CapturePointManager manager)
    {
        ParentSpawnerInfo[] enemyInfos = manager.GetComponentsInChildren <ParentSpawnerInfo>();

        count     = enemyInfos.Length;
        x         = new float[enemyInfos.Length];
        y         = new float[enemyInfos.Length];
        z         = new float[enemyInfos.Length];
        spawnerId = new int[enemyInfos.Length];
        prefabId  = new int[enemyInfos.Length];

        for (int i = 0; i < enemyInfos.Length; i++)
        {
            x[i]         = enemyInfos[i].transform.position.x;
            y[i]         = enemyInfos[i].transform.position.y;
            z[i]         = enemyInfos[i].transform.position.z;
            spawnerId[i] = enemyInfos[i].spawnerId;
            prefabId[i]  = enemyInfos[i].prefabId;
            Debug.Log("Save prefab id: " + prefabId[i]);
        }
    }
    IEnumerator Start()
    {
        Time.timeScale = 1;

        blueMask = LayerMask.NameToLayer("Blue");
        redMask  = LayerMask.NameToLayer("Red");

        player       = FindObjectOfType <PlayerBehavior>();
        capturePoint = FindObjectOfType <CapturePointManager>();
        ai           = FindObjectOfType <AIManager>();
        ui           = FindObjectOfType <UIManager>();

        // Wait for player to select team
        while (!chosenTeam)
        {
            yield return(null);
        }

        player.SetValues(playerTeam, playerSpawn, enemy, team);
        player.Respawn();

        ai.CreateAIs(playerTeam);
    }
Example #6
0
    void LoadEnemies()
    {
        EnemyData           data    = SaveSystem.LoadEnemies();
        CapturePointManager manager = FindObjectOfType <CapturePointManager>();

        Vector3    pos;
        Spawner    spawner;
        GameObject prefab;
        GameObject newPrefab;

        for (int i = 0; i < data.count; i++)
        {
            spawner = manager.capturePoints[data.spawnerId[i]].spawner;
            prefab  = spawner.fighters[data.prefabId[i]];
            pos.x   = data.x[i];
            pos.y   = data.y[i];
            pos.z   = data.z[i];

            newPrefab = Instantiate(prefab, pos, Quaternion.identity, spawner.transform);
            newPrefab.GetComponent <ParentSpawnerInfo>().prefabId  = data.prefabId[i];
            newPrefab.GetComponent <ParentSpawnerInfo>().spawnerId = data.spawnerId[i];
            spawner.entitiesCount++;
        }
    }
Example #7
0
 // Start is called before the first frame update
 void Start()
 {
     manager = GetComponentInParent <CapturePointManager>();
 }
Example #8
0
 public void GetAPositionToMoveTo()
 {
     pointToTravelTo = CapturePointManager.GetRandomPositionOnObjective(rb.position);
 }
Example #9
0
 private void FixedUpdate()
 {
     GetComponent <Blackboard>().GetBoolVar("atObjective").Value = CapturePointManager.ObjectiveContainsVector(GetComponent <Rigidbody>().position);
 }
Example #10
0
 private void Awake()
 {
     capturePoint = FindObjectOfType <CapturePointManager>();
 }