public void Init() { fakeTimer = new FakeCacheTimer(); fakeTimer.IsCacheValid = true; IConfiguration config = new BlockCorpseDisintigrationFixConfig(5, WORLD_HEIGHT, 0, CACHE_PERSISTANCE, true, false); fakeWorld = new FakeWorld(config); groundFinder = new GroundFinder(config, location => fakeWorld.GetBlockAt(location).IsCollideMovement, new GroundPositionCache(fakeTimer)); }
/// <summary> /// Generates a new ZombieCorpsePositioner, that relies on real 7D2D code to perform its function. /// </summary> /// <returns>A new zombie corpse positioner.</returns> public static ZombieCorpsePositioner GenerateNewPositioner() { GroundFinder.IsMovementRestrictingBlock isMovementRestrictingBlock = location => GetBlockAt(location).IsCollideMovement; ZombieCorpsePositioner.Logger log = msg => Debug.Log("Corpse Disintigration Fix: " + msg); ICacheTimer cacheTimer = new CacheTimer(CONFIG.CACHE_PERSISTANCE, () => GameTimer.Instance.ticks); GroundPositionCache cache = new GroundPositionCache(cacheTimer); IGroundFinder groundFinder = new GroundFinder(CONFIG, isMovementRestrictingBlock, cache); return(new ZombieCorpsePositioner(log, IsStableBlock, IsValidSpawnPointForCorpseBlock, groundFinder, CONFIG)); }
public void UseProp() { onUseDestination = PropUser.transform.position + PropUser.transform.forward * Prop.MaxDistanceFromUser; Vector3 midPoint = PropUser.transform.position + (onUseDestination - PropUser.transform.position) * 0.5f; midPoint.y = 1f; Vector3 groundFromArc = GroundFinder.GetGroundFromArc(PropUser.transform.position, midPoint, onUseDestination); if (!PropUser.UsePropAtDestination(groundFromArc)) { } }
private Vector3 getPropDestination(PropUser propUser) { Vector3 vector = propUser.transform.position + propUser.transform.forward * propUser.Prop.MaxDistanceFromUser; if (propUser.Prop.CheckCollisions) { Vector3 midPoint = propUser.transform.position + (vector - propUser.transform.position) * 0.5f; midPoint.y = propUser.transform.position.y + 1f; Vector3 groundFromArc = GroundFinder.GetGroundFromArc(propUser.transform.position, midPoint, vector); return(GroundFinder.GetGround(groundFromArc)); } return(vector); }
/// <summary> /// Gets the game object, rigidbody, and /// </summary> void GetObjects() { if (character == null) { character = gameObject; } if (rb == null) { rb = character.GetComponent <Rigidbody2D>(); } if (cam == null) { cam = GameObject.FindObjectOfType <Camera>(); } animator = GetComponent <Animator>(); sprite = GetComponent <SpriteRenderer>(); finder = groundchecker.GetComponent <GroundFinder>(); }