// cameraLink _linkedInstance; public void Initialise() { if (_homoInstance != null) { return; } // _linkedInstance = null; _homoInstance = new List <homoPacketus>(); _container = new GameObject(); _container.name = "#homoContaier"; _container.transform.position = Vector3.zero; for (int i = 0; i < _homoCount; ++i) { homoPacketus new_ = GameObject.Instantiate(_homoTemplate); Vector3 pos_ = new_.transform.position; pos_.x = Camera.main.transform.position.x; new_.transform.position = pos_; new_.transform.position += Vector3.left * (i - _homoCount * 0.5f) + Vector3.right * (Camera.main.orthographicSize * Camera.main.aspect + 2); new_.SetBounds(0.3f / _homoCount * i + 0.1f, 0.3f / _homoCount * i + 0.5f); new_.name = "HomoPacketus_" + i; new_.transform.parent = _container.transform; _homoInstance.Add(new_); } // AssignCameraLink (); }
public void NotifyDead(homoPacketus source) { source.transform.parent = _container.transform; _homoInstance.Remove(source); if (_homoInstance.Count == 0) { restartMngr.instance.Wipe(); } }
public bool AnyoneWalking(homoPacketus exception) { for (int i = 0; i < _homoInstance.Count; ++i) { if (_homoInstance[i] != exception && _homoInstance [i].State() == homoPacketus.state.Alive) { return(true); } } return(false); }
void capture() { victim = homoMngr.instance.AnyoneAround(Camera.main.WorldToViewportPoint(gameObject.transform.position).x); if (victim != null) { animator.SetTrigger("attack"); timeStartedAttack = Time.time; grabVictim = true; removeFromList(); //Debug.Log("found victim"+ victim.transform.position); } }
public void VictimIsGone(homoPacketus victim) { NotifyDead(victim); GameObject.Destroy(victim.gameObject); }