public void ChangeForm(TrapForm form) { this.form = form; renderer.sprite = form.sprite; Destroy(GetComponent <BoxCollider2D>()); gameObject.AddComponent <BoxCollider2D>(); }
//=== public void Create(TrapForm form, Vector3 spawnPos) { if (GameManager.Instance.playerData.isNewBegin) { EnhancedRate = 1f; } fireCooltimer = FireCooltime; this.spawnPos = spawnPos; ApplyForm(form); transform.position = spawnPos; spawnLocalPos = new Vector3(-1.97f, -1, 0); transform.localPosition = transform.localPosition = new Vector3(transform.localPosition.x, spawnLocalPos.y, transform.localPosition.x); }
public void ApplyForm(TrapForm form) { this.form = form; damage = form.damage * EnhancedRate; hitCount = form.hitCount; renderer.sprite = form.sprite; gameObject.AddComponent <BoxCollider2D>(); StartCoroutine(thr_fire()); if (form.isFloating) { StartCoroutine(thr_floating()); } DataHandler.Instance.playerTraps.Add(this); if (DataHandler.Instance.dataUpdated != null) { DataHandler.Instance.dataUpdated(); } }