9 public virtual bool isPCC
19 public virtual int currentDir
30 this.originalScale = base.transform.localScale;
34 public void SetOwner(
Card t)
36 base.gameObject.SetActive(
true);
40 this.mpb =
new MaterialPropertyBlock();
42 this.mpb.SetColor(
"_Mat",
EMono.Colors.matColors.TryGetValue(t.material.alias,
null).main);
45 this.sr.SetPropertyBlock(this.mpb);
49 if (this.mpb2 ==
null)
51 this.mpb2 =
new MaterialPropertyBlock();
53 this.mpb2.SetColor(
"_Mat", Color.white);
54 this.sr2.SetPropertyBlock(this.mpb2);
57 if (Application.isEditor)
59 base.gameObject.name = this.owner.Name;
63 this.srAnime.SetData(this.owner.id +
"_anime");
69 public virtual void OnSetOwner()
74 public virtual void IdleFrame()
79 public virtual void NextFrame()
84 public virtual void NextDir()
89 public virtual int GetFrame()
100 if (data.useOffsetBack &&
this.owner !=
EMono.pc.held && (data.symmetry ? (p.dir % 2 == 1) : (p.dir == 1 || p.dir == 2)))
102 CardActor.tempV.x = p.x + data.offsetBack.x + current.offset.x;
103 CardActor.tempV.y = p.y + data.offsetBack.y + current.offset.y;
104 CardActor.tempV.z = p.z + data.offsetBack.z + current.offset.z;
108 CardActor.tempV.x = p.x + data.offset.x + current.offset.x;
109 CardActor.tempV.y = p.y + data.offset.y + current.offset.y;
110 CardActor.tempV.z = p.z + data.offset.z + current.offset.z;
116 CardActor.tempV.x = (float)((
int)(
CardActor.tempV.x * 100f)) * 0.01f;
117 CardActor.tempV.y = (float)((
int)(
CardActor.tempV.y * 100f)) * 0.01f;
118 CardActor.tempV2.x = charaActorPCC.provider.vCurrent.source.size.x * current.scale.x;
119 CardActor.tempV2.y = charaActorPCC.provider.vCurrent.source.size.y * current.scale.y;
120 CardActor.tempV2.z = renderDataPcc._scale.z * current.scale.z;
121 base.transform.localRotation = current.rotation;
125 CardActor.tempV2.x = this.originalScale.x * current.scale.x;
126 CardActor.tempV2.y = this.originalScale.y * current.scale.y;
127 CardActor.tempV2.z = this.originalScale.z * current.scale.z;
131 float floatY =
EMono.scene.screenElin.tileMap.floatY;
132 int floatV =
EMono.scene.screenElin.tileMap.floatV;
133 this.sr2.transform.localPosition =
new Vector3(0f, -0.005f * floatY, this.sr2.transform.localPosition.z);
140 else if (floatY < 3f)
150 else if (floatY < 3f)
159 else if (floatY < 2f)
163 else if (floatY < 5f)
171 this.srAnime.sr.sprite = this.srAnime.data.GetSprites().TryGet(index, -1);
173 base.transform.position =
CardActor.tempV;
174 base.transform.localScale =
CardActor.tempV2;
175 this.destLiquid = Mathf.Lerp(this.destLiquid, (
float)p.liquidLv, Core.gameDelta * (
float)((
this.destLiquid > (
float)p.liquidLv) ? 90 : 20));
176 this.mpb.SetFloat(
"_MatColor", p.matColor);
177 this.mpb.SetFloat(
"_Color", p.color);
178 this.mpb.SetFloat(
"_Liquid", this.destLiquid);
179 this.sr.SetPropertyBlock(this.mpb);
184 this.mpb2.SetTexture(
"_MainTex", this.sr2.sprite.texture);
186 this.mpb2.SetTexture(
"_MaskTex", this.sr.sprite.texture);
187 this.mpb2.SetFloat(
"_MatColor", p.matColor);
188 this.mpb2.SetFloat(
"_Color", p.color);
189 this.mpb2.SetFloat(
"_Liquid", this.destLiquid);
190 this.sr2.SetPropertyBlock(this.mpb2);
192 if (this.owner.sourceCard.replacer.data !=
null)
194 SpriteData data2 = this.owner.sourceCard.replacer.data;
197 this.spriteTimer += Core.delta;
198 if (this.spriteTimer >= data2.time)
200 this.spriteTimer -= data2.time;
202 if (this.spriteIndex >= data2.frame)
204 this.spriteIndex = 0;
206 this.sr.sprite = ((data2.spritesSnow !=
null && p.snow) ? data2.spritesSnow[this.spriteIndex] : data2.sprites[this.spriteIndex]);
213 public virtual void RefreshSprite()
218 this.sr2.SetActive(this.owner.Cell.IsFloorWater);
221 if (this.owner !=
null && this.owner.c_textureData !=
null &&
this.sr2)
223 this.sr2.sprite = this.owner.GetPaintSprite();
225 if (traitCanvas !=
null)
227 this.sr2.transform.SetLocalScale(traitCanvas.Scale, traitCanvas.Scale, 1f);
232 this.sr2.sprite = this.owner.GetSprite(0);
235 int dir = this.owner.dir;
236 Sprite sprite = this.sr.sprite = (this.sr.sprite = this.owner.GetSprite(dir));
237 this.sr.flipX = ((dir == 1 || dir == 3) && (this.owner.Thing ==
null || !this.owner.Thing.isEquipped));
238 this.mpb.SetTexture(
"_MainTex", sprite.texture);
239 Vector4 value =
new Vector4(sprite.textureRect.min.x / (
float)sprite.texture.width, sprite.textureRect.min.y / (
float)sprite.texture.height, sprite.textureRect.max.x / (
float)sprite.texture.width, sprite.textureRect.max.y / (
float)sprite.texture.height);
240 this.mpb.SetVector(
"_Rect", value);
241 this.mpb.SetFloat(
"_PixelHeight", sprite.rect.height);
244 if (this.sr2.sprite &&
this.sr2.sprite.texture)
246 this.sr2.flipX = (dir == 1 || dir == 3);
247 sprite = this.sr2.sprite;
250 Rect textureRect = sprite.textureRect;
251 value =
new Vector4(sprite.textureRect.min.x / (
float)sprite.texture.width, sprite.textureRect.min.y / (
float)sprite.texture.height, sprite.textureRect.max.x / (
float)sprite.texture.width, sprite.textureRect.max.y / (
float)sprite.texture.height);
252 this.mpb2.SetTexture(
"_MainTex", sprite.texture);
253 this.mpb2.SetVector(
"_Rect", value);
254 this.mpb2.SetFloat(
"_PixelHeight", sprite.rect.height);
260 this.sr2.sprite =
null;
266 public virtual void Kill()
268 PoolManager.Despawn(base.transform);
275 public SpriteRenderer sr;
278 public SpriteRenderer sr2;
281 public SpriteReplacerAnimation srAnime;
284 public MaterialPropertyBlock mpb;
287 public MaterialPropertyBlock mpb2;
290 public CardActor.Type type;
293 private float destLiquid;
296 private float spriteTimer;
299 private int spriteIndex;
302 private Vector3 originalScale;
305 protected static Vector3 tempV;
308 protected static Vector3 tempV2;