помогите понять в чем проблема
Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FractionControl : MonoBehaviour
{
public GameObject[] Troopers;
public float AttackTimer;
public float AtAttackTimer;
public int reserve;
public GameObject[] TROOPERSTIPE;
private int Need;
void Update()
{
if(AttackTimer< 0)
{
if (AtAttackTimer > 0)
{
for (int i = 0; i < Troopers.Length;)
{
Troopers[i].GetComponent<Man>().isFractionAttack = true;
}
AtAttackTimer -= Time.deltaTime;
}
else
{
for(int i = 0; i < Troopers.Length;)
{
Troopers[i].GetComponent<Man>().isFractionAttack = false;
i++;
AttackTimer = 600;
}
}
}
else
{
AttackTimer -= Time.deltaTime;
for(int i = 0; i < Troopers.Length; i++)
{
if (Troopers[i] == null)
{
Need += 1;
}
if(i == Troopers.Length)
{
for(int n = 0;n< Need;)
{
int Rnd = Random.Range(1, 3);
Instantiate(TROOPERSTIPE[Rnd], gameObject.transform.position, Quaternion.identity);
i++;
}
}
}
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class FractionControl : MonoBehaviour
{
public GameObject[] Troopers;
public float AttackTimer;
public float AtAttackTimer;
public int reserve;
public GameObject[] TROOPERSTIPE;
private int Need;
void Update()
{
if(AttackTimer< 0)
{
if (AtAttackTimer > 0)
{
for (int i = 0; i < Troopers.Length;)
{
Troopers[i].GetComponent<Man>().isFractionAttack = true;
}
AtAttackTimer -= Time.deltaTime;
}
else
{
for(int i = 0; i < Troopers.Length;)
{
Troopers[i].GetComponent<Man>().isFractionAttack = false;
i++;
AttackTimer = 600;
}
}
}
else
{
AttackTimer -= Time.deltaTime;
for(int i = 0; i < Troopers.Length; i++)
{
if (Troopers[i] == null)
{
Need += 1;
}
if(i == Troopers.Length)
{
for(int n = 0;n< Need;)
{
int Rnd = Random.Range(1, 3);
Instantiate(TROOPERSTIPE[Rnd], gameObject.transform.position, Quaternion.identity);
i++;
}
}
}
}
}
}