コード例 #1
0
    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));
    }
コード例 #2
0
    /// <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));
    }
コード例 #3
0
ファイル: PropTest.cs プロジェクト: smdx24/CPI-Source-Code
    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))
        {
        }
    }
コード例 #4
0
ファイル: PropService.cs プロジェクト: smdx24/CPI-Source-Code
        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);
        }
コード例 #5
0
    /// <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>();
    }