コード例 #1
0
 public void Awake()
 {
     if (!PLaunch)
     {
         PLaunch = GetComponentInChildren <ParasiteLaunch>();
     }
 }
コード例 #2
0
ファイル: Creature.cs プロジェクト: Darker1300/Paracidic
    public bool EjectParasite()
    {
        if (PlayerController == null)
        {
            return(false);
        }

        PlayerController.PLaunch.CreateParasite(transform.position);

        // Get reliable ParasiteLaunch reference
        ParasiteLaunch pl          = ((PlayerManager)FindObjectOfType(typeof(PlayerManager))).Players[0].PLaunch;
        GameObject     newInstance = pl.CreateParasite(transform.position);

        // Set Physics Cooldown
        ParasiteCooldown = 3.0f;
        var cols = newInstance.GetComponents <Collider2D>();

        foreach (var c in cols)
        {
            Physics2D.IgnoreCollision(ShapeCollider, c);
            IgnoredColliders.AddLast(c);
        }

        // Clear from host
        PlayerController.Host = null;
        PlayerController      = null;

        return(true);
    }