// Update is called once per frame void Update() { if (timeAdjust <= 0f) { for (int i = 0; i < maxCds.Length; i++) { if (maxCds[i] > 3f) { maxCds[i] -= 0.25f; } } timeAdjust = 20f; } else { timeAdjust -= Time.deltaTime; } if (player == null) { Instantiate(endgame, endgame.transform.position, endgame.transform.rotation); Destroy(gameObject); } for (int i = 0; i < spawnCds.Length; i++) { if (spawnCds[i] <= 0f && maxCds[i] != -100) { Vector2 spawn = Random.insideUnitCircle; spawn *= 20f; float x = spawn.x; float z = spawn.y; GameObject ecp = (GameObject)Instantiate(ecps[i], new Vector3(x, 0f, z), Quaternion.Euler(Vector3.zero)); ecp.GetComponent <em_move_controller>().SetTarget(player); em_properties_cls em_props = prop_manager.GetProperties(i); ecp.GetComponent <em_properties>().SetProperties(em_props); spawnCds[i] = maxCds[i]; } else { spawnCds[i] -= Time.deltaTime; } } }
public void SetProperties(em_properties_cls props) { this.ATK = props.ATK; this.DEF = props.DEF; // float this.SHLD = props.SHLD; // float this.BULLET = props.BULLET; // bool this.LASER = props.LASER; this.DROCKET = props.DROCKET; // int this.SROCKET = props.SROCKET; // int this.WEPCDS = props.WEPCDS; // float[3] 0: bullet cd 1: laser cd 2: d-rocket recharge cd 3: s-rocket recharge cd this.SPD = props.SPD; this.TSPD = props.TSPD; this.MIN_DIST = props.MIN_DIST; }
public em_properties_cls GetProperties(int i) { em_properties_cls propsCls = new em_properties_cls(); propsCls.ATK = ATK[i]; Debug.Log("PPCS " + ATK[i]); propsCls.DEF = DEF[i]; // float propsCls.SHLD = SHLD[i]; // float propsCls.BULLET = BULLET[i]; // bool propsCls.LASER = LASER[i]; propsCls.DROCKET = DROCKET[i]; // int propsCls.SROCKET = SROCKET[i]; // int propsCls.WEPCDS = WEPCDS[i]; // float[3] 0: bullet cd 1: laser cd 2: d-rocket recharge cd 3: s-rocket recharge cd propsCls.MIN_DIST = MIN_DIST[i]; propsCls.SPD = SPD[i]; propsCls.TSPD = TSPD[i]; return(propsCls); }