public Flare(float xpos, float ypos, FlareGun owner, int numFlames = 8) : base(xpos, ypos) { this._sprite = new SpriteMap("smallFire", 16, 16); this._sprite.AddAnimation("burn", (float)(0.200000002980232 + (double)Rando.Float(0.2f)), true, 0, 1, 2, 3, 4); this._sprite.SetAnimation("burn"); this._sprite.imageIndex = Rando.Int(4); this.graphic = (Sprite)this._sprite; this.center = new Vec2(8f, 8f); this.collisionOffset = new Vec2(-4f, -2f); this.collisionSize = new Vec2(8f, 4f); this.depth = new Depth(-0.5f); this.thickness = 1f; this.weight = 1f; this.breakForce = 9999999f; this._owner = owner; this.weight = 0.5f; this.gravMultiplier = 0.7f; this._numFlames = numFlames; }
private void Awake() { missileTrackable = GetComponent <MissileTrackable>(); rb = GetComponent <Rigidbody2D>(); tData = Resources.Load <TargetData>("ScriptableObjects/TargetData"); rend = GetComponent <SpriteRenderer>(); if (gun == null) { gun = GetComponent <Gun>(); } if (flareGun == null) { flareGun = GetComponent <FlareGun>(); } Assert.IsNotNull(missileTrackable, "Could not find MissileTrackable script"); Assert.IsNotNull(rb, "Could not find RigidBody2D component"); Assert.IsNotNull(tData, "Could not find TargetData object"); Assert.IsNotNull(rend, "Could not find Sprite Renderer"); Assert.IsNotNull(gun, "Could not find Gun component"); Assert.IsNotNull(flareGun, "Could not find FlareGun component"); }