void Update() { float deltaTime = 0; if (properties.ownerType == AttackPattern.OwnerType.PLAYER && BombManager.sSingleton.isTimeStopBomb) { deltaTime = Time.unscaledDeltaTime; } else { deltaTime = Time.deltaTime; } HandleSpeedChange(); AttackPattern.Template currTemplate = properties.template; if (currTemplate == AttackPattern.Template.SINGLE_SHOT || currTemplate == AttackPattern.Template.ANGLE_SHOT || currTemplate == AttackPattern.Template.SHOOT_AROUND_IN_CIRCLE) { transform.Translate(properties.direction * properties.speed * deltaTime, Space.World); } else if (currTemplate == AttackPattern.Template.DOUBLE_SINE_WAVE) { mStartPos += properties.direction * properties.speed * deltaTime; transform.position = (Vector3)mStartPos + (Vector3)properties.curveAxis * Mathf.Sin(mAngle * properties.frequency) * (properties.magnitude + (mAngle * properties.magExpandMult)); mAngle += deltaTime; if (mAngle >= (Mathf.PI * 2)) { mAngle = 0; } } else if (currTemplate == AttackPattern.Template.SHOCK_REPEL_AND_TRAP_LASER) { transform.position = Vector3.MoveTowards(transform.position, mToTarget.position, properties.speed * deltaTime); Vector3 dir = mToTarget.position - transform.position; float bulletAngle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.AngleAxis(-90 + bulletAngle, Vector3.forward); } }
public void SetProperties(AttackPattern.Template template, float damage, float speed) { this.properties.template = template; this.properties.damage = damage; this.properties.speed = speed; }