// Start is called before the first frame update void Start() { health = GetComponent <Health>(); iframes = GetComponent <IFrames>(); audioManager = AudioManager.instance; spriteFlasher = GetComponent <SpriteFlasher>(); levelLoader = FindObjectOfType <LevelLoader>(); }
public Session(Mock <IApi> apiMock, IFrames globalFrames, UiInitUtil util, FrameActor actor, ISimulatorFrameProvider frameProvider, Dictionary <string, Action> addOns, float fps, SavedDataHandler savedDataHandler, IWrapper wrapper, Action <ISession> setActiveSessionAction) { this.ApiMock = apiMock; this.Frames = globalFrames; this.FrameProvider = frameProvider; this.addOns = addOns; this.fps = fps; this.savedDataHandler = savedDataHandler; this.Util = util; this.Actor = actor; this.wrapper = wrapper; this.setActiveSessionAction = setActiveSessionAction; }
void OnTriggerEnter2D(Collider2D playerCol) { //print("collided"); if (gameObject.CompareTag("Hazard")) { Vector2 knockback = new Vector2(hitboxVector.x * transform.right.x, hitboxVector.y); int d = damage; if (playerCol.tag == "Boss") { playerCol.GetComponent <BossMover>().getHit(knockback, hitlag, hitstun, damage); } else { IFrames i = playerCol.GetComponent <IFrames>(); if (i && i.invincible()) { d = 0; } PlayerMover pm = playerCol.GetComponent <PlayerMover>(); if (pm) { pm.getHit(knockback, hitlag, hitstun, d); } } } else if (playerCol.gameObject.CompareTag("Target")) { atk.addHit(playerCol.gameObject, hitlag); Destroy(playerCol.gameObject); } else if (!atk.hit.Contains(playerCol.gameObject)) { if (playerCol.gameObject.CompareTag("Turret")) { atk.addHit(playerCol.gameObject, hitlag); playerCol.gameObject.GetComponent <EnemyHealth>().takeDamage(damage); } else { IFrames i = playerCol.GetComponent <IFrames>(); if (!i || (!i.invincible())) { collidePlayer(playerCol); } } } }